chrippa / ds4drv

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

DualSense Support? #182

Open cow-killer opened 4 years ago

cow-killer commented 4 years ago

Hey there, I don't suppose there's any way we could reverse-engineer the DualSense controller's connectivity and get this working within ds4drv?

Edit: posting the output of running ds4drv in the event it might help:

Traceback (most recent call last):
  File "/home/cowkiller/miniconda3/bin/ds4drv", line 8, in <module>
    sys.exit(main())
  File "/home/cowkiller/miniconda3/lib/python3.8/site-packages/ds4drv/__main__.py", line 154, in main
    for device in backend.devices:
  File "/home/cowkiller/miniconda3/lib/python3.8/site-packages/ds4drv/backends/bluetooth.py", line 132, in devices
    device = self.find_device()
  File "/home/cowkiller/miniconda3/lib/python3.8/site-packages/ds4drv/backends/bluetooth.py", line 121, in find_device
    return BluetoothDS4Device.connect(bdaddr)
  File "/home/cowkiller/miniconda3/lib/python3.8/site-packages/ds4drv/backends/bluetooth.py", line 23, in connect
    ctl_socket = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET,
AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'
AurelienKun commented 3 years ago

I second this demand. Ive tried a kernel 5.12 that enable the driver but somehow the mapping is still wrong and the gamepad does not work at all on some emulators like dolphin.

The driver implemented by steam (whatever the kernel version) seems to work very well though (but only for steam games). It might be great to look at their implementation.

QuixoticGitHub commented 3 years ago

Status?

albfan commented 2 years ago

If https://github.com/naoki-mizuno/ds4_driver/issues/16 was closed, what's the point of this issue?

this is ds4 (dualshock), why would it support dualsense (ds5)?

barkovv commented 2 years ago

Dualsense (ds5) is supported out of box by hid-playstation module from linux kernel (starting from version 5.12, here are the patches for it ).

Both bluetooth and USB mode are supported by Sony. I don't see any reason for opensource community driver.

I've tested it with Hotline Miami (steam version), it works pretty fine.

QuixoticGitHub commented 2 years ago

Hello people. Regarding 5.12 support for DualSense it seems that the driver released by Sony was either containing a few errors or something went wrong during the implementation. From what I recall it was the vertical axis of the left stick button and the R2 button that was swapped.

The controller works through Steam... But only because they use their own driver.

Any other native Linux game (tuxracer etc) only works if users manage to configure the controllers within the games and that hardly should be necessary.

On Wed, 5 Jan 2022, 02:17 Vadim Barkov, @.***> wrote:

Dualsense (ds5) is supported out of box by hid-playstation module from linux kernel (starting from version 5.12, here @.***/> are the patches for it ).

Both bluetooth and USB mode are supported by Sony. I don't see any reason for opensource community driver.

— Reply to this email directly, view it on GitHub https://github.com/chrippa/ds4drv/issues/182#issuecomment-1005300279, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVKX7DKF4VIUTHO2DYTLJ3UUOL4DANCNFSM4TX4BXNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

AurelienKun commented 2 years ago

@barkovv try something outside Steam plateform and you'll see the issue (whatever you're using BT or USB).

QuixoticGitHub commented 2 years ago

Simplest demonstration... Install jstest-gtk and see for yourselves :)

On Wed, 5 Jan 2022, 13:46 Auré-Chan, @.***> wrote:

@barkovv https://github.com/barkovv try something outside Steam plateform and you'll see the issue (whatever you're using BT or USB).

— Reply to this email directly, view it on GitHub https://github.com/chrippa/ds4drv/issues/182#issuecomment-1005656153, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVKX7EDSQ3TNHCTYMQ7CULUUQ4RRANCNFSM4TX4BXNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

barkovv commented 2 years ago

Yeah, you're right now I see the problem in the NonSteam environment (in Cyberpunk 2077 via Geforce Now).

I found a workaround for it using xboxdrv (from here) Consider that you have dualsense.xboxdrv (this is mine example, I've just modified evdev value):

[xboxdrv]

#evdev = /dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick
evdev = /dev/input/event15
evdev-grab = true
evdev-debug = true
mimic-xpad = true
silent = true
quiet = true
#deadzone = 5%
#deadzone-trigger = 10%

[axismap]

-Y1 = Y1
-Y2 = Y2

[evdev-absmap]

ABS_HAT0X = dpad_x
ABS_HAT0Y = dpad_y
ABS_X     = X1
ABS_Y     = Y1
ABS_RX    = X2
ABS_RY    = Y2
ABS_Z     = LT
ABS_RZ   = RT

[evdev-keymap]

BTN_SOUTH    = A
BTN_EAST     = B
BTN_NORTH    = Y
BTN_WEST     = X
BTN_START    = start
BTN_MODE     = guide
BTN_SELECT   = back
BTN_TL       = LB
BTN_TR       = RB
BTN_TL2      = LT
BTN_TR2      = RT
BTN_THUMBL   = TL
BTN_THUMBR   = TR

# EOF #

evdev value was found in /proc/bus/input/devices (here is part of mine for Bluetooth connection)

I: Bus=0005 Vendor=054c Product=0ce6 Version=8100
N: Name="Wireless Controller"
P: Phys=
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256/0005:054C:0CE6.0003/input/input24
U: Uniq=d0:bc:c1:98:17:63
H: Handlers=event15 js0
B: PROP=0
B: EV=20000b
B: KEY=7fdb000000000000 0 0 0 0
B: ABS=3003f
B: FF=107030000 0

For my case it's /dev/input/event15 (replace with yours if needed) Then you should just do:

sudo xboxdrv -c dualsense.xboxdrv

It should fix the problem (works for me). In case it's not just try to delete /dev/input/js0 file (js0 is taken from above, replace with yours one if needed).

Hope it helps. https://wiki.archlinux.org/title/Gamepad#Playstation_5_(Dualsense)_controller

QuixoticGitHub commented 2 years ago

Question is, to whom do we forward this? Seems the support rolled out in 5.12 needs adjustment.

On Thu, 6 Jan 2022, 02:22 Vadim Barkov, @.***> wrote:

Yeah, you're right now I see the problem in the NonSteam environment (in Cyberpunk 2077 via Geforce Now).

I found a workaround for it using xboxdrv https://xboxdrv.gitlab.io/ (from here https://github.com/yoyossef/ds360) Consider that you have dualsense.xboxdrv https://github.com/yoyossef/ds360/blob/main/dualsense.xboxdrv (this is mine example, I've just modified evdev value):

[xboxdrv]

evdev = /dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick

evdev = /dev/input/event15 evdev-grab = true evdev-debug = true mimic-xpad = true silent = true quiet = true

deadzone = 5%

deadzone-trigger = 10%

[axismap]

-Y1 = Y1 -Y2 = Y2

[evdev-absmap]

ABS_HAT0X = dpad_x ABS_HAT0Y = dpad_y ABS_X = X1 ABS_Y = Y1 ABS_RX = X2 ABS_RY = Y2 ABS_Z = LT ABS_RZ = RT

[evdev-keymap]

BTN_SOUTH = A BTN_EAST = B BTN_NORTH = Y BTN_WEST = X BTN_START = start BTN_MODE = guide BTN_SELECT = back BTN_TL = LB BTN_TR = RB BTN_TL2 = LT BTN_TR2 = RT BTN_THUMBL = TL BTN_THUMBR = TR

EOF

evdev value was found in /proc/bus/input/devices (here is part of mine for Bluetooth connection)

I: Bus=0005 Vendor=054c Product=0ce6 Version=8100 N: Name="Wireless Controller" P: Phys= S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256/0005:054C:0CE6.0003/input/input24 U: Uniq=d0:bc:c1:98:17:63 H: Handlers=event15 js0 B: PROP=0 B: EV=20000b B: KEY=7fdb000000000000 0 0 0 0 B: ABS=3003f B: FF=107030000 0

For my case it's /dev/input/event15 (replace with yours if needed) Then you should just do:

sudo xboxdrv -c dualsense.xboxdrv

It should fix the problem (works for me). In case it's not just try to delete */dev/input/js0* file (js0 is taken from above, replace with yours one if needed).

Hope it helps.

— Reply to this email directly, view it on GitHub https://github.com/chrippa/ds4drv/issues/182#issuecomment-1006208928, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVKX7CQRJN3ZFJKVYHJ4R3UUTVGBANCNFSM4TX4BXNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

QuixoticGitHub commented 2 years ago

Did anyone else manage to confirm/fix this?

Do we push this information to someone else?

loveisfoss commented 2 years ago

If naoki-mizuno/ds4_driver#16 was closed, what's the point of this issue?

this is ds4 (dualshock), why would it support dualsense (ds5)?

The point would be to create a dsu server in order to use motion controls with cemu (which I personally run with wine/lutris) that runs a dsu client (cemuhook).

By the way, l run Debian bookworm with kernel 5.16 and I don't see any module containing the word "PlayStation" loaded, when doing lsmod. On lsusb, I see the DualSense controller entry normally. But for example, evdevhook cannot see it, so I don't know if the driver is loaded properly.