-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hid_host_example.c does not collect data from generic devices (ie. wired PS4 controller) (IDFGH-12808) #13784
Comments
Hi @BotSpace |
My controller is a PS4 SADES PS-403 (C200?). I don't have too much experience with HID but this is what I found by connecting the controller to my laptop and sniffing that connection with Wireshark. I based my results from this information. The results are mostly similar, except for the bcdHID 1.17 field and both bEndpointAddresses Device Descriptor
Configuration Descriptor
|
This is exactly what I am trying todo as well. Have you made any progress on this that you would share? |
Honestly I have been pretty frustrated trying to hook a wired gamepad up to an ESP32-S2. Espressif advertises the USB-OTG Host capabilities of the S2 which has been out for 5 years, but if you are trying to host for any device that is not a keyboard or mouse you seem pretty screwed to find a working example. I gave up on ESP-IDF and turned to Arduino, where there you are still hard pressed to find working examples. Part of the problem is that I feel like there are four or five different forks of TinyUSB, each with their own quirks and spotty examples. I tried one or two but had little success with those either. This is compounded by the fact that I believe tinyUSB is still broken on the esp32-S3 in some ways. I have had my only success with this project by badjeff (we love badjeff) which he says is based off of esp-idf, but it what way I do not understand. There is very little in common between his code and the modern esp-idf example. And even then Jeff's work only works with some of my PS controllers, but not all of them. I have tried to add more with little success. I suppose I shouldn't be too quick to hold it against espressif. As part of this project I have spent many hours trying to learn and understand USB and I have found it to be an order of magnitude more complex than the serial/i2s/spi/can protocols I am more familiar with. It seems like what makes controllers different is not just the format of the data they report, but even the sequence of messages needed to get them to spit out data. I now have more respect for modern operating systems that can handle so many gamepads from different manufactures. So yea in the end I gave up on ESP-IDF and TinyUSB after toying with both for many hours, and am basing my MVP off Jeff's work. Perhaps someone will come along and tell me about what I missed with ESP-IDF or TinyUSB. I would welcome that in that case, but for now I am somewhat miffed. |
Thank you for the feedback and your experience. I'm currently going through the same exercise as you did to understand and modify ESP-IDF example. I have been experimenting with ChatGPT to help me write some code for this but so far haven't been successful. If I do get this to work I will help you know. |
Answers checklist.
General issue report
My goal is to have my ESP32-S2 act as a USB host for my wired PS4 controller. I'm using windows 10, VS code, and ESP-IDF v5.2.1. I'm using UART for flashing and monitoring, leaving the USB peripheral free to act as USB Host. I have created a project that is an unmodified copy of hid_host_example.c.
After flashing and monitoring, I plug in a wired mouse to the USB peripheral, shake it a bit, and disconnect it:
The mouse connection works in that the mouse state is printed to the terminal in real time as expected. There seems to be some erroneous info messages but otherwise it works.
Then I connect the PS4 controller and do my hardest to provide input.
The S2 sees the HID device but despite my efforts, no data is read to the terminal. When I unplug the PS4 controller, that is reported.
The PS4 controller is known good, when I plug it into my PC it shows up in device manager and I can see inputs using the windows game controller utility.
I have spent the better part of the last 2 days reading the Device Class Definition for Human Interface Devices (HID) but am completely stumped. Any advice is appriciated!
The text was updated successfully, but these errors were encountered: