2021-12-19 22:42:03

by Jeremy Slemp

[permalink] [raw]
Subject: Trouble parsing HID reports from PDP PS4 remote

I bought a PDP Bluetooth PS4 remote[0] in the hopes of using it to
send keypress events to my Python script via evdev[1]. I found that
some of the buttons on the remote generate HID events that are seen by
evdev, but others do not. So I'd like to figure out the best way to
receive events from the currently-unsupported buttons.

bluetoothctl describes the device as:

Device 3E:09:EC:xx:xx:xx (public)
Name: PDP Media Remote
Alias: PDP Media Remote
Class: 0x0000250c
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)

The main module inside the device is an BTM0612C2P[2].


The "good" buttons flip a bit in a mask in bytes 2-5:

SHARE button, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2232 [hci0] 4474.225390
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 10 00 09 00 16 73 47 06 ........sG.
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2233 [hci0] 4474.355396
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 09 00 89 24 5e 56 ........$^V

UP ARROW, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2240 [hci0] 4536.493867
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 00 00 00 0a 00 8b 3c 03 4d ........<.M
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2241 [hci0] 4536.727587
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}

PINK SQUARE, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2259 [hci0] 4676.429686
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 18 00 00 0a 00 c8 e0 93 1d ...........
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2260 [hci0] 4676.639687
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}


The "bad" buttons seem to transmit a constant in byte 6 instead of a
bitmask in bytes 2-5:

REWIND, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2261 [hci0] 4696.955007
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 17 8d f2 a0 fe ...........
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2262 [hci0] 4697.163765
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}

PLAY, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2264 [hci0] 4710.348944
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 16 1b c2 a7 89 ...........
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2265 [hci0] 4710.531446
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}

PAUSE, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2266 [hci0] 4717.501552
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 1a 30 8e 11 80 .......0...
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2267 [hci0] 4717.685317
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}

ENTER, press/release:

> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2293 [hci0] 4844.683443
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 0d f7 0b c2 03 ...........
> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2294 [hci0] 4844.867210
Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}

I tried to decode these reports according to the USB HID spec but they
didn't make much sense to me beyond the "collection (application)"
part. Can anyone help understand what this remote is doing?


[0] https://www.amazon.com/dp/B072C7YZFC
[1] https://python-evdev.readthedocs.io/en/latest/
[2] https://www.oemblue.com/download/BTM0612C2P%20Hardware%20Datasheet.pdf


2021-12-20 14:46:46

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: Trouble parsing HID reports from PDP PS4 remote

Hi Jeremy,

On 12/19/21 23:41, Jeremy Slemp wrote:
> I bought a PDP Bluetooth PS4 remote[0] in the hopes of using it to
> send keypress events to my Python script via evdev[1]. I found that
> some of the buttons on the remote generate HID events that are seen by
> evdev, but others do not. So I'd like to figure out the best way to
> receive events from the currently-unsupported buttons.

If evdev shows some events, this is not related to bluetooth but the HID
stack in the kernel (I cc-ed linux-input@)

Basically, we might need to add support for this remote in the hid-sony
driver.

Can you attach the full output of hid-recorder (from the hid-tools[3]
repository) when you press all of these buttons?

This should give us enough information to reply the event sequence
locally and fix the drivers if we need.

Cheers,
Benjamin

[3] https://gitlab.freedesktop.org/libevdev/hid-tools

>
> bluetoothctl describes the device as:
>
> Device 3E:09:EC:xx:xx:xx (public)
> Name: PDP Media Remote
> Alias: PDP Media Remote
> Class: 0x0000250c
> Paired: yes
> Trusted: yes
> Blocked: no
> Connected: yes
> LegacyPairing: no
> UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
> UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
>
> The main module inside the device is an BTM0612C2P[2].
>
>
> The "good" buttons flip a bit in a mask in bytes 2-5:
>
> SHARE button, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2232 [hci0] 4474.225390
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 10 00 09 00 16 73 47 06 ........sG.
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2233 [hci0] 4474.355396
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 09 00 89 24 5e 56 ........$^V
>
> UP ARROW, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2240 [hci0] 4536.493867
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 00 00 00 0a 00 8b 3c 03 4d ........<.M
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2241 [hci0] 4536.727587
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}
>
> PINK SQUARE, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2259 [hci0] 4676.429686
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 18 00 00 0a 00 c8 e0 93 1d ...........
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2260 [hci0] 4676.639687
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}
>
>
> The "bad" buttons seem to transmit a constant in byte 6 instead of a
> bitmask in bytes 2-5:
>
> REWIND, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2261 [hci0] 4696.955007
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 17 8d f2 a0 fe ...........
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2262 [hci0] 4697.163765
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}
>
> PLAY, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2264 [hci0] 4710.348944
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 16 1b c2 a7 89 ...........
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2265 [hci0] 4710.531446
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}
>
> PAUSE, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2266 [hci0] 4717.501552
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 1a 30 8e 11 80 .......0...
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2267 [hci0] 4717.685317
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}
>
> ENTER, press/release:
>
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2293 [hci0] 4844.683443
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 0d f7 0b c2 03 ...........
>> ACL Data RX: Handle 11 flags 0x02 dlen 15 #2294 [hci0] 4844.867210
> Channel: 65 len 11 [PSM 19 mode 0] {chan 1}
> a1 01 08 00 00 0a 00 4a 77 73 7d .......Jws}
>
> I tried to decode these reports according to the USB HID spec but they
> didn't make much sense to me beyond the "collection (application)"
> part. Can anyone help understand what this remote is doing?
>
>
> [0] https://www.amazon.com/dp/B072C7YZFC
> [1] https://python-evdev.readthedocs.io/en/latest/
> [2] https://www.oemblue.com/download/BTM0612C2P%20Hardware%20Datasheet.pdf
>
>


2021-12-20 19:02:24

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: Trouble parsing HID reports from PDP PS4 remote

On Mon, Dec 20, 2021 at 7:04 PM Jeremy Slemp <[email protected]> wrote:
>
> On Mon, Dec 20, 2021 at 6:44 AM Benjamin Tissoires
> <[email protected]> wrote:
> > Basically, we might need to add support for this remote in the hid-sony
> > driver.
> >
> > Can you attach the full output of hid-recorder (from the hid-tools[3]
> > repository) when you press all of these buttons?
> >
> > This should give us enough information to reply the event sequence
> > locally and fix the drivers if we need.
>
> Sure thing!
>
> The remote looks like this:
> https://www.pdp.com/universal-media-remote-for-playstationr4
>
> hid-recorder output:

Thanks for the logs (though your email client mangled the long lines,
but not an issue TBH).

So this device is not known to the HID stack nor hid-sony or hid-playstation.
We will need to add a special case in one of those 2 drivers because
as you realized, the way these keys are used is not standard.

But I'd like to compare these logs to the PS5 remote that I have here.
Maybe the proprietary fields 0xff000021 is something common in the
PS4/PS5 world.

Also, what happens if you press 2 "special" keys at the same time
(pause and enter for example)?

However, I can not promise I'll work on that tomorrow. And then I'll
take a year end break.

If you don't see anything coming from me tomorrow or in early January,
feel free to re-raise this thread.

Cheers,
Benjamin

>
> # PDP Media Remote
> # 0x05, 0x01, // Usage Page (Generic Desktop) 0
> # 0x09, 0x05, // Usage (Game Pad) 2
> # 0xa1, 0x01, // Collection (Application) 4
> # 0x85, 0x01, // Report ID (1) 6
> # 0x09, 0x39, // Usage (Hat switch) 8
> # 0x15, 0x00, // Logical Minimum (0) 10
> # 0x25, 0x07, // Logical Maximum (7) 12
> # 0x35, 0x00, // Physical Minimum (0) 14
> # 0x46, 0x3b, 0x01, // Physical Maximum (315) 16
> # 0x65, 0x14, // Unit (EnglishRotation: deg) 19
> # 0x75, 0x04, // Report Size (4) 21
> # 0x95, 0x01, // Report Count (1) 23
> # 0x81, 0x42, // Input (Data,Var,Abs,Null) 25
> # 0x65, 0x00, // Unit (None) 27
> # 0x05, 0x09, // Usage Page (Button) 29
> # 0x19, 0x01, // Usage Minimum (1) 31
> # 0x29, 0x0e, // Usage Maximum (14) 33
> # 0x15, 0x00, // Logical Minimum (0) 35
> # 0x25, 0x01, // Logical Maximum (1) 37
> # 0x75, 0x01, // Report Size (1) 39
> # 0x95, 0x0e, // Report Count (14) 41
> # 0x81, 0x02, // Input (Data,Var,Abs) 43
> # 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 45
> # 0x09, 0x20, // Usage (Vendor Usage 0x20) 48
> # 0x75, 0x06, // Report Size (6) 50
> # 0x95, 0x01, // Report Count (1) 52
> # 0x81, 0x02, // Input (Data,Var,Abs) 54
> # 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 56
> # 0x09, 0x21, // Usage (Vendor Usage 0x21) 59
> # 0x75, 0x08, // Report Size (8) 61
> # 0x95, 0x06, // Report Count (6) 63
> # 0x81, 0x02, // Input (Data,Var,Abs) 65
> # 0x85, 0x03, // Report ID (3) 67
> # 0x0a, 0x83, 0xa7, // Usage (Vendor Usage 0xa783) 69
> # 0x95, 0x09, // Report Count (9) 72
> # 0xb1, 0x02, // Feature (Data,Var,Abs) 74
> # 0xc0, // End Collection 76
> # 0x06, 0xf0, 0xff, // Usage Page (Vendor Usage Page 0xfff0) 77
> # 0x09, 0x40, // Usage (Vendor Usage 0x40) 80
> # 0xa1, 0x01, // Collection (Application) 82
> # 0x85, 0xf0, // Report ID (240) 84
> # 0x09, 0x47, // Usage (Vendor Usage 0x47) 86
> # 0x95, 0x3f, // Report Count (63) 88
> # 0xb1, 0x02, // Feature (Data,Var,Abs) 90
> # 0x85, 0xf1, // Report ID (241) 92
> # 0x09, 0x48, // Usage (Vendor Usage 0x48) 94
> # 0x95, 0x3f, // Report Count (63) 96
> # 0xb1, 0x02, // Feature (Data,Var,Abs) 98
> # 0x85, 0xf2, // Report ID (242) 100
> # 0x09, 0x49, // Usage (Vendor Usage 0x49) 102
> # 0x95, 0x0f, // Report Count (15) 104
> # 0xb1, 0x02, // Feature (Data,Var,Abs) 106
> # 0x85, 0xf3, // Report ID (243) 108
> # 0x0a, 0x01, 0x47, // Usage (Vendor Usage 0x4701) 110
> # 0x95, 0x07, // Report Count (7) 113
> # 0xb1, 0x02, // Feature (Data,Var,Abs) 115
> # 0xc0, // End Collection 117
> #
> R: 118 05 01 09 05 a1 01 85 01 09 39 15 00 25 07 35 00 46 3b 01 65 14
> 75 04 95 01 81 42 65 00 05 09 19 01 29 0e 15 00 25 01 75 01 95 0e 81
> 02 06 00 ff 09 20 75 06 95 01 81 02 06 00 ff 09 21 75 08 95 06 81 02
> 85 03 0a 83 a7 95 09 b1 02 c0 06 f0 ff 09 40 a1 01 85 f0 09 47 95 3f
> b1 02 85 f1 09 48 95 3f b1 02 85 f2 09 49 95 0f b1 02 85 f3 0a 01 47
> 95 07 b1 02 c0
> N: PDP Media Remote
> I: 5 0e6f 026f
>
> # SHARE button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 1 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 87 , 66
> , 92 , 31
> E: 000000.000000 10 01 08 10 00 08 00 57 42 5c 1f
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000000.109914 10 01 08 00 00 08 00 c8 15 45 4f
>
> # PS button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 1 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 255 , 127
> , 135 , 78
> E: 000002.969989 10 01 08 00 01 08 00 ff 7f 87 4e
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000003.104971 10 01 08 00 00 08 00 c8 15 45 4f
>
> # OPTIONS button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 1
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 246 , 186
> , 119 , 239
> E: 000007.166328 10 01 08 20 00 08 00 f6 ba 77 ef
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000007.249842 10 01 08 00 00 08 00 c8 15 45 4f
>
> # GREEN TRIANGLE button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 1 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 90 , 165
> , 163 , 254
> E: 000018.495012 10 01 88 00 00 08 00 5a a5 a3 fe
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000018.604996 10 01 08 00 00 08 00 c8 15 45 4f
>
> # PINK SQUARE button
> # ReportID: 1 / Hat switch: 8 | Button: 1 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 74 , 130
> , 165 , 47
> E: 000024.672577 10 01 18 00 00 08 00 4a 82 a5 2f
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000024.806348 10 01 08 00 00 08 00 c8 15 45 4f
>
> # ORANGE CIRCLE button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 1 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 129 , 77
> , 182 , 23
> E: 000030.346442 10 01 48 00 00 08 00 81 4d b6 17
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000030.480160 10 01 08 00 00 08 00 c8 15 45 4f
>
> # BLUE X button
> # ReportID: 1 / Hat switch: 8 | Button: 0 1 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 204 , 58
> , 132 , 142
> E: 000040.002823 10 01 28 00 00 08 00 cc 3a 84 8e
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000040.090307 10 01 08 00 00 08 00 c8 15 45 4f
>
> # L1 button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 1 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 173 , 114
> , 249 , 247
> E: 000045.415425 10 01 08 01 00 08 00 ad 72 f9 f7
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000045.525646 10 01 08 00 00 08 00 c8 15 45 4f
>
> # R1 button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 1 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 67 , 221
> , 76 , 229
> E: 000050.470479 10 01 08 02 00 08 00 43 dd 4c e5
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000050.605489 10 01 08 00 00 08 00 c8 15 45 4f
>
> # L2 button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 1 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 159 , 130
> , 39 , 192
> E: 000057.000593 10 01 08 04 00 08 00 9f 82 27 c0
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000057.083079 10 01 08 00 00 08 00 c8 15 45 4f
>
> # R2 button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 1 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 39 , 61
> , 241 , 138
> E: 000061.636954 10 01 08 08 00 08 00 27 3d f1 8a
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000061.770649 10 01 08 00 00 08 00 c8 15 45 4f
>
> # UP ARROW button
> # ReportID: 1 / Hat switch: 0 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 9 , 94
> , 53 , 127
> E: 000068.154519 10 01 00 00 00 08 00 09 5e 35 7f
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000068.363248 10 01 08 00 00 08 00 c8 15 45 4f
>
> # LEFT ARROW button
> # ReportID: 1 / Hat switch: 6 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 169 , 171
> , 117 , 240
> E: 000074.187110 10 01 06 00 00 08 00 a9 ab 75 f0
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000074.348488 10 01 08 00 00 08 00 c8 15 45 4f
>
> # RIGHT ARROW button
> # ReportID: 1 / Hat switch: 2 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 105 , 13
> , 245 , 5
> E: 000080.271228 10 01 02 00 00 08 00 69 0d f5 05
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000080.406201 10 01 08 00 00 08 00 c8 15 45 4f
>
> # DOWN ARROW button
> # ReportID: 1 / Hat switch: 4 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 201 , 248
> , 181 , 138
> E: 000085.132491 10 01 04 00 00 08 00 c9 f8 b5 8a
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000085.291313 10 01 08 00 00 08 00 c8 15 45 4f
>
> # ENTER button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 13 , 117 , 105
> , 244 , 49
> E: 000089.456381 10 01 08 00 00 08 0d 75 69 f4 31
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000089.591371 10 01 08 00 00 08 00 c8 15 45 4f
>
> # REWIND button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 23 , 15 , 144
> , 150 , 204
> E: 000095.587712 10 01 08 00 00 08 17 0f 90 96 cc
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000095.746944 10 01 08 00 00 08 00 c8 15 45 4f
>
> # PLAY button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 22 , 153 , 160
> , 145 , 187
> E: 000100.317804 10 01 08 00 00 08 16 99 a0 91 bb
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000100.451550 10 01 08 00 00 08 00 c8 15 45 4f
>
> # FASTFORWARD button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 24 , 158 , 141
> , 41 , 92
> E: 000107.749017 10 01 08 00 00 08 18 9e 8d 29 5c
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000107.882698 10 01 08 00 00 08 00 c8 15 45 4f
>
> # PREVIOUS TRACK button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 20 , 181 , 193
> , 159 , 85
> E: 000114.526718 10 01 08 00 00 08 14 b5 c1 9f 55
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000114.686734 10 01 08 00 00 08 00 c8 15 45 4f
>
> # PAUSE button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 26 , 178 , 236
> , 39 , 178
> E: 000117.824287 10 01 08 00 00 08 1a b2 ec 27 b2
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000117.983005 10 01 08 00 00 08 00 c8 15 45 4f
>
> # NEXT TRACK button
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 21 , 35 , 241
> , 152 , 34
> E: 000122.074342 10 01 08 00 00 08 15 23 f1 98 22
> # ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 | 0xff000020: 0 | 0xff000021: 8 , 0 , 200 , 21
> , 69 , 79
> E: 000122.233063 10 01 08 00 00 08 00 c8 15 45 4f
>


2021-12-20 19:22:46

by Jeremy Slemp

[permalink] [raw]
Subject: Re: Trouble parsing HID reports from PDP PS4 remote

On Mon, Dec 20, 2021 at 11:02 AM Benjamin Tissoires
<[email protected]> wrote:
> > The remote looks like this:
> > https://www.pdp.com/universal-media-remote-for-playstationr4
> >
> > hid-recorder output:
>
> Thanks for the logs (though your email client mangled the long lines,
> but not an issue TBH).

Also I forgot to reply-to-list. For anyone who missed it, the
hid-recorder output is here: https://pastebin.com/8nKdtMT8

> So this device is not known to the HID stack nor hid-sony or hid-playstation.
> We will need to add a special case in one of those 2 drivers because
> as you realized, the way these keys are used is not standard.
>
> But I'd like to compare these logs to the PS5 remote that I have here.
> Maybe the proprietary fields 0xff000021 is something common in the
> PS4/PS5 world.
>
> Also, what happens if you press 2 "special" keys at the same time
> (pause and enter for example)?

For this trace I held down pause, pressed enter, then released both at
the same time:

# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 6 , 26 , 60 , 193
, 164 , 44
E: 000014.302803 10 01 08 00 00 06 1a 3c c1 a4 2c
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 6 , 13 , 251 , 68
, 119 , 175
E: 000015.312809 10 01 08 00 00 06 0d fb 44 77 af
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 6 , 13 , 251 , 68
, 119 , 175
E: 000016.475376 10 01 08 00 00 06 0d fb 44 77 af
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 6 , 0 , 70 , 56
, 198 , 209
E: 000016.510310 10 01 08 00 00 06 00 46 38 c6 d1

For this trace I held down pause, held down enter, released enter,
released pause:

# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 26 , 125 , 240
, 191 , 53
E: 000455.969112 10 01 08 00 00 07 1a 7d f0 bf 35
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 13 , 186 , 117
, 108 , 182
E: 000456.328187 10 01 08 00 00 07 0d ba 75 6c b6
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 26 , 125 , 240
, 191 , 53
E: 000457.236997 10 01 08 00 00 07 1a 7d f0 bf 35
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 7 , 9
, 221 , 200
E: 000457.629132 10 01 08 00 00 07 00 07 09 dd c8

For this trace I held down pause, held down enter, released pause,
released enter:

# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 26 , 125 , 240
, 191 , 53
E: 000440.319208 10 01 08 00 00 07 1a 7d f0 bf 35
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 13 , 186 , 117
, 108 , 182
E: 000440.879087 10 01 08 00 00 07 0d ba 75 6c b6
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 13 , 186 , 117
, 108 , 182
E: 000441.541612 10 01 08 00 00 07 0d ba 75 6c b6
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 7 , 9
, 221 , 200
E: 000442.027658 10 01 08 00 00 07 00 07 09 dd c8

For this trace I held down left arrow, pressed and released up arrow,
pressed and released down arrow, released left arrow:

# ReportID: 1 / Hat switch: 6 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 102 , 183
, 237 , 119
E: 000584.269500 10 01 06 00 00 07 00 66 b7 ed 77
# ReportID: 1 / Hat switch: 7 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 214 , 158
, 141 , 74
E: 000585.108210 10 01 07 00 00 07 00 d6 9e 8d 4a
# ReportID: 1 / Hat switch: 6 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 102 , 183
, 237 , 119
E: 000588.489824 10 01 06 00 00 07 00 66 b7 ed 77
# ReportID: 1 / Hat switch: 5 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 182 , 205
, 77 , 48
E: 000590.293643 10 01 05 00 00 07 00 b6 cd 4d 30
# ReportID: 1 / Hat switch: 6 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 102 , 183
, 237 , 119
E: 000590.931154 10 01 06 00 00 07 00 66 b7 ed 77
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 7 , 9
, 221 , 200
E: 000591.540598 10 01 08 00 00 07 00 07 09 dd c8

For this trace I held down left arrow and right arrow at the same
time, then released both. I think this combination is unsupported:

# ReportID: 1 / Hat switch: 6 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 102 , 183
, 237 , 119
E: 000900.413945 10 01 06 00 00 07 00 66 b7 ed 77
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 7 , 9
, 221 , 200
E: 000900.897679 10 01 08 00 00 07 00 07 09 dd c8
# ReportID: 1 / Hat switch: 6 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 102 , 183
, 237 , 119
E: 000902.959066 10 01 06 00 00 07 00 66 b7 ed 77
# ReportID: 1 / Hat switch: 8 | Button: 0 0 0 0 0 0 0 0 0 0
0 0 0 0 | 0xff000020: 0 | 0xff000021: 7 , 0 , 7 , 9
, 221 , 200
E: 000903.017773 10 01 08 00 00 07 00 07 09 dd c8

So for the arrow keys ("hat switch") I get:

No buttons: 8
Up only: 0
Left only: 6
Right only: 2
Down only: 4
Left+up: 7
Right+up: 1
Right+down: 3
Left+down: 5