idf-extra-components icon indicating copy to clipboard operation
idf-extra-components copied to clipboard

feature(usb_host_hid): USB Host HID (Human Interface Device) Driver v.2.0.0

Open roma-jam opened this issue 1 year ago • 2 comments

Checklist

  • [x] Component contains License
  • [x] Component contains README.md
  • [x] Component contains idf_component.yml file with url field defined
  • [x] Component was added to upload job
  • [x] Component was added to build job
  • [x] Optional: Component contains unit tests
  • [x] CI passing

Change description

  • Changed the logic of user notification procedure (merge two callbacks in one, extend with new events, add esp_event_loop to simplify application events handling procedure and exclude external task to handle HID Driver events).
  • Optimized memory and pipes (in USB Host library) usage. Allocation memory and pipe for the HID Interface are done only by application layer request. Otherwise, no resources is used.
  • Simplified the internal logic of opening and closing procedure for HID Device.
  • Added API to work with OUT EP in case it is present in HID Interface.
  • Changed the way of device list handling. Now the device list is available only when HID device is opened by a client. That means that is there is no one device has been opened the driver can be uninstall easily, even if the device is still connected to the port.

roma-jam avatar Jul 20 '23 11:07 roma-jam

Hey @Dazza0, Hey @tore-espressif,

I have prepared a document with architectural changes for the next version of USB Host HID Driver. I would like to ask you both to have a look at the document and share your opinion.

USB_HID_Host_Driver_migration_guide_v0.0.1_draft.pdf

Things, that I want to ask you:

  1. Check the architectural changes, make your point (agree/disagree/other). I do not want you to spend more than 10-15 minutes on that, so if you are not able to understand the main idea from the document quickly - please tell me about that. I will update the document and try to do it more concise. Every feedback I would appreciate.
  2. Verify the advantages/disadvantages paragraphs for both versions. I would like to know your opinion.

Do not refer to the code changes, only to the document. Code is not ready (only the part with esp_event_loop + device attaching and removing).

If there is anything you want to share/add/discuss - I would be happy to do it. Please tell me about that. Sorry for my concise tone (probably), I really don't want to spend your time a lot and I want the document to be short and clear.

Thanks.

roma-jam avatar Jul 20 '23 11:07 roma-jam

After removing the OPEN event and made hid_host_device_open() synchronous new version and new scheme are required. They can be found in the next draft description file:

USB_HID_Host_Driver_migration_guide_v0.0.2_draft.pdf

@tore-espressif I have changed the hid_host_open_device() logic and now you can verify the document again. If there is anything else you want to change or make better, feel free to share.

I also updated all the tests and update the concurrent test and now it launch on every interface connected to the ESP32-S2/3 Host.

I am going to investigate how esp_hid works with BLE an BT HID devices and based on that implement a Keyboard/Mouse Driver (which would provide the possibility to automatically, based on the report descriptor data, handle the reports and send an event of keys pressed). Also, I think about making it possible to tie the VID/PID of the device to the specific Keyboard/Mouse driver (or just to use a common one) to be able to implement different HID device driver, even proprietary one.

roma-jam avatar Oct 13 '23 10:10 roma-jam

Closed as not relevant any more. Should be moved to esp-usb.

roma-jam avatar Jul 30 '24 08:07 roma-jam