Page 1 of 1

Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Wed May 16, 2018 2:58 pm
by hhzz
Hi there,

this isn't GIMX specific, but since you guys are the experts on the Playstation USB HID traffic, can you help me make sense of the USB HID protocol used by a third party game controller for the PS3? My goal is to add support for this gamepad to Linux.

First of all, thanks a lot for serialusb, which helped me where the Linux input mailing list could not.

The "BigBen Interactive Kid-friendly Wired Controller" PS3OFMINIPAD SONY gamepad identifies as 146b:0902. It's fairly cheap and quite nice. It is an "offical licensed product" and it works out of the box on my PS3 - the BigBen gamepad has four LEDs which light up accordingly and there are force feedback effects in games.

But I don't want to use it with the PS3, it was bought for Retropie running on Linux. While the Sony Dualshock 3 Sixaxis controller is fully supported under Linux, the BigBen gamepad isn't. And when a cheap gamepad doesn't work properly, the obvious thing we do isn't to replace the gamepad, but buy sniffer hardware to get it fixed. :)

Here's what I found out so far and where I'm stuck:

The BigBen gamepad inputs work, all buttons and axes are properly handled by Linux's hid-generic driver.

The BigBen gamepad LEDs and force feedback effects do not work. While Linux's hid driver has force feedback and LED support for many devices, it doesn't discover these features for this gamepad.

The USB HID descriptor for the gamepad contains an output section. As a beginner to USB, I cannot make much sense of it. The descriptor mentions an output report, but I can't make much sense out of these entries:
  • Usage, data= [ 0x21 0x26 ] 9761
  • Usage, data= [ 0x2c ] 44
  • Usage, data= [ 0x2d ] 45
  • Usage, data= [ 0x2e ] 46
  • Usage, data= [ 0x2f ] 47
There are other gamepads with similar USB descriptors that also have these Usage data values: 0f0d:0092 HORI CO.,LTD. POKKEN CONTROLLER and 0738:8828 Mad Catz,Inc. PS3 RF pad - so these values must have some defined meaning.

I looked in the USB HID spec, but these values do not make sense to me, but as a novice, I may obviously be missing things here. Can you explain to me that they mean?

Thanks to serialusb, it was possible to capture actual HID traffice between the PS3 and the gamepad and I have now found working HID commands that seem to be this:
  • 01 08 01 00 00 00 00 00
    The third byte of the message is setting the LEDs. 1 = LED1, 2 = LED2, 4 = LED3, 8 = LED4.
    The meaning of the second byte (08) is unclear to me.
  • 02 08 00 5a 96 00 00 00
    The fourth byte (5a) is the strength of the vibration effect, the fifth byte (96) the timespan/length of the effect.
    The third byte (00) seems to be the type of effect, but I'm not sure yet.
    The meaning of the second byte (08) is unclear to me.
Do these messages seem familiar to you? I couldn't find similar output reports in the Linux driver for the original Sony gamepad.

Can you help me understand the output reports captured with serialusb, based on the USB descriptor of the gamepad? I don't understand the descriptor yet, but want to.

Have you seen other 3rd party Playstation gamepads that use this protocol? If the Usage data values mentioned above aren't specific to this one gamepad, it might be helpful to add generic support for them in Linux's hid driver.

Is there a particular PS3 game I can use to test force feedback effects? The one I tried (Battlefield 3) seems to send very few different effects to the gamepad, but I'd like to capture more effects to make sense of the protocol.

Thank you!

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Thu May 17, 2018 9:09 am
by Matlo

Sadly there is not much to say about the HID report descriptor. It's usual to have output reports with a vendor-specific format.

As you probably figured out, your gamepad uses report ID 01 for LEDs, and report ID 02 for rumble. Adding support into the kernel requires to add a driver that parses these specific output reports.

EDIT: modifying the packets forwarded by serialusb may also help making sense of the output reports.

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Thu May 17, 2018 10:18 am
by hhzz
This is the first HID device I look at more closely. So you say it's to be expected that the report descriptor doesn't necessarily properly describe the report?

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Thu May 17, 2018 10:51 am
by Matlo
Yes. The hid-sony driver knows the format: ... ony.c#L458

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Thu May 17, 2018 11:41 am
by hhzz
Just curious: Do you know if the Playstation actually uses button pressure? The gamepad I am looking at sends button pressure data via its HID report, but the Linux driver discards those and only returns "pressed" / "not pressed" to the application.

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Thu May 17, 2018 12:24 pm
by Matlo
All Sixaxis/Dualshock3 buttons are pressure-sensitive, but I think this was probably used only for L2 and R2. These buttons are the only pressure-sensitive ones on the Dualshock4.

I am a bit surprised that Linux does not map button pressure data to axes as it does this for the Sixaxis/Dualshock3. Maybe the input report descriptor is broken. Broken descriptors are quite common, and Linux deals with this by either fixing the report descriptor sent by the device, or by embedding a full fixed report descriptor.

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Fri May 18, 2018 7:52 am
by hhzz
Thanks for all the clarifications. Yes, the Linux hid-generic driver doesn't map the BigBen's L2/R2 buttons to pressure-sensitive data, but that's one thing I might be able to fix. I now have all the missing parts and also identified the meaning of the third byte in the force feedback command - it's 0 when the right motor is off and not 0 when it's on, which is a bit similar to the way the original gamepad works.

Do you know anything about how Sony's relationship with device manufacturers work? I find it weird that the PS3 auto-detects everything correctly for the BigBen gamepad, despite the HID report descriptor being either wrong or ambiguous.

That relationship between Sony and the manufacturers of licensed devices, which way does it work? Is it a) the manufacturer who has to build a device that behaves according to Sony's predefined HID protocol or is it b) Sony who has to maintain a working driver for licensed devices and put them in the console firmware?

It seems to be b) as I haven't found similar gamepad HID protocols in the collection of Linux's HID drivers, so far.

Re: Questions about "officially licensed" wired PS3 controller 146b:0902

Posted: Sat May 19, 2018 2:06 pm
by Matlo
I would say b).