USB HID driver

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

USB HID driver

Postby e_l_tang » Fri Apr 28, 2017 5:37 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: USB HID driver

Postby Giovanni » Fri Apr 28, 2017 7:44 pm

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

e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: USB HID driver

Postby e_l_tang » Fri Apr 28, 2017 9:48 pm

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?

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: USB HID driver

Postby Giovanni » Sat Apr 29, 2017 2:07 pm

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

e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: USB HID driver

Postby e_l_tang » Sat Apr 29, 2017 5:17 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: USB HID driver

Postby Giovanni » Sat Apr 29, 2017 5:38 pm

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

e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: USB HID driver

Postby e_l_tang » Sun Apr 30, 2017 5:16 am

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.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: USB HID driver

Postby Giovanni » Sun Apr 30, 2017 6:24 am

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

e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: USB HID driver

Postby e_l_tang » Sun Apr 30, 2017 6:54 am

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.


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 5 guests