Page 1 of 1
USB HID driver
Posted: Fri Apr 28, 2017 5:37 pm
by e_l_tang
Does the HAL include a USB HID driver, and if so would it be possible to use it simultaneously with the Serial over USB driver?
Here is my other post with more context.
Re: USB HID driver
Posted: Fri Apr 28, 2017 7:44 pm
by Giovanni
Hi,
Search the forum, several HID examples have been posted. Probably HID is too "generic" for a specific driver like we have for CDC.
Giovanni
Re: USB HID driver
Posted: Fri Apr 28, 2017 9:48 pm
by e_l_tang
I found a few examples of projects which implement a HID device, but none which implement both a HID device and a CDC device. Do you know of one?
Re: USB HID driver
Posted: Sat Apr 29, 2017 2:07 pm
by Giovanni
Hi,
You need to implement a "IAD" device, there are IAD examples with 2 CDC but none with HID. The effort is into creating the descriptors, you may try to use the descriptors of some existing device then modify them.
Giovanni
Re: USB HID driver
Posted: Sat Apr 29, 2017 5:17 pm
by e_l_tang
So I can't use the existing Serial over USB driver? Actually I already have working descriptors in my project, and it's integrating them with ChibiOS that I can't figure out how to do. I'm not sure how to make both HID and CDC work at the same time without them interfering with each other.
Re: USB HID driver
Posted: Sat Apr 29, 2017 5:38 pm
by Giovanni
Hi,
You can use the driver, it is just matter of descriptors. Make HID and CDC use different endpoints and map the CDC endpoints in the serial driver.
It is better if you start from the CDC-IAD demo.
Giovanni
Re: USB HID driver
Posted: Sun Apr 30, 2017 5:16 am
by e_l_tang
I've found a few projects which implement a HID device using ChibiOS, but they vary wildly in how they do it and I've managed to confuse myself more by looking at them. Are you sure that there can't be a dedicated HID driver in ChibiOS? The library I'm currently using has both a HID driver and a CDC driver, and I can post some code from my project to show how they are used.
Re: USB HID driver
Posted: Sun Apr 30, 2017 6:24 am
by Giovanni
You wrote it yourselves, HID "varies wildly" so you would make a series of HID drivers for various scenarios rather than a single driver.
An HID application just requires descriptors and the normal USB API.
Giovanni
Re: USB HID driver
Posted: Sun Apr 30, 2017 6:54 am
by e_l_tang
As far as I know, the library I'm using only has one HID driver. So far I have not noticed any limitations to this approach. I may be wrong, of course, so I have posted my code
here in case you want to check if my understanding is correct.