Bluetooth HID Host Getting Duplicate Events and Extra Event

Derf Jagged
Posts: 16
Joined: Wed Jul 08, 2020 8:33 pm

Bluetooth HID Host Getting Duplicate Events and Extra Event

Postby Derf Jagged » Sun Jan 03, 2021 11:42 pm

Hello! I have connected my Xbox One S controller to the ESP32 via Bluetooth and can see and parse button press and release events. However, it looks like every time I press a button on the controller, it fires three events instead of just one, and occasionally one of the three events is completely different data. Any idea why it's firing three events and what the other data is? Is there any easy way to ignore the last two events?

The picture below shows me pressing a button five times, which changes one value from 00 to 05. In between the second button release and the third button press, it has a bad data event.

Image

And here's a picture with the ESP_HIDH_DEMO's default logging and a couple bad events. This shows it's from the same MAC and same event ID (1).

Image

Finally, here's my connected device info:

Image

Thanks for reading!

Derf Jagged
Posts: 16
Joined: Wed Jul 08, 2020 8:33 pm

Re: Bluetooth HID Host Getting Duplicate Events and Extra Event

Postby Derf Jagged » Fri Jan 08, 2021 2:49 am

Still haven't found a solution for this.

ESP_Jan
Posts: 42
Joined: Tue Dec 01, 2020 10:56 am

Re: Bluetooth HID Host Getting Duplicate Events and Extra Event

Postby ESP_Jan » Thu Jan 14, 2021 5:09 pm

Hi Derf Jagged,
the extra packets may be controller status information (like the state of charge, firmware version, signal strength, etc.)

I wasn't able to find much information on the Bluetooth protocol, but this page has information about the proprietary wireless communication protocol https://gist.github.com/devkid/4b3bd507 ... 4cfd3ed895

There's also an open-source Linux driver for the Bluetooth controller: https://github.com/atar-axis/xpadneo

Jan

Derf Jagged
Posts: 16
Joined: Wed Jul 08, 2020 8:33 pm

Re: Bluetooth HID Host Getting Duplicate Events and Extra Event

Postby Derf Jagged » Thu Jan 14, 2021 8:13 pm

Thanks for the reply.

Looking through the pages you linked (and some pages linked there), the regular wireless protocol is a bit different from the Bluetooth one; the Bluetooth one doesn't have a counter for instance and the duplicate events may be Bluetooth only.

The esp_hid_host sample filters out anything that is not an ESP_HIDH_INPUT_EVENT (value 02), I believe this is the same value in the page you linked (https://gist.github.com/devkid/4b3bd507 ... 4cfd3ed895) that they use for filtering everything but packets with the command / status flag set to (20 00) which seems to be button inputs. It appears that the "junk" data values I'm getting are also mmarked as ESP_HIDH_INPUT_EVENT's with value (20 00) for some reason, as the controller firmware status information are filtered out properly.

I did just notice that there actually is a consistent difference between regular events and the junk events, and that's a "fd 3f" value in the middle. Here's a handful of junk events, it looks like sometimes they repeat and sometimes not:

Code: Select all

37 97 f7 fd 3f 94 f7 fd 3f 00 00 00 00 00 00
3f 3c ca fd 3f c4 a9 fd 3f 00 11 19 00 01 00
00 00 00 ff 4e d1 a9 fd 3f 88 ab fd 3f 0c 3b
00 00 00 d9 4e e0 aa fd 3f 00 11 19 00 01 00
2b 81 c9 fd 3f d4 c9 fd 3f 49 47 48 54 20 00
2b 81 c9 fd 3f d4 c9 fd 3f 49 47 48 54 20 00
29 95 89 fd 3f b4 8b fd 3f 49 47 48 54 20 00
29 95 89 fd 3f b4 8b fd 3f 49 47 48 54 20 00
29 95 89 fd 3f b4 8b fd 3f 49 47 48 54 20 00
29 95 89 fd 3f b4 8b fd 3f 49 47 48 54 20 00
00 00 00 00 00 3c ab fd 3f 01 00 00 00 41 00
3f 74 cb fd 3f 1c aa fd 3f fc ab fd 3f 38 3f
I can at least filter on that value, but it is possible that someone holds down the analog stick and trigger to the exact positions that it would drop inputs... so figuring out the root cause would be better.

Who is online

Users browsing this forum: No registered users and 106 guests