chrippa / ds4drv

A Sony DualShock 4 userspace driver for Linux
MIT License
1.05k stars 213 forks source link

can't cycle profiles when a profile has mappings that use buttons from the button combo to switch profiles #25

Closed nr1971 closed 10 years ago

nr1971 commented 10 years ago

I have four profiles setup in my ds4drv.conf, default, xpad, xpad-wireless and desktop. I have assigned a combo of R1+L1+RIGHT for cycling forward and R1+L1+LEFT for going back. If I cycle to my "desktop" profile, which has the keyboard and mouse mapped to the controller, I'm unable to change back to the other profiles. In my desktop profile I have BTN_EXTRA = R1, BTN_SIDE = L1 and BTN_LEFT = dpad_left. So maybe the driver is not picking up the combo to change profiles because of those mappings?

chrippa commented 10 years ago

I'm not able to reproduce this here, could you paste your config file?

nr1971 commented 10 years ago

Here it is. Cycling gets stuck on desktop profile.

[ds4drv]

Run ds4drv in background as a daemon

daemon = true

Location of the log file in daemon mode

daemon-log = /tmp/ds4drv.log

Location of the PID file in daemon mode

daemon-pid = /tmp/ds4drv.pid

Enable hidraw mode

hidraw = true

[controller:1] battery-flash = true led = 07a000 profiles = minecraft,xpad,xpad-wireless,desktop bindings = exec [bindings:exec] L1+R1+RIGHT = next-profile L1+R1+LEFT = prev-profile R1+L1+L3 = exec-background xdotool key XF86AudioLowerVolume R1+L1+R3 = exec-background xdotool key XF86AudioRaiseVolume R1+L1+PS = exec-background steam steam://open/bigpicture

[profile:minecraft] led = 000046 trackpad-mouse = true bindings = exec [bindings:exec] R1+L1+TRIANGLE = exec-background antimicro --tray R1+L1+SQUARE = exec-background /home/neil/Games/Minecraft/magic

[profile:xpad] led = 950000 emulate-xpad = true bindings = exec [bindings:exec] R1+L1+L3 = exec-background xdotool key XF86AudioLowerVolume R1+L1+R3 = exec-background xdotool key XF86AudioRaiseVolume

[profile:xpad-wireless] led = 9D5600 emulate-xpad-wireless = true bindings = exec [bindings:exec] R1+L1+L3 = exec-background xdotool key XF86AudioLowerVolume R1+L1+R3 = exec-background xdotool key XF86AudioRaiseVolume

[profile:desktop] led = 32001F trackpad-mouse = true mapping = keyboard

[mapping:keyboard] KEY_UP = dpad_up BTN_LEFT = dpad_left KEY_DOWN = dpad_down BTN_RIGHT = dpad_right REL_X = right_analog_x REL_Y = right_analog_y KEY_ENTER = button_cross KEY_ESC = button_circle KEY_VOLUMEUP = button_r3 KEY_VOLUMEDOWN = button_l3 KEY_LEFTMETA = button_l2 BTN_BACK = button_r2 BTN_SIDE = button_l1 BTN_EXTRA = button_r1

chrippa commented 10 years ago

The desktop profile is missing a binding option. But you're also doing the binding sections wrong. When you define a binding section you give it a name, in this case "exec", but you only need to define this once and then point your profiles to it with "bindings = exec". It is also possible to define global bindings that work on all profiles by not defining a name. I suggest you change it to something like this:


# These bindings are global and work on all profiles
[bindings]
L1+R1+RIGHT = next-profile
L1+R1+LEFT = prev-profile
R1+L1+L3 = exec-background xdotool key XF86AudioLowerVolume
R1+L1+R3 = exec-background xdotool key XF86AudioRaiseVolume
R1+L1+PS = exec-background steam steam://open/bigpicture

# This is a binding profile, you can tell a profile to use them with with "bindings = exec"
[bindings:exec]
R1+L1+TRIANGLE = exec-background antimicro --tray
R1+L1+SQUARE = exec-background /home/neil/Games/Minecraft/magic
nr1971 commented 10 years ago

Ok, that makes sense now. I was assuming by putting - bindings = exec [bindings:exec] under [controller:1] that those would be the default for all profiles. Changed it to what you've posted and its working now. Thanks