sc-controller icon indicating copy to clipboard operation
sc-controller copied to clipboard

[Feature Request] Support for the Dualsense

Open yoyossef opened this issue 3 years ago • 43 comments

Hi,

I was wondering if the new DualSense controller could be supported? Official drivers are already on the way to be merged for Linux 5.12 ( https://www.phoronix.com/scan.php?page=news_item&px=Sony-PS5-DualSense-Linux-5.12 ) and it is already available on the AUR to install ( https://aur.archlinux.org/packages/hid-playstation-dkms/ ).

SDL and Steam Input already supports it but it would be nice to at least be able to emulate it as a Xbox 360 controller on non-steam games (for example I can't get it to work on some lutris games as is, or even with Steam Input as an overlay).

The drivers are really similar to the DS4 one, the controller is recognized as multiples devices, a controller, a gyroscope, a touchpad etc.

It would be great to have support for the basic DualSense features for now, to be on par with the DualShock 4 support at least because they are so similar.

I tried to get it working through scc/drivers/ds4drv.py by substituting the product id to 0ce6 instead of 09cc but I couldn't get it to work properly when executing scc/drivers/ds4drv.py as a script, the controller gets recognized but the inputs are wrongly read or something.

I would be glad to help (since I have both a DualSense and a DualShock 4 controller) with a little bit of guidance.

yoyossef avatar Feb 27 '21 17:02 yoyossef

I would be glad to help (since I have both a DualSense and a DualShock 4 controller) with a little bit of guidance.

First of all, try skipping DS4Controller class which uses HID directly and using DS4EvdevController which relies on evdev. Evdev equivalent of hiddrv_test can be found here.

Then it's hopefully just about changing BUTTON_MAP, AXIS_MAP and GYRO_MAP so they match what DualSense outputs.

kozec avatar Mar 03 '21 23:03 kozec

@kozec , how to use evdevdrv_test ?

I don't see the BUTTON_MAP being different for DualSense when looking at ds4drv.py. The same key codes are being returned from evtest (or at least the main ones - no idea about the Dpad).

Ot does go wonky when you start it - pressing the right trigger to the max looks as if pressing multiple buttons on the UI: Dual-Sense_tests

Update 1: This could be a better representation of the issue.

Without SC-Controller running things are looking as expected in evtest:

DualSense Left Trigger evtest output
Event: time 1628803562.738729, type 3 (EV_ABS), code 2 (ABS_Z), value 6
Event: time 1628803562.738729, type 1 (EV_KEY), code 312 (BTN_TL2), value 1
Event: time 1628803562.738729, -------------- SYN_REPORT ------------
Event: time 1628803562.742807, type 3 (EV_ABS), code 2 (ABS_Z), value 21
Event: time 1628803562.742807, -------------- SYN_REPORT ------------
Event: time 1628803562.746818, type 3 (EV_ABS), code 2 (ABS_Z), value 40
Event: time 1628803562.746818, -------------- SYN_REPORT ------------
Event: time 1628803562.750823, type 3 (EV_ABS), code 2 (ABS_Z), value 65
Event: time 1628803562.750823, -------------- SYN_REPORT ------------
Event: time 1628803562.754573, type 3 (EV_ABS), code 2 (ABS_Z), value 98
Event: time 1628803562.754573, -------------- SYN_REPORT ------------
Event: time 1628803562.758816, type 3 (EV_ABS), code 2 (ABS_Z), value 136
Event: time 1628803562.758816, -------------- SYN_REPORT ------------
Event: time 1628803562.762653, type 3 (EV_ABS), code 2 (ABS_Z), value 174
Event: time 1628803562.762653, -------------- SYN_REPORT ------------
Event: time 1628803562.766566, type 3 (EV_ABS), code 2 (ABS_Z), value 219
Event: time 1628803562.766566, -------------- SYN_REPORT ------------
Event: time 1628803562.770568, type 3 (EV_ABS), code 2 (ABS_Z), value 243
Event: time 1628803562.770568, -------------- SYN_REPORT ------------
Event: time 1628803562.774556, type 3 (EV_ABS), code 2 (ABS_Z), value 255
Event: time 1628803562.774556, -------------- SYN_REPORT ------------
Event: time 1628803563.194614, type 3 (EV_ABS), code 2 (ABS_Z), value 254
Event: time 1628803563.194614, -------------- SYN_REPORT ------------
Event: time 1628803563.198654, type 3 (EV_ABS), code 2 (ABS_Z), value 233
Event: time 1628803563.198654, -------------- SYN_REPORT ------------
Event: time 1628803563.202567, type 3 (EV_ABS), code 2 (ABS_Z), value 209
Event: time 1628803563.202567, -------------- SYN_REPORT ------------
Event: time 1628803563.206566, type 3 (EV_ABS), code 2 (ABS_Z), value 197
Event: time 1628803563.206566, -------------- SYN_REPORT ------------
Event: time 1628803563.210801, type 3 (EV_ABS), code 2 (ABS_Z), value 180
Event: time 1628803563.210801, -------------- SYN_REPORT ------------
Event: time 1628803563.214608, type 3 (EV_ABS), code 2 (ABS_Z), value 158
Event: time 1628803563.214608, -------------- SYN_REPORT ------------
Event: time 1628803563.218568, type 3 (EV_ABS), code 2 (ABS_Z), value 125
Event: time 1628803563.218568, -------------- SYN_REPORT ------------
Event: time 1628803563.222566, type 3 (EV_ABS), code 2 (ABS_Z), value 81
Event: time 1628803563.222566, -------------- SYN_REPORT ------------
Event: time 1628803563.226557, type 3 (EV_ABS), code 2 (ABS_Z), value 29
Event: time 1628803563.226557, -------------- SYN_REPORT ------------
Event: time 1628803563.230553, type 3 (EV_ABS), code 2 (ABS_Z), value 0
Event: time 1628803563.230553, type 1 (EV_KEY), code 312 (BTN_TL2), value 0
Event: time 1628803563.230553, -------------- SYN_REPORT ------------

With SC-Controller running using Xbox Controller setup with the DualSense controller hooked up, evtest gets the following output from the left trigger:

SC-Controller running - evtest output from DualSense Left Trigger pulled to maximum
Event: time 1628803136.133440, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0
Event: time 1628803136.133440, -------------- SYN_REPORT ------------
Event: time 1628803136.137564, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1628803136.137564, -------------- SYN_REPORT ------------
Event: time 1628803136.141586, type 1 (EV_KEY), code 305 (BTN_EAST), value 1
Event: time 1628803136.141586, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1628803136.141586, -------------- SYN_REPORT ------------
Event: time 1628803136.145613, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1628803136.145613, -------------- SYN_REPORT ------------
Event: time 1628803136.149492, type 1 (EV_KEY), code 308 (BTN_WEST), value 1
Event: time 1628803136.149492, type 1 (EV_KEY), code 305 (BTN_EAST), value 0
Event: time 1628803136.149492, type 1 (EV_KEY), code 307 (BTN_NORTH), value 1
Event: time 1628803136.149492, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1628803136.149492, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 1
Event: time 1628803136.149492, -------------- SYN_REPORT ------------
Event: time 1628803136.153564, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1628803136.153564, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value -1
Event: time 1628803136.153564, -------------- SYN_REPORT ------------
Event: time 1628803136.157367, type 1 (EV_KEY), code 305 (BTN_EAST), value 1
Event: time 1628803136.157367, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1628803136.157367, -------------- SYN_REPORT ------------
Event: time 1628803136.161772, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1628803136.161772, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0
Event: time 1628803136.161772, -------------- SYN_REPORT ------------
Event: time 1628803136.165444, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 0
Event: time 1628803136.165444, -------------- SYN_REPORT ------------
Event: time 1628803136.381441, type 1 (EV_KEY), code 307 (BTN_NORTH), value 0
Event: time 1628803136.381441, -------------- SYN_REPORT ------------
Event: time 1628803136.385593, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1628803136.385593, -------------- SYN_REPORT ------------
Event: time 1628803136.389483, type 1 (EV_KEY), code 305 (BTN_EAST), value 0
Event: time 1628803136.389483, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1628803136.389483, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 1
Event: time 1628803136.389483, -------------- SYN_REPORT ------------
Event: time 1628803136.393598, type 1 (EV_KEY), code 308 (BTN_WEST), value 0
Event: time 1628803136.393598, type 1 (EV_KEY), code 305 (BTN_EAST), value 1
Event: time 1628803136.393598, type 1 (EV_KEY), code 307 (BTN_NORTH), value 1
Event: time 1628803136.393598, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0
Event: time 1628803136.393598, -------------- SYN_REPORT ------------
Event: time 1628803136.397437, type 1 (EV_KEY), code 307 (BTN_NORTH), value 0
Event: time 1628803136.397437, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1628803136.397437, -------------- SYN_REPORT ------------
Event: time 1628803136.401586, type 1 (EV_KEY), code 305 (BTN_EAST), value 0
Event: time 1628803136.401586, type 1 (EV_KEY), code 307 (BTN_NORTH), value 1
Event: time 1628803136.401586, -------------- SYN_REPORT ------------
Event: time 1628803136.405446, type 1 (EV_KEY), code 307 (BTN_NORTH), value 0
Event: time 1628803136.405446, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value -1
Event: time 1628803136.405446, -------------- SYN_REPORT ------------

Update 2: Looking further into the evtest capabilities seems to match the axis bindings so far:

DualSense evtest capabilities
device / dev / input / event25, name "Sony Interactive Entertainment Wireless Controller Touchpad", phys ""
{
    0: [0, 1, 3], 1: [272, 325, 330, 333],
        3: [(0, AbsInfo(value = 1660, min = 0, max = 1919, fuzz = 0, flat = 0, resolution = 0)),
        (1, AbsInfo(value = 306, min = 0, max = 1079, fuzz = 0, flat = 0, resolution = 0)),
        (47, AbsInfo(value = 0, min = 0, max = 1, fuzz = 0, flat = 0, resolution = 0)), 
        (53, AbsInfo(value = 0, min = 0, max = 1919, fuzz = 0, flat = 0, resolution = 0)), 
        (54, AbsInfo(value = 0, min = 0, max = 1079, fuzz = 0, flat = 0, resolution = 0)), 
        (57, AbsInfo(value = 0, min = 0, max = 65535, fuzz = 0, flat = 0, resolution = 0))]
}
device / dev / input / event24, name "Sony Interactive Entertainment Wireless Controller Motion Sensors", phys ""
{ 
    0: [0, 3, 4], 
    3: [(0, AbsInfo(value = -253, min = -32768, max = 32768, fuzz = 16, flat = 0, resolution = 8192)), 
        (1, AbsInfo(value = 8050, min = -32768, max = 32768, fuzz = 16, flat = 0, resolution = 8192)), 
        (2, AbsInfo(value = 1120, min = -32768, max = 32768, fuzz = 16, flat = 0, resolution = 8192)), 
        (3, AbsInfo(value = -124, min = -2097152, max = 2097152, fuzz = 16, flat = 0, resolution = 1024)), 
        (4, AbsInfo(value = -124, min = -2097152, max = 2097152, fuzz = 16, flat = 0, resolution = 1024)), 
        (5, AbsInfo(value = 61, min = -2097152, max = 2097152, fuzz = 16, flat = 0, resolution = 1024))], 
    4: [5] 
}
device / dev / input / event23, name "Sony Interactive Entertainment Wireless Controller", phys ""
{ 
    0: [0, 1, 3, 21], 
    1: [304, 305, 307, 308, 310, 311, 312, 313, 314, 315, 316, 317, 318], 
    3: [(0, AbsInfo(value = 127, min = 0, max = 255, fuzz = 0, flat = 0, resolution = 0)), 
        (1, AbsInfo(value = 131, min = 0, max = 255, fuzz = 0, flat = 0, resolution = 0)), 
        (2, AbsInfo(value = 0, min = 0, max = 255, fuzz = 0, flat = 0, resolution = 0)), 
        (3, AbsInfo(value = 129, min = 0, max = 255, fuzz = 0, flat = 0, resolution = 0)), 
        (4, AbsInfo(value = 129, min = 0, max = 255, fuzz = 0, flat = 0, resolution = 0)), 
        (5, AbsInfo(value = 0, min = 0, max = 255, fuzz = 0, flat = 0, resolution = 0)), 
        (16, AbsInfo(value = 0, min = -1, max = 1, fuzz = 0, flat = 0, resolution = 0)), 
        (17, AbsInfo(value = 0, min = -1, max = 1, fuzz = 0, flat = 0, resolution = 0))], 
    21: [80, 81, 88, 89, 90, 96] 
}

Update 3: Forgot to post the system info:

  • OS: Manjaro Linux x86_64
  • Kernel: 5.13.8-1-MANJARO
  • CPU: AMD Ryzen 7 5800X (16) @ 3.800GHz
  • GPU: AMD ATI Radeon RX 6800/6800 XT / 6900 XT

psstoyanov avatar Aug 12 '21 20:08 psstoyanov

Event: time 1628803562.738729, type 1 (EV_KEY), code 312 (BTN_TL2), value 1 .... Event: time 1628803563.230553, type 1 (EV_KEY), code 312 (BTN_TL2), value 0

Sounds like it actually sends button event when trigger is pulled. 312 is "share" button on DS4. Can't that be reason for virtual buttons getting pressed?

kozec avatar Aug 15 '21 09:08 kozec

Thank you for the reply, @kozec !

It does spawn a button event when the trigger is pulled. Unlike the Steam Controller with its two-stage triggers (defined click when fully pressed), on DualSense these events are spawned when the trigger is pulled and released regardless of the amount. It could be part of the adaptive trigger system? :thinking:

The naming confuses me a bit :smile: Which is the "share" button on DS4? Both DS4 and DualSense use code 314 (BTN_SELECT) for the button next to the touchpad, from what I can find.

Here is a video of SCC misbehaving with DualSense when only the product id change is made: https://user-images.githubusercontent.com/3979134/129480303-bfa96121-307a-41fa-9afe-1aa01132e18f.mp4

When I mess with the hardcoded HID values, the behaviour changes in terms of what buttons are being triggered through scc :thinking: How were the values for the DS4 here derived? This looks to be the most promising place where adjustments for DualSense would have to be made.

Note: When I run SC Controller, I have HID disabled in the settings. SC_Controller_DualSense_tests_and_settings While it could be incredibly naive from my part, actually removing the DS4Controller(HIDController) class leaves the SCC unable to detect the DualSense controller (doesn't show up in Controller registration either which is a tad weird). So it doesn't look like avoiding HID entirely is an option.

psstoyanov avatar Aug 15 '21 13:08 psstoyanov

Small update - I've made a bit of progress with hardcoding new values for the byte_offset. So far, it looks promising.

Currently being stuck on the touchpad. I take it that I should figure out how this commit got to be made: https://github.com/kozec/sc-controller/commit/9a05d1d92610db0888a0dc50353db3732c846f19 If I can understand how to read these two HID descriptors for DualSense and DS4 things will be easier :smiley: I'm not looking forward to the gyro afterwards.

Update: All buttons (touchpad excluded) now work! :tada: Will prepare an initial PR later tonight.

psstoyanov avatar Aug 15 '21 17:08 psstoyanov

This is very promising information for the touchpad but I can't really process it at the moment: https://github.com/nondebug/dualsense/blob/ac25625c5d3b9f067ec92c96e1e0738e5c5f39cc/dualsense-explorer.html#L208

psstoyanov avatar Aug 15 '21 21:08 psstoyanov

Ehh.... I'm still fighting with the Touchpad. On the bright side, the Gyro is working.

Interestingly, it can detect touchpad button press but dealing with the X/Y touch proves to be a bit difficult for me so far.

psstoyanov avatar Aug 16 '21 21:08 psstoyanov

@kozec how did you reach to this commit? https://github.com/kozec/sc-controller/commit/9a05d1d92610db0888a0dc50353db3732c846f19 I'm curious as to what is the proper method of exploring the HID return values and their manipulation.

I'm not sure if DualSense will require changes to DS4TOUCHPAD but I don't understand how the values were reached either.

If I can figure out how to see any printf statements from hiddrv.c, I might be able to see what I'm doing wrong without that much guidance.

psstoyanov avatar Aug 17 '21 09:08 psstoyanov

Found the touchpad byte_offset values for X&&Y on DualSense.

print of values:
offset 33 val:284
val:9
offset 33 val:288
val:9
offset 33 val:288
val:9
offset 33 val:294
val:8
offset 33 val:298
val:7
offset 33 val:298
val:7
offset 33 val:300
val:6
offset 33 val:300
val:6
offset 33 val:301
val:6
offset 33 val:308
val:0
offset 33 val:308
val:0
offset 33 val:308
val:0
offset 33 val:309
val:0
offset 33 val:309
val:0
offset 33 val:310
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:313
val:0
offset 33 val:313
val:0
offset 33 val:312
val:0
offset 33 val:314
val:0
offset 33 val:314
val:0
offset 33 val:315
val:0
offset 33 val:315
val:0
offset 33 val:316
val:0
offset 33 val:317
val:0
offset 33 val:317
val:0
offset 33 val:320
val:0
offset 33 val:320
val:0
offset 33 val:320
val:0
offset 33 val:319
val:0
offset 33 val:319
val:0
offset 33 val:320
val:0
offset 33 val:319
val:0
offset 33 val:319
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:311
val:0
offset 33 val:311
val:0
offset 33 val:311
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:312
val:0
offset 33 val:25
val:49
offset 33 val:13
val:44
offset 33 val:0
val:28
offset 33 val:0
val:29
offset 33 val:0
val:29
offset 33 val:0
val:30
offset 33 val:0
val:26
offset 33 val:0
val:23
offset 33 val:0
val:22
offset 33 val:0
val:22
offset 33 val:0
val:21
offset 33 val:0
val:21
offset 33 val:1
val:22
offset 33 val:2
val:23
offset 33 val:2
val:23
offset 33 val:0
val:27
offset 33 val:5
val:33
offset 33 val:14
val:41
offset 33 val:17
val:48
offset 33 val:28
val:61
offset 33 val:28
val:61
offset 33 val:50
val:94
offset 33 val:59
val:109
offset 33 val:115
val:144
offset 33 val:153
val:163
offset 33 val:153
val:163
offset 33 val:177
val:177
offset 33 val:204
val:189
offset 33 val:226
val:201
offset 33 val:244
val:211
offset 33 val:244
val:211
offset 33 val:266
val:223
offset 33 val:287
val:234
offset 33 val:307
val:245
offset 33 val:327
val:257
offset 33 val:327
val:257
offset 33 val:348
val:268
offset 33 val:380
val:284
offset 33 val:403
val:297
offset 33 val:433
val:314
offset 33 val:433
val:314
offset 33 val:461
val:331
offset 33 val:504
val:353
offset 33 val:534
val:371
offset 33 val:573
val:394
offset 33 val:573
val:394
offset 33 val:606
val:414
offset 33 val:645
val:438
offset 33 val:682
val:460
offset 33 val:721
val:483
offset 33 val:765
val:506
offset 33 val:765
val:506
offset 33 val:806
val:528
offset 33 val:843
val:548
offset 33 val:879
val:568
offset 33 val:914
val:587
offset 33 val:914
val:587
offset 33 val:952
val:606
offset 33 val:989
val:625
offset 33 val:1021
val:641
offset 33 val:1052
val:656
offset 33 val:1052
val:656
offset 33 val:1078
val:669
offset 33 val:1112
val:684
offset 33 val:1145
val:698
offset 33 val:1181
val:713
offset 33 val:1181
val:713
offset 33 val:1217
val:726
offset 33 val:1252
val:738
offset 33 val:1282
val:749
offset 33 val:1322
val:762
offset 33 val:1354
val:773
offset 33 val:1354
val:773
offset 33 val:1376
val:781
offset 33 val:1410
val:792
offset 33 val:1432
val:800
offset 33 val:1453
val:808
offset 33 val:1453
val:808
offset 33 val:1475
val:816
offset 33 val:1492
val:823
offset 33 val:1510
val:830
offset 33 val:1526
val:837
offset 33 val:1526
val:837
offset 33 val:1540
val:843
offset 33 val:1552
val:850
offset 33 val:1564
val:856
offset 33 val:1575
val:861
offset 33 val:1575
val:861
offset 33 val:1589
val:871
offset 33 val:1599
val:881
offset 33 val:1645
val:901
offset 33 val:1647
val:906
offset 33 val:1649
val:913
offset 33 val:1649
val:913
offset 33 val:1661
val:922
offset 33 val:1667
val:928
offset 33 val:1681
val:938
offset 33 val:1679
val:943
offset 33 val:1679
val:943
offset 33 val:1688
val:949
offset 33 val:1702
val:956
offset 33 val:1706
val:958
offset 33 val:1709
val:961
offset 33 val:1709
val:961
offset 33 val:1709
val:963
offset 33 val:1714
val:964
offset 33 val:1716
val:965
offset 33 val:1714
val:966
offset 33 val:1714
val:966
offset 33 val:1715
val:967
offset 33 val:1709
val:968
offset 33 val:1709
val:968
offset 33 val:1709
val:969
offset 33 val:1709
val:969
offset 33 val:1711
val:970
offset 33 val:1708
val:971
offset 33 val:1712
val:972
offset 33 val:1713
val:973
offset 33 val:1720
val:978
offset 33 val:1720
val:978
offset 33 val:1731
val:982
offset 33 val:1741
val:988
offset 33 val:1754
val:993
offset 33 val:1768
val:999
offset 33 val:1768
val:999
offset 33 val:1773
val:1001
offset 33 val:1799
val:1010
offset 33 val:1816
val:1012
offset 33 val:1821
val:1014
offset 33 val:1821
val:1014
offset 33 val:1836
val:1017
offset 33 val:1841
val:1019
offset 33 val:1882
val:1024
offset 33 val:1885
val:1026
offset 33 val:1885
val:1026
offset 33 val:1888
val:1027
offset 33 val:1892
val:1029
offset 33 val:1898
val:1032
offset 33 val:1906
val:1035
offset 33 val:1906
val:1035
offset 33 val:1913
val:1040
offset 33 val:1917
val:1043
offset 33 val:1919
val:1046
offset 33 val:1919
val:1050
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054
offset 33 val:1919
val:1054

Printing the results from hiddrv.c in grab_value posts the correct results.

However trying to use the touchpad through sc-controller is very janky - quite a few jumps left and right. I don't have DS4 to know if that is the expected behaviour there or if I just need to tinker with the config values to make it smooth.

Will push another commit later.

psstoyanov avatar Aug 19 '21 12:08 psstoyanov

I'm curious as to what is the proper method of exploring the HID return values and their manipulation.

I can't say whether it is proper method, but I've just ran loop printing out packets converted to hex and guessed which one is which from how they were changing.

However trying to use the touchpad through sc-controller is very janky - quite a few jumps left and right.

That may be expected. Smoothing is applied much later in mapper, using smooth modifier.

kozec avatar Aug 19 '21 15:08 kozec

Thanks, @kozec !

I wouldn't use the touchpad as a touchpad without further changes for now. It looks as if the jump occurs when lifting and then pressing down (could be re-using the old value as a comparison causing the spike). That would be a task for the future, I guess.

Is there rumble/ haptics support for DS4? Not sure if this will require entirely new pieces of code for DualSense or if I'm missing something while looking at the DS4 config. LED - possibly new struct inside hiddrv.c? Note: This looks like an interesting source when it comes to the value that are spat from HID: https://controllers.fandom.com/wiki/Sony_DualSense/Data_Structures

And then there is the GUI - I should check #595

Something simpler for tonight - checking if it works through Bluetooth.

PS: Doesn't look optimistic:

~ sdl2-jstest -r 0
Unable to open haptic on joystick 0
SDL_Error: Haptic: Joystick isn't a haptic device.

psstoyanov avatar Aug 19 '21 16:08 psstoyanov

Well, the Bluetooth evdev config is all over the place. But it looks like as if only the Dpad and right stick will need some helping hand there. Or is a separate HID driver for Bluetooth preferable?

psstoyanov avatar Aug 19 '21 18:08 psstoyanov

Curious - fftest does work on the same machine:

fftest result with DualSense
Device /dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick opened
Features:
  * Absolute axes: X, Y, Z, RX, RY, RZ, Hat 0 X, Hat 0 Y, 
    [3F 00 03 00 00 00 00 00 ]
  * Relative axes: 
    [00 00 ]
  * Force feedback effects types: Periodic, Rumble, Gain, 
    Force feedback periodic effects: Square, Triangle, Sine, 
    [00 00 00 00 00 00 00 00 00 00 03 07 01 00 00 00 ]
  * Number of simultaneous effects: 16

Setting master gain to 75% ... OK
Uploading effect #0 (Periodic sinusoidal) ... OK (id 0)
Uploading effect #1 (Constant) ... Error: Invalid argument
Uploading effect #2 (Spring) ... Error: Invalid argument
Uploading effect #3 (Damper) ... Error: Invalid argument
Uploading effect #4 (Strong rumble, with heavy motor) ... OK (id 1)
Uploading effect #5 (Weak rumble, with light motor) ... OK (id 2)
Enter effect number, -1 to exit
So at least partial rumble support should be possible :thinking:

psstoyanov avatar Aug 20 '21 16:08 psstoyanov

Is there rumble/ haptics support for DS4? Not sure if this will require entirely new pieces of code for DualSense or if I'm missing something while looking at the DS4 config.

No, but it should be possible for both DS4 and DSS.

It would require only handler like this, but with values DS4/DSS expects.

Or is a separate HID driver for Bluetooth preferable?

I'd say only if it allows for cleaner code.

kozec avatar Aug 20 '21 18:08 kozec

Thank you for the explanation, @kozec ! Not sure if rumble is something I can tackle yet.

Now this is both great and a bit weird at the same time - touchpad in Bluetooth mode.

My previous check was on one of the SBC devices I have and Bluetooth worked well enough. What I didn't notice is the older kernel the device was running explaining the jankier setup.

Meanwhile on the tower, I finally figured out that I had to enable the bluetooth service (cough), DualSense is detected immediately just like the wired connection. The strange part is the touchpad - it works great in Bluetooth mode! No jumping around or strange behaviour like in USB connection. Maybe the byte_offset is different in wired connection?

Tomorrow, I will play a bit with the GUI and maybe touchpad in wired mode.

psstoyanov avatar Aug 20 '21 21:08 psstoyanov

I think so far things are looking good.

I've figured out which piece was missing for the erratic touchpad behaviour in USB mode (missed the override earlier).Stil far slower cursor movement while in USB mode compared to Bluetooth but it's smooth - no random spikes. Added separate UI items for Glade.

USB HID mode does highjack the audio portion from the controller (headphones/mic don't work while emulation is on). Not sure if that is something I can resolve.

@kozec , is there something that you would like to see changed in the merge request? I don't know if it's good but at least some basic support is present.

@yoyossef , it would be great if you can try the changes I've made so far.

psstoyanov avatar Aug 21 '21 21:08 psstoyanov

@psstoyanov do i just build and install your dualsense branch? i want to start testing this as i dont have any other controller i only have a dualsense

lemonxah avatar Aug 26 '21 09:08 lemonxah

@lemonxah , yup, that should be enough :+1:

psstoyanov avatar Aug 26 '21 10:08 psstoyanov

@lemonxah , as a note - you can build and run directly instead of installing. I found this to be a better way and would recommend it as it won't affect your system in case you don't like it. As a side note - the daemon can continue to run if you kill the GUI app. It's good to double-check through htop or similar if scc is still running in the background.

To run just use the run.sh

psstoyanov avatar Aug 26 '21 10:08 psstoyanov

@psstoyanov is your controller working via bluetooth or only usb?

lemonxah avatar Aug 26 '21 13:08 lemonxah

@lemonxah - both. However I am running on kernel 5.13 - if you are on kernel older than 5.12, then I don't know how it will react. The DualSense kernel driver was merged in 5.12 if I recall correctly.

psstoyanov avatar Aug 26 '21 13:08 psstoyanov

@psstoyanov i am on 5.13 manjaro with the sony hid driver installed, but mine isn't workoing with bluetooth, is there any extra steps that you have taken to make it work over blue tooth? the controller connects to my pc fine it works on steam with bluetooth, but i shut down steam before i was running this shoudl steam be running?

lemonxah avatar Aug 26 '21 13:08 lemonxah

For Bluetooth, I just pair the controller from the settings and then it gets picked up sc-controller automatically from what I can see. No idea if hooking it up through USB first makes a difference.

psstoyanov avatar Aug 26 '21 13:08 psstoyanov

weird same setup, but did't it up and then i plugged it in and it works right away .. ok cool let me debug some more thanks, at least i can play lutris games now thanks

lemonxah avatar Aug 26 '21 13:08 lemonxah

@lemonxah , maybe I have system side sdl2 config for DualSense present as well that is affecting the Bluetooth connection (I haven't updated the sdl2 config in sc-controller to include it). I will try to see if that is the case over the weekend.

psstoyanov avatar Aug 27 '21 08:08 psstoyanov

@lemonxah , ahh, I've just rebuilt the branch cleanly. I didn't commit my sdl2 configs and might've remained there when I was running it previously. Will check if Bluetooth will work once I add them back.

Update: Huh, doesn't matter if I plug then in gamecontrollerdb.txt(though I will make another commit containing those just in case).

Starting with Bluetooth mode not being recognised -> disable DualSense support and restart emulation -> re-enable and restart emulation again got it recognised. Not sure why that is :thinking:

psstoyanov avatar Aug 27 '21 11:08 psstoyanov

i have followed those steps mulitple times and its still not recognised in bluetooth,

lemonxah avatar Aug 30 '21 15:08 lemonxah

@lemonxah , I can replicate it with my Pinebook Pro running Manjaro ARM. I will try to see if I can figure out why this happens.

~btw, when you use Bluetooth connection, does it list it as 054c 0xce6 ?~ Doesn't seem related

psstoyanov avatar Aug 30 '21 21:08 psstoyanov

Weird, on the PBP the touchpad isn't detected in BT mode as well. Not sure if it's related or if you observe the same.

I did miss a line here specifically for Bluetooth (it doesn't solve the issue for me): https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scripts/69-sc-controller.rules#L12 Will add it in a bit.

psstoyanov avatar Aug 31 '21 08:08 psstoyanov

@lemonxah , made a couple of changes. Give them a try and lets see if it will resolve it at least for you.

psstoyanov avatar Aug 31 '21 08:08 psstoyanov

Update - on the PBP, DualSense is displayed just as generic controller through evdev whereas on the PC tower it's listed as 3 devices in BT mode as well as USB mode :confused:

psstoyanov avatar Aug 31 '21 11:08 psstoyanov

054C:09CC is reported by DualShock 4 and 054C:0CE6 is DualSense - that should be normal.

Thanks for the log! Will try to see if something stands out

psstoyanov avatar Sep 01 '21 13:09 psstoyanov

Great work on the PR @psstoyanov , I pulled your branch and tried in on my machine. Wired works without a problem, Bluetooth doesn't work at all for me. Seems like the controller is not being detected when paired over Bluetooth.

  • Bluetooth dmesg:
[   86.905921] hid-generic 0005:054C:0CE6.0008: unknown main item tag 0x0
[   86.906128] input: Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:12/0005:054C:0CE6.0008/input/input28
[   86.907443] hid-generic 0005:054C:0CE6.0008: input,hidraw7: BLUETOOTH HID v1.00 Gamepad [Wireless Controller] on 5c:f3:70:a4:1b:f8
[   86.967529] playstation 0005:054C:0CE6.0008: unknown main item tag 0x0
[   86.967892] playstation 0005:054C:0CE6.0008: hidraw7: BLUETOOTH HID v1.00 Gamepad [Wireless Controller] on 5c:f3:70:a4:1b:f8
[   86.983015] input: Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:12/0005:054C:0CE6.0008/input/input29
[   86.984039] input: Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:12/0005:054C:0CE6.0008/input/input30
[   86.985109] input: Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:12/0005:054C:0CE6.0008/input/input31
[   86.987040] playstation 0005:054C:0CE6.0008: Registered DualSense controller hw_version=0x00000313 fw_version=0x01000037
  • USB dmesg
[ 3646.760289] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.3/0003:054C:0CE6.0008/input/input28
[ 3646.760646] hid-generic 0003:054C:0CE6.0008: input,hidraw7: USB HID v1.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:14.0-10/input3
[ 3647.479093] playstation 0003:054C:0CE6.0008: hidraw7: USB HID v1.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:14.0-10/input3
[ 3647.538926] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.3/0003:054C:0CE6.0008/input/input29
[ 3647.539209] input: Sony Interactive Entertainment Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.3/0003:054C:0CE6.0008/input/input30
[ 3647.539783] input: Sony Interactive Entertainment Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.3/0003:054C:0CE6.0008/input/input31
[ 3647.541650] playstation 0003:054C:0CE6.0008: Registered DualSense controller hw_version=0x00000313 fw_version=0x01000037

I'm using jstest to see if button presses are being registered, here are a few screenshots:

  • Wired over USB + Emulation enabled (Works): 2021-10-13_19-44

  • Bluetooth + Emulation disabled: 2021-10-13_19-41

  • Bluetooth + Emulation enabled: 2021-10-13_19-42

tonibgd avatar Oct 13 '21 17:10 tonibgd

Thanks, @tonibgd , I know BT is... at best dodgy for now. I need to spend some time figuring it out. Not sure if that will happen this month.

psstoyanov avatar Oct 13 '21 18:10 psstoyanov

@psstoyanov I managed to make it work over Bluetooth.

Going through the code i saw that HAVE_EVDEV flag is required for Bluetooth callback registering, made me think this check wasn't passing for some reason, so i started looking into evdev dependencies. Remembered that this project uses python2, installed python2-evdev from AUR and now it works. Hope this information is useful.

if HAVE_EVDEV and config["drivers"].get("evdevdrv"):
			daemon.get_device_monitor().add_callback("bluetooth",
							VENDOR_ID, PRODUCT_ID, make_evdev_device, None)
  • https://aur.archlinux.org/packages/python2-evdev

tonibgd avatar Oct 13 '21 18:10 tonibgd

So... the goal would be to figure out a method to notify the user about the presence (or lack of) python2-evdev I guess.

@kozec , is there already per-existing function that is similar or that can be expanded for this purpose?

psstoyanov avatar Oct 13 '21 19:10 psstoyanov