2020-04-13 06:58 AM
Hi all,
I am trying to implement FIDO U2F host. I have configured USB_FS as a host and added USB_HOST middleware with human interface host class. But I have noticed that USBH_HID_InterfaceInit function expects keyboard and mouse boot classes only, and returns fail on any other device type. Is there any way to add custom HID class to the host without patching generated files? The problem is that usbh_hid.c has not even /*USER CODE*/ sections, so patching it will give a headache upon code regeneration.
Regards,
Dmitry
2020-04-13 07:54 AM
> Is there any way to add custom HID class to the host without patching generated files?
You can replace generated files and write your own "class" module.
Also, instead of directly using the regenerated code, you can merge the differences into your actual project.
This is the price of the "freeware" ;)
-- pa
2020-04-13 11:07 PM
Sure I understand that. Just a little bit surprised that such complicated thing as mass storage requires just a few lines of code, but there is no full support for HID. I am relatively new to STM, thought that maybe I have lost something.
2020-04-22 09:15 AM
Hi @Community member ,
I suggest you to refer to the step by step training material for USB that you can find in https://www.youtube.com/watch?v=rI3yBmnfAZU&list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa.
USB HID host training is the following: https://www.youtube.com/watch?v=MlhUG4GsOT0&list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa&index=22.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2020-04-22 03:42 PM
MSC functionality is more or less fixed.
HID devices are various. if you want a ready, feature rich platform, use embedded Linux.
Have you looked for USB host examples on github?
-- pa
2020-04-22 10:58 PM
Thank you, but I do not need much. I need only USB-SDcard link, which already works with only several lines of code in addition to middleware, and FIDO U2F authentication, which needs HID and mbedTLS. I do not think that it is a good idea to embed Linux just for HID driver.
2020-04-22 11:06 PM
Thank you Amel. Sure I can myself write a code that will make everything run. I just wondering that it is a little bit out of the perfect structure of HAL generation with CubeMX, when normally Cube tells that the configuration is wrong. In this case Cube allows the configuration, but it does not work. I suppose, that USB DMA configuration is just not supported by middleware, or there is a bug.
The same is for HID. Normally all generated sources have USERCODE sections, where I can insert custom code that will not be replaced. HID implementation has no such sections, that just adds a little bit headache inserting custom calls there.