chrippa / ds4drv

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

Does not support model CUH-ZCT2E #164

Closed kylebarbour closed 5 years ago

kylebarbour commented 5 years ago

Issue: ds4drv does not recognize some of the newer DS4 devices, including CUH-ZCT2E.

Expected behavior: ds4drv would recognize this controller like any other.

Potentially related bugs: #104, #114, #162, #163

Related info: My controller shows up using lsusb as 054c:05c4 Sony Corp. DualShock 4. My output when using ds4drv:

[info][controller 1] Created devices /dev/input/js1 (joystick) /dev/input/event16 (evdev) 
[info][bluetooth] Scanning for devices

At this point it hangs. Same thing when using hidraw via USB:

$ ds4drv --hidraw
[info][controller 1] Created devices /dev/input/js1 (joystick) /dev/input/event16 (evdev) 
[info][hidraw] Scanning for devices

I don't think that it's being recognized by hidraw at all. See this output after plugging it in from dmesg:

[61094.034997] usb 1-3: new full-speed USB device number 15 using xhci_hcd
[61094.184448] usb 1-3: New USB device found, idVendor=054c, idProduct=05c4
[61094.184470] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[61094.184484] usb 1-3: Product: Wireless Controller
[61094.184495] usb 1-3: Manufacturer: Sony Computer Entertainment
[61099.394990] sony 0003:054C:05C4.0013: failed to retrieve feature report 0x81 with the DualShock 4 MAC address

My system:

$ lsb_release -cdr:
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic
$ uname -rs
Linux 4.15.0-46-generic
kylebarbour commented 5 years ago

Looks like this was from accidentally buying a knockoff controller. Using one that I'm more confident was an official controller works fine. Thanks!

NyaomiDEV commented 4 years ago

the CUH-ZCT2E is not a knockoff controller, and I can confirm that it does not work. How do I know that? Well, my PS4 came with it. Also, if you search the Sony website, there's even an user manual for that model.

zopsicle commented 3 years ago

Here are hints as to how this may be implemented: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2477531.html

indentationLess commented 2 years ago

is there any updates about this? i am experiencing the exact same issue

noabody commented 2 years ago

On Arch, I modified the hid-sony-ds3usb-dkms package with the patch that chloekek referenced so that my Wingman XE adapter could be recognized as a DS4 controller. This adapter, and I presume many knock-off, or alternative controllers, use feature report 0x12 instead of 0x81. I think adding support for 0x12 in ds4drv would be of great benefit to users.

See more information at my blog.

Apparently ds4drv uses ATTR{product}=="<our product>" in file hidraw.py to identify supported devices? Here's how I found mine:

$ lsusb
Bus 001 Device 003: ID 0c12:0efa Zeroplus Brook Wingman Converter XE
$ udevadm info -a /dev/bus/usb/001/003
ATTR{product}=="Brook Wingman Converter XE"

So, theoretically, we can add my adapter by modifying hidraw.py as so:

HID_DEVICES = {
    "Sony Interactive Entertainment Wireless Controller": HidrawUSBDS4Device,
    "Sony Computer Entertainment Wireless Controller": HidrawUSBDS4Device,
    "Wireless Controller": HidrawBluetoothDS4Device,
    "Brook Wingman Converter XE": HidrawUSBDS4Device,
}

What is the product "name" for CUH-ZCT2E? If it doesn't match one of those shown then it may simply need to be added to the list. Feature report 0x12 may not help for the reported problem although it will probably help overall.

Some discussion of 0x12 can also be found here.

noabody commented 2 years ago

I picked up a knock-off ds4 controller and it identifies itself as 054C:09CC which is a CUH-ZCT2x variant. Its device name would match ds4drv information, same as kylebarbour noted.

Without the custom software from my previous message, here is the dmesg:

usb 8-1.2: new full-speed USB device number 11 using xhci_hcd
usb 8-1.2: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
usb 8-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 8-1.2: Product: Wireless Controller
usb 8-1.2: Manufacturer: Sony Interactive Entertainment
sony 0003:054C:09CC.000C: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
sony 0003:054C:09CC.000C: hidraw9: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:10.1-1.2/input3
sony 0003:054C:09CC.000C: failed to claim input

And here it is with my hid-sony-ds3usb-dkms package that I build for Arch Linux.

usb 8-1.2: new full-speed USB device number 12 using xhci_hcd
usb 8-1.2: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
usb 8-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 8-1.2: Product: Wireless Controller
usb 8-1.2: Manufacturer: Sony Interactive Entertainment
input: Sony Interactive Entertainment Wireless Controller Touchpad as /devices/pci0000:00/0000:00:10.1/usb8/8-1/8-1.2/8-1.2:1.3/0003:054C:09CC.000E/input/input47
input: Sony Interactive Entertainment Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:10.1/usb8/8-1/8-1.2/8-1.2:1.3/0003:054C:09CC.000E/input/input48
input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:10.1/usb8/8-1/8-1.2/8-1.2:1.3/0003:054C:09CC.000E/input/input46
sony 0003:054C:09CC.000E: input,hidraw9: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:10.1-1.2/input3

So that patch works for any generic controller, especially those that identify themselves with a proper VID:PID. It can be made to work for other similarly capable devices, as long as their VID:PID is patched in as was noted in my blog.

indentationLess commented 2 years ago

i am sorry but can you please upload the patched files? thank you!

noabody commented 2 years ago

I can't because the method I used turns a kernel module into dkms. You can extract my arch patch with commands:

wget https://github.com/noabody/unibuild/raw/master/data/arch/hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms/hid-sony-ds3usb-dkms.patch

You'd still need appropriate kernel sources, the latest being:

wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-sony.c
wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-ids.h

Ubuntu has some pointers on how to build a dkms package.

It's going to require some reverse engineering no matter how you look at it. That's what I had to do.

indentationLess commented 2 years ago

thank you it worked :D

BlessedBoi commented 1 year ago

I can't because the method I used turns a kernel module into dkms. You can extract my arch patch with commands:

wget https://github.com/noabody/unibuild/raw/master/data/arch/hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms/hid-sony-ds3usb-dkms.patch

You'd still need appropriate kernel sources, the latest being:

wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-sony.c
wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-ids.h

Ubuntu has some pointers on how to build a dkms package.

It's going to require some reverse engineering no matter how you look at it. That's what I had to do.

Thanks, works great. But is there opportunity to build something like this for bluetooth connection?

zopsicle commented 1 year ago

CUH-ZCT2E already works fine with Bluetooth. The problem is USB-specific.

BlessedBoi commented 1 year ago

CUH-ZCT2E already works fine with Bluetooth. The problem is USB-specific.

So you can for example change color of light bar using steam?

davidalxdre commented 1 year ago

I can't because the method I used turns a kernel module into dkms. You can extract my arch patch with commands:

wget https://github.com/noabody/unibuild/raw/master/data/arch/hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms/hid-sony-ds3usb-dkms.patch

You'd still need appropriate kernel sources, the latest being:

wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-sony.c
wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-ids.h

Ubuntu has some pointers on how to build a dkms package.

It's going to require some reverse engineering no matter how you look at it. That's what I had to do.

Hey bro, could you help me, please?

i have a steam deck and i came to this github because of this thread on reddit:

https://www.reddit.com/r/SteamDeck/comments/zcfun1/comment/j8ivf5s/

My dualshock has the same problem as mentioned,and i tried to install these packages, i had to use pacman to install in the SteamOS, but the controllers still not working after paired, there is a another way to install these? or there is a way to find out whats it's going on after paired?

thank you in advanced.

indentationLess commented 1 year ago

I can't because the method I used turns a kernel module into dkms. You can extract my arch patch with commands:

wget https://github.com/noabody/unibuild/raw/master/data/arch/hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms.patch
patch -Np1 -i hid-sony-ds3usb-dkms/hid-sony-ds3usb-dkms.patch

You'd still need appropriate kernel sources, the latest being:

wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-sony.c
wget https://github.com/torvalds/linux/raw/master/drivers/hid/hid-ids.h

Ubuntu has some pointers on how to build a dkms package. It's going to require some reverse engineering no matter how you look at it. That's what I had to do.

Hey bro, could you help me, please?

i have a steam deck and i came to this github because of this thread on reddit:

https://www.reddit.com/r/SteamDeck/comments/zcfun1/comment/j8ivf5s/

My dualshock has the same problem as mentioned,and i tried to install these packages, i had to use pacman to install in the SteamOS, but the controllers still not working after paired, there is a another way to install these? or there is a way to find out whats it's going on after paired?

thank you in advanced.

can you connect it with a cable and type dmesg in the terminal and show what it says after it's connected?