RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    PS4 controller not detected in Retropie 4.6 on Pi 4B

    Scheduled Pinned Locked Moved Help and Support
    ps4 controllerpi4 bretropie 4.6dualshock 4usb gamepad
    39 Posts 5 Posters 7.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mituM
      mitu Global Moderator
      last edited by

      Add some more info about your system, as detailed in https://retropie.org.uk/forum/topic/3/read-this-first.

      Can you check if the controller is detected when plugged by, by running

      lsusb
      cat /proc/bus/input/devices
      
      J 1 Reply Last reply Reply Quote 0
      • J
        jmcdra @mitu
        last edited by jmcdra

        @mitu
        Pi Model or other hardware: pi 4B
        Power Supply used: USB-C Power Supply, 5.1V 3.0A,
        RetroPie Version Used: 4.6.5
        Built From: retropie-buster-4.6-rpi4.img.gz
        USB Devices connected: Sony Dualshock 4 controller, 128 gb USB drive, wireless adapter for Logitech keyboard/trackpad
        Controller used:Sony Dualshock 4
        Error messages received: no gamepad detected
        Attachment of config files: not sure which config files to post
        Results of lsusb

        Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
        Bus 001 Device 005: ID 054c:05c4 Sony Corp. DualShock 4 [CUH-ZCT1x]
        Bus 001 Device 004: ID 154b:00f8 PNY
        Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver 
        Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
        Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 3.0 root hub
        
        mituM 1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @jmcdra
          last edited by

          I see that the DS4 controller appears in the list of connected USB devices - that's ok. What about the 2nd command that I posted ? Does it show the DS4 controller connected and detected as an input device ?

          J 2 Replies Last reply Reply Quote 0
          • J
            jmcdra @mitu
            last edited by jmcdra

            @mitu I tried the other command and it said something about not being found.

            I'll have to look at it again after some sleep

            1 Reply Last reply Reply Quote 0
            • J
              jmcdra @mitu
              last edited by jmcdra

              @mitu

              cat /proc/bus/input/devices
              I: Bus=0003 Vendor=046d Product=404b Version=0111
              N: Name="Logitech K400"
              P: Phys=usb-0000:01:00.0-1.1/input2:1
              S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:045D:C52B.0003/0003:046D:404B.0005/input/input13 
              U: Uniq=404b-a4-6a-a5-cd
              H: Handlers=sysrq kid less mouse0 events
              B: PROP=0
              B: EV=12001f
              B: KEY=3f 301ff 0 0 0 0 483ffff 17aff32d bfd44446 0 0 ffff0001 130ff3 8d17c007 ffff7bfa d941dfff ffbeffdf ffefffff ffffffff fffffffe
              B: REL=1943
              B: ABS=1 0
              B: MSC=10
              B: LED=1f
              
              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @jmcdra
                last edited by mitu

                Normally this should show the connected gamepad, something like

                ...
                I: Bus=0003 Vendor=054c Product=09cc Version=8111
                N: Name="Sony Interactive Entertainment Wireless Controller"
                P: Phys=usb-0000:01:00.0-1.3/input3
                S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.3/0003:054C:09CC.0034/input/input150
                U: Uniq=dc:0c:2d:86:41:f6
                H: Handlers=event5 js0 
                B: PROP=0
                B: EV=20001b
                B: KEY=7fdb0000 0 0 0 0 0 0 0 0 0
                B: ABS=3003f
                B: MSC=10
                B: FF=1 7030000 0 0
                

                Is that the whole output of the command ?

                J 1 Reply Last reply Reply Quote 0
                • J
                  jmcdra @mitu
                  last edited by jmcdra

                  @mitu yep

                  Edit: That "kid less" and "events" in the code should be "kbd leds" and "event0" respectively. Autocorrect changed it

                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by

                    It looks like your controller is not detected as a gamepad by the OS - that's the reason it's not working with RetroPie. It seems to appear as connected via USB, but no input device is created for it (only the keyboard shows up in the 2nd command).
                    Can you try and run the following commands - after exiting EmulationStation and disconnecting the gamepad:

                    sudo dmesg -c > /dev/null
                    

                    connect back the controller then run

                    dmesg
                    

                    Post the output of the 2nd command.

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      jmcdra @mitu
                      last edited by

                      @mitu ran the two commands. I did not get any output on my screen

                      mituM 1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @jmcdra
                        last edited by

                        @jmcdra Did you connect the gamepad between the 2 commands ? Otherwise nothing will be shown.

                        J 2 Replies Last reply Reply Quote 0
                        • RionR
                          Rion
                          last edited by

                          @jmcdra
                          Are you absolutely sure it's a genuine Dualshock 4 Controller?

                          As far as i know the official retail controllers these days don't come with an usb cable.

                          There is a myriad of fake controllers out there and it's getting more difficult to spot a fake from a real one.

                          The best way to be completely sure is to open it up and look at the pcb.

                          FBNeo rom filtering
                          Mame2003 Arcade Bezels
                          Fba Arcade Bezels
                          Fba NeoGeo Bezels

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            jmcdra @mitu
                            last edited by

                            @mitu yes I did

                            1 Reply Last reply Reply Quote 0
                            • RionR
                              Rion
                              last edited by

                              @jmcdra

                              ifixit Difference between fake and original

                              FBNeo rom filtering
                              Mame2003 Arcade Bezels
                              Fba Arcade Bezels
                              Fba NeoGeo Bezels

                              1 Reply Last reply Reply Quote 0
                              • J
                                jmcdra @Rion
                                last edited by

                                @Rion I'm sure it is. It has the sony logo and a sony model number on it and the packaging.

                                1 Reply Last reply Reply Quote 0
                                • J
                                  jmcdra @mitu
                                  last edited by

                                  @mitu
                                  Here we go. I don't know why it didn't read it the first time. Here's the message I got.

                                  [ 1625.139228] usb 1-1.3: new full-speed USB device number 5 using xhci_hcd
                                  [ 1625.239449] usb 1-1.3: device descriptor read/64, error -32
                                  [ 1625.459455] usb 1-1.3: device descriptor read/64, error -32
                                  [ 1634.359323] usb 1-1.3: new full-speed USB device number 7 using xhci_hcd
                                  [ 1634.495641] usb 1-1.3: New USB device found, idVendor=054c, idProduct=05c4, bcdDevice= 1.00
                                  [ 1634.495657] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
                                  [ 1634.495669] usb 1-1.3: Product: Wireless Controller
                                  [ 1634.495681] usb 1-1.3: Manufacturer: Sony Computer Entertainment
                                  [ 1637.573784] sony 0003:054C:05C4.0005: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
                                  [ 1637.574041] sony 0003:054C:05C4.0005: hidraw2: USB HID v81.11 Gamepad [Sony Computer Entertainment Wireless Controller] on usb-0000:01:00.0-1.3/input0
                                  [ 1637.574055] sony 0003:054C:05C4.0005: failed to claim input
                                  [ 1637.645948] usb 1-1.3: USB disconnect, device number 7
                                  [ 1742.400667] usb 1-1.3: new full-speed USB device number 8 using xhci_hcd
                                  [ 1742.546984] usb 1-1.3: New USB device found, idVendor=054c, idProduct=05c4, bcdDevice= 1.00
                                  [ 1742.546999] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
                                  [ 1742.547011] usb 1-1.3: Product: Wireless Controller
                                  [ 1742.547023] usb 1-1.3: Manufacturer: Sony Computer Entertainment
                                  [ 1747.621036] sony 0003:054C:05C4.0006: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
                                  [ 1747.621300] sony 0003:054C:05C4.0006: hidraw2: USB HID v81.11 Gamepad [Sony Computer Entertainment Wireless Controller] on usb-0000:01:00.0-1.3/input0
                                  [ 1747.621314] sony 0003:054C:05C4.0006: failed to claim input
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • mituM
                                    mitu Global Moderator
                                    last edited by

                                    This looks like a problem with the USB connection - bad cable/bad USB port (less likely). Can you try different ports (assuming you didn't do that already) or another USB cable ?

                                    J 1 Reply Last reply Reply Quote 0
                                    • J
                                      jmcdra @mitu
                                      last edited by

                                      @mitu I'll have to go and get a different cable. Anything I should look for in a cable for a ps4 controller then?

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        jmcdra
                                        last edited by

                                        I ended up trading my ps4 controller with a friend that had one that came with her console. Kinda sucked because I really liked the Electric Purple color but I'd rather have a working wireless controller than one that's just a paperweight. I wonder if Sony changed something slightly with their controllers that kept it from connecting to Raspberry OS. I guess this topic can be closed now since it's technically resolved.

                                        1 Reply Last reply Reply Quote 0
                                        • ?
                                          A Former User
                                          last edited by A Former User

                                          @mitu

                                          I have the same problem in Retropie 4.7.1 on Pi 3B

                                          PS4 Controller is listed on lsusb:

                                          $ lsusb
                                          Bus 001 Device 113: ID 054c:09cc Sony Corp. DualShock 4 [CUH-ZCT2x]
                                          Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp.
                                          Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
                                          Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
                                          Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
                                          
                                          

                                          But not on cat /proc/bus/input/devices

                                          So I quit emulestation and disconnecting the gamepad and I type this command:

                                          sudo dmesg -c > /dev/null

                                          Then type dmesg:

                                           $ dmesg
                                          [ 1044.875365] usb 1-1.3: new full-speed USB device number 33 using dwc_otg
                                          [ 1045.011009] usb 1-1.3: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
                                          [ 1045.011030] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
                                          [ 1045.011046] usb 1-1.3: Product: Wireless Controller
                                          [ 1045.011062] usb 1-1.3: Manufacturer: Sony Interactive Entertainment
                                          [ 1045.011078] usb 1-1.3: SerialNumber: Wireless Controller
                                          [ 1045.046250] sony 0003:054C:09CC.0096: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
                                          [ 1045.046563] sony 0003:054C:09CC.0096: hidraw0: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-3f980000.usb-1.3/input3
                                          [ 1045.046577] sony 0003:054C:09CC.0096: failed to claim input
                                          [ 1048.928523] usb 1-1.3: USB disconnect, device number 33
                                          [ 1049.235375] usb 1-1.3: new full-speed USB device number 34 using dwc_otg
                                          [ 1049.370882] usb 1-1.3: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
                                          [ 1049.370905] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
                                          [ 1049.370921] usb 1-1.3: Product: Wireless Controller
                                          [ 1049.370937] usb 1-1.3: Manufacturer: Sony Interactive Entertainment
                                          [ 1049.370951] usb 1-1.3: SerialNumber: Wireless Controller
                                          [ 1049.394514] sony 0003:054C:09CC.0097: failed to retrieve feature report 0x81 with the DualShock 4 MAC address
                                          [ 1049.394868] sony 0003:054C:09CC.0097: hidraw0: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-3f980000.usb-1.3/input3
                                          [ 1049.394886] sony 0003:054C:09CC.0097: failed to claim input
                                          [ 1053.281480] usb 1-1.3: USB disconnect, device number 34
                                          [ 1053.625377] usb 1-1.3: new full-speed USB device number 35 using dwc_otg
                                          
                                          

                                          Any help?

                                          Thank you

                                          1 Reply Last reply Reply Quote 0
                                          • ?
                                            A Former User
                                            last edited by A Former User

                                            I found some info about a patch to fix it:
                                            https://bbs.archlinux.org/viewtopic.php?id=262451

                                            --- a/drivers/hid/hid-sony.c	2021-12-21 22:16:46.190024249 -0500
                                            +++ b/drivers/hid/hid-sony.c	2021-12-21 22:30:16.048986978 -0500
                                            @@ -504,6 +504,7 @@
                                             
                                             #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,55 @@
                                             	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 +2663,9 @@
                                             			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 +2703,7 @@
                                             		return 0;
                                             	}
                                             
                                            +        dbg_hid("%s: retrieved MAC address: %s\n", __func__, sc->hdev->uniq);
                                             	ret = sony_check_add_dev_list(sc);
                                             
                                             out_free:
                                            

                                            I don't know how to apply this patch to be able to test it with the controller.

                                            Could someone tell me all the steps to follow to test this patch in Retropie?

                                            Thanks

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.