PS4 controller(usb) shows up in lsusb but not in /dev/input

Need help with peripherals or devices?
Post Reply
Message
Author
Dzimbahwe
Posts: 3
Joined: 2024-10-04 12:39
Has thanked: 3 times

PS4 controller(usb) shows up in lsusb but not in /dev/input

#1 Post by Dzimbahwe »

I am a linux newbie trying to get a ps4 dual shock controller to work on debian 12.

It is detected and works on windows 11.

here is the output from lsusb-

Code: Select all

Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 054c:05c4 Sony Corp. DualShock 4 [CUH-ZCT1x]
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0b05:1872 ASUSTek Computer, Inc. AURA LED Controller
Bus 001 Device 003: ID 0b05:185c ASUSTek Computer, Inc. Bluetooth Radio 
Bus 001 Device 002: ID c0f4:06f5 Usb KeyBoard Usb KeyBoard
Bus 001 Device 005: ID 046d:c534 Logitech, Inc. Nano Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
here is the output from dmesg -L -w

Code: Select all

[ 1846.705620] usb 3-2: new full-speed USB device number 4 using xhci_hcd
[ 1846.970345] usb 3-2: New USB device found, idVendor=054c, idProduct=05c4, bcdDevice= 1.00
[ 1846.970360] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1846.970367] usb 3-2: Product: Wireless controller
[ 1846.970372] usb 3-2: Manufacturer: Sony Computer Entertainment
[ 1852.186057] sony 0003:054C:05C4.0009: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
[ 1852.186250] sony 0003:054C:05C4.0009: hidraw6: USB HID v81.00 Gamepad [Sony Computer Entertainment Wireless controller] on usb-0000:06:00.0-2/input0
[ 1852.186264] sony 0003:054C:05C4.0009: failed to claim input
Any help would be greatly appreciated.

Aki
Global Moderator
Global Moderator
Posts: 3860
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 107 times
Been thanked: 511 times

Re: PS4 controller(usb) shows up in lsusb but not in /dev/input

#2 Post by Aki »

Hello,
Dzimbahwe wrote: 2024-10-04 13:05 I am a linux newbie trying to get a ps4 dual shock controller to work on debian 12.

here is the output from lsusb-

Code: Select all

Bus 003 Device 004: ID 054c:05c4 Sony Corp. DualShock 4 [CUH-ZCT1x]
here is the output from dmesg -L -w

Code: Select all

[ 1846.705620] usb 3-2: new full-speed USB device number 4 using xhci_hcd
[ 1846.970345] usb 3-2: New USB device found, idVendor=054c, idProduct=05c4, bcdDevice= 1.00
[ 1846.970360] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1846.970367] usb 3-2: Product: Wireless controller
[ 1846.970372] usb 3-2: Manufacturer: Sony Computer Entertainment
[ 1852.186057] sony 0003:054C:05C4.0009: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
[ 1852.186250] sony 0003:054C:05C4.0009: hidraw6: USB HID v81.00 Gamepad [Sony Computer Entertainment Wireless controller] on usb-0000:06:00.0-2/input0
[ 1852.186264] sony 0003:054C:05C4.0009: failed to claim input
Any help would be greatly appreciated.
It seems that your device Sony Corp. DualShock 4 [CUH-ZCT1x] (ID 054c:05c4) is detected, but it is not configured.

Searching the internet, the following discussion was found: It seems that a kernel patch can help:

Code: Select all

--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -491,6 +491,7 @@ struct motion_output_report_02 {

#define DS4_FEATURE_REPORT_0x02_SIZE 37
#define DS4_FEATURE_REPORT_0x05_SIZE 41
+#define DS4_FEATURE_REPORT_0x12_SIZE 16
#define DS4_FEATURE_REPORT_0x81_SIZE 7
#define DS4_FEATURE_REPORT_0xA3_SIZE 49
#define DS4_INPUT_REPORT_0x11_SIZE 78
@@ -2593,6 +2594,53 @@ static int sony_get_bt_devaddr(struct sony_sc *sc)
    return 0;
}

+static int sony_get_usb_ds4_devaddr(struct sony_sc *sc)
+{
+    u8 *buf = NULL;
+    int ret;
+
+    buf = kmalloc(max(DS4_FEATURE_REPORT_0x12_SIZE, DS4_FEATURE_REPORT_0x81_SIZE), GFP_KERNEL);
+    if (!buf)
+        return -ENOMEM;
+
+    /*
+     * The MAC address of a DS4 controller connected via USB can be
+     * retrieved with feature report 0x81. The address begins at
+     * offset 1.
+     */
+    ret = hid_hw_raw_request(sc->hdev, 0x81, buf,
+            DS4_FEATURE_REPORT_0x81_SIZE, HID_FEATURE_REPORT,
+            HID_REQ_GET_REPORT);
+    if (ret == DS4_FEATURE_REPORT_0x81_SIZE) {
+        memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
+        goto out_free;
+    }
+    dbg_hid("%s: hid_hw_raw_request(..., 0x81, ...) returned %d\n", __func__, ret);
+
+    /*
+     * Some variants do not implement feature report 0x81 at all.
+     * Fortunately, feature report 0x12 also contains the MAC address of
+     * a controller.
+     */
+    ret = hid_hw_raw_request(sc->hdev, 0x12, buf,
+            DS4_FEATURE_REPORT_0x12_SIZE, HID_FEATURE_REPORT,
+            HID_REQ_GET_REPORT);
+    if (ret == DS4_FEATURE_REPORT_0x12_SIZE) {
+        memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
+        goto out_free;
+    }
+    dbg_hid("%s: hid_hw_raw_request(..., 0x12, ...) returned %d\n", __func__, ret);
+
+    hid_err(sc->hdev, "failed to retrieve feature reports 0x81 and 0x12 with the DualShock 4 MAC address\n");
+    ret = ret < 0 ? ret : -EINVAL;
+
+out_free:
+
+    kfree(buf);
+
+    return ret;
+}
+
static int sony_check_add(struct sony_sc *sc)
{
    u8 *buf = NULL;
@@ -2613,26 +2661,9 @@ static int sony_check_add(struct sony_sc *sc)
            return 0;
        }
    } else if (sc->quirks & (DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_DONGLE)) {
-        buf = kmalloc(DS4_FEATURE_REPORT_0x81_SIZE, GFP_KERNEL);
-        if (!buf)
-            return -ENOMEM;
-
-        /*
-         * The MAC address of a DS4 controller connected via USB can be
-         * retrieved with feature report 0x81. The address begins at
-         * offset 1.
-         */
-        ret = hid_hw_raw_request(sc->hdev, 0x81, buf,
-                DS4_FEATURE_REPORT_0x81_SIZE, HID_FEATURE_REPORT,
-                HID_REQ_GET_REPORT);
-
-        if (ret != DS4_FEATURE_REPORT_0x81_SIZE) {
-            hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n");
-            ret = ret < 0 ? ret : -EINVAL;
-            goto out_free;
-        }
-
-        memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
+        ret = sony_get_usb_ds4_devaddr(sc);
+        if (ret < 0)
+            return ret;

        snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
             "%pMR", sc->mac_address);
@@ -2670,6 +2701,7 @@ static int sony_check_add(struct sony_sc *sc)
        return 0;
    }

+    dbg_hid("%s: retrieved MAC address: %s\n", __func__, sc->hdev->uniq);
    ret = sony_check_add_dev_list(sc);

out_free:
It is also reported that kernel >= 6.2 should fix the problem.

Therefore, you may consider installing a newer kernel version from the Debian Backports Repositories; you can find instructions here: Hope this helps.

Please let me know.

--
note: please, use code tags to include commands and/or their logs in the body of a message. I fixed the previous message for you.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Dzimbahwe
Posts: 3
Joined: 2024-10-04 12:39
Has thanked: 3 times

Re: PS4 controller(usb) shows up in lsusb but not in /dev/input

#3 Post by Dzimbahwe »

Unfortunately i cannot upgrade my kernel. I followed the instructions but am getting errors. From my research it appears that the installed 535.183.01 nvidia driver (kernel module) does not build with kernel 6.10.6+bpo-amd64 https://forums.debian.net/viewtopic.php?t=160318. I received the following error messages during installation.

Code: Select all

Building module:
Cleaning build area...
env NV_VERBOSE=1 make -j6 modules KERNEL_UNAME=6.10.6+bpo-amd64..................(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.10.6+bpo-amd64 (x86_64)
Consult /var/lib/dkms/nvidia-current/535.183.01/build/make.log for more information.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.10.6+bpo-amd64 failed!
run-parts: /etc/kernel/postinst.d/dkms exited with return code 11
dpkg: error processing package linux-image-6.10.6+bpo-amd64 (--configure):
 installed linux-image-6.10.6+bpo-amd64 package post-installation script subprocess returned error exit status 1
Setting up linux-headers-6.10.6+bpo-common (6.10.6-1~bpo12+1) ...
dpkg: dependency problems prevent configuration of linux-image-amd64:
 linux-image-amd64 depends on linux-image-6.10.6+bpo-amd64 (= 6.10.6-1~bpo12+1); however:
  Package linux-image-6.10.6+bpo-amd64 is not configured yet.

dpkg: error processing package linux-image-amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-headers-6.10.6+bpo-amd64:
 linux-headers-6.10.6+bpo-amd64 depends on linux-image-6.10.6+bpo-amd64 (= 6.10.6-1~bpo12+1) | linux-image-6.10.6+bpo-amd64-unsigned (= 6.10.6-1~bpo12+1); however:
  Package linux-image-6.10.6+bpo-amd64 is not configured yet.
  Package linux-image-6.10.6+bpo-amd64-unsigned is not installed.

dpkg: error processing package linux-headers-6.10.6+bpo-amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-headers-amd64:
 linux-headers-amd64 depends on linux-headers-6.10.6+bpo-amd64 (= 6.10.6-1~bpo12+1); however:
  Package linux-headers-6.10.6+bpo-amd64 is not configured yet.

dpkg: error processing package linux-headers-amd64 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-6.10.6+bpo-amd64
 linux-image-amd64
 linux-headers-6.10.6+bpo-amd64
 linux-headers-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
Last edited by Dzimbahwe on 2024-10-05 06:31, edited 1 time in total.

CwF
Global Moderator
Global Moderator
Posts: 3034
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 62 times
Been thanked: 247 times

Re: PS4 controller(usb) shows up in lsusb but not in /dev/input

#4 Post by CwF »

Dzimbahwe wrote: 2024-10-04 21:04 Unfortunately
You should at least pretend to recognize the kind request to use code tags.
Mottainai

User avatar
fabien
Forum Helper
Forum Helper
Posts: 1118
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 97 times
Been thanked: 253 times

Re: PS4 controller(usb) shows up in lsusb but not in /dev/input

#5 Post by fabien »

Dzimbahwe wrote: 2024-10-04 21:04 Unfortunately i cannot upgrade my kernel. I followed the instructions but am getting errors. From my research it appears that the installed 535.183.01 nvidia driver (kernel module) does not build with kernel 6.10.6+bpo-amd64 https://forums.debian.net/viewtopic.php?t=160318. I received the following error messages during installation.

Code: Select all

Building module:
Cleaning build area...
env NV_VERBOSE=1 make -j6 modules KERNEL_UNAME=6.10.6+bpo-amd64..................(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.10.6+bpo-amd64 (x86_64)
Consult /var/lib/dkms/nvidia-current/535.183.01/build/make.log for more information.
Did you see that there is the nvidia-driver 535.183.06-1~bpo12+1 in backports?
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Dzimbahwe
Posts: 3
Joined: 2024-10-04 12:39
Has thanked: 3 times

Re: PS4 controller(usb) shows up in lsusb but not in /dev/input

#6 Post by Dzimbahwe »

Hi @fabien

Thank you for the information. Why is the driver not upgraded automatically when I upgrade the kernel?

Post Reply