Skip to content
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

ESP32 S2/S3 Host USB HID, feature report read/write (IDFGH-7795) #9330

Closed
AristarchosOfSamos opened this issue Jul 11, 2022 · 24 comments
Closed
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF

Comments

@AristarchosOfSamos
Copy link

Hi,

Seen the nice work that is currently underway for USB host drivers as CDC or MSC in new S3/S2 ESP32 variants.
A very nice though addition, that could open up more potential is the presence of a host USB HID example.

Well, for my purpose it could suffice an example that simply opens and interacts via 'feature reports' read and written to a simple (classless) HID device.
That could be a first easy approach to the host USB HID world for ESP32 S2/S3, whereas after that we could proceed to class devices eg keyboard or rmouse if they are a bit more complicated.
So, it could be a good idea if such a simple HID feature report driver could be implemented as it would give a better completeness in the host USB range of device drivers for ESP32 S2/S3 whereas the HID is now missing.

Is there any hint if this has been done already ?

Thanks in advance,

@AristarchosOfSamos AristarchosOfSamos added the Type: Feature Request Feature request for IDF label Jul 11, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jul 11, 2022
@github-actions github-actions bot changed the title ESP32 S2/S3 Host USB HID, feature report read/write ESP32 S2/S3 Host USB HID, feature report read/write (IDFGH-7795) Jul 11, 2022
@FanhuaCloud
Copy link
Contributor

#9191
Looks like someone has already committed code for this, but it hasn't been merged

@tore-espressif
Copy link
Collaborator

@AristarchosOfSamos Thank you for the feature request. We'll try to prioritize HID class in future development, unfortunately we don't have official support for HID yet. (I've seen some community solution, if that interests you)

@FanhuaCloud The PR you linked is for USB HID device

@AristarchosOfSamos
Copy link
Author

@tore-espressif thanks for replying to the post.

There are many little USB devices out there with sensors that are accessed via HID with simple 'feature reports' and not need class drivers.
That is why I asked if such a simple example can be easily given. No need for HID host class driver eg keyboard or mouse..
I think that could be a easy example to have in the USB host ESP32 S2/S3 examples.
I'll wait until something comes out officially.

@AristarchosOfSamos
Copy link
Author

AristarchosOfSamos commented Jul 30, 2022

Seen that in a latest commit, at least a HID device example is given
https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/device/tusb_hid

I hope that now consideration can be turned to where a similar example will be given from the side of a HID host.
A simple USB HID host example where plain 'feature reports' will be read and written. And of course this way both sides host & device could be implemented with ESP32-S2/S3 so having completeness.

@mrweaver
Copy link

I'm also very keen to see a USB HID host example. Is there any update on the progress for this?

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels Oct 18, 2022
@tore-espressif
Copy link
Collaborator

That is why I asked if such a simple example can be easily given. No need for HID host class driver eg keyboard or mouse..

Actually, implementing a mere example for keyboard/mouse is easier, because we don't have to implement all the features and flexibility that HID class defines.

I'd suggest that we provide a simple example for keyboard and mouse combo, and later we can provide a fully-featured HID driver. Does it make sense to you?

@mrweaver do you have a specific device in mind?

@mrweaver
Copy link

This would be amazing!

A keyboard /mouse combo is perfect I think. I'm looking at a Chinese wireless remote (G20s Airmouse), which is essentially a combination keyboard and mouse as I understand it.

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Selected for Development Issue is selected for development labels Nov 2, 2022
@relaxibus
Copy link

Host USB HID to read joysticks & Co would be amazing. Will the S2/S3 also support USB Hubs when in Host mode?

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: In Progress Work is in progress labels Nov 14, 2022
@mrweaver
Copy link

mrweaver commented Dec 8, 2022

I was just wondering if there are any updates on the development of this HID host implementation?

@Dazza0
Copy link
Collaborator

Dazza0 commented Dec 8, 2022

@mrweaver The first version of the HID Host Class driver is already in review internally, so we should have something on master for you to test soon. However, the first version will only support HID Boot protocol (basically standard Keyboards an Mice) but we have plans to expand it to full HID support (see below).

@relaxibus @AristarchosOfSamos Joy sticks (and other non-boot protocol HID devices) will take longer to support due to the need to parse HID report descriptors. Currently, there is already some logic in the esp_hid component for HID report descriptors. But our long term plan is to tidy up esp_hid and integrate USB Host HID with esp_hid somehow so that HID applications it can share the same HID descriptor logic with BT/BTLE HID devices as well. This will allow users to...

  • use a common esp_hid (or similar) API for all HID devices, regardless of what protocol the device is running on (i.e., USB/BT/BTLE).
  • used the provided HID report descriptor APIs to easily add their own drivers for less common/custom HID devices

As for USB Hubs in Host mode, that is also in our roadmap. But, unfortunately I can't offer a release date for that yet.

@mrweaver
Copy link

mrweaver commented Dec 9, 2022

@Dazza0, that's great news! Thanks for getting back to me so quickly - looking forward to testing it out :D

@relaxibus
Copy link

@Dazza0 thats great news! Thanks for keeping up this USB Host HID topic. Let us know when there are new updated on this topic. :-)

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Dec 12, 2022
@shlomo-edu
Copy link

Hi to AristarchosOfSamos and tore-espressif
I have an HID Serial device that I want to connect to a PC via the ESP32-S3 BLE.
I could not find any sample that will enable me to connect the ESP32 (as a host) to the HID device.
Did you solve this problem?
If yes, van you send me a sample code that does it?

@roma-jam
Copy link
Collaborator

@relaxibus
Copy link

As a side question: is HOST USB HID now working for gamepads, joysticks etc?

@roma-jam
Copy link
Collaborator

@relaxibus

As a side question: is HOST USB HID now working for gamepads, joysticks etc?

As it was said before by @Dazza0:

  • First version (which is in master already) supports only HID protocols Keyboard and Mouse.
  • Second version (that will be released as an idf-external-component from day to day) supports all HID compatible devices and provide an interface to get an input report raw data. Based on that, any additional support can be done on application level.

Integration with esp_hid is still under a discussion.

@relaxibus
Copy link

Thanks, keep us updated regarding "Integration with esp_hid is still under a discussion."

@shlomo-edu
Copy link

Our software developer (Viki) compiled roma-jam's code, but the problem that it works only for Keyboard and Mouse.
We need the same HID driver that can work with raw data.
Please note, our device uses HID for communication with a PC app using our proprietary protocol.
How can we convert this example to work with raw data.
https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/hid

@shlomo-edu
Copy link

shlomo-edu commented Jun 18, 2023 via email

@roma-jam
Copy link
Collaborator

Hi @shlomo-edu,
In the current version there is a verification of the USB device descriptor field such as bInterfaceSubClass. Device is available only if there is a HID_SUBCLASS_BOOT_INTERFACE.

For disabling, it is possible to remove HID_SUBCLASS_BOOT_INTERFACE comparison statement in the file hid_host.c, line 282

FYI, there is a pull request to the idf-extra-components with the version of HID driver which provides a better interface of the HID host. Also, there is a fully support HID host requests, that you can easily use them for the proprietary protocol implementation over the HID.
PR can be found here: [USB Host] HID driver component

@shlomo-edu
Copy link

shlomo-edu commented Jun 19, 2023 via email

@roma-jam
Copy link
Collaborator

Hi @shlomo-edu,

May I ask you to open a new ticket with the issue description and debug output log attached?

If you want to change the example to be able to get raw data from the HID device, It is better to move that discussion to a new thread.

Thanks.

@shlomo-edu
Copy link

shlomo-edu commented Jun 19, 2023 via email

@shlomo-edu
Copy link

shlomo-edu commented Jun 19, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

9 participants