hathach / tinyusb

An open source cross-platform USB stack for embedded system

Home Page:https://www.tinyusb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add hook to allow for external host class drivers

harbaum opened this issue · comments

Related area

Allow developers to provide custom class drivers

Hardware specification

all

Is your feature request related to a problem?

I'd like to add xbox controller support to the tuh. The xbox controllers are vendor specific and the vendor class driver seems broken: #2684

Describe the solution you'd like

Allowing to add custom class drivers to usbh_class_drivers[] in usbh.c would allow custom class drivers without the need to change/add anything to tinyusb. A simple solution may to allow the user to statically add an entry to this list via some #define in tusb_config.h

There's some discussion about this at #1929. But that approach would IMHO only work if the device would report as a hid class device which the xbox controllers don't.

There seem to be variants of tinyusb that implement something like this as this code snipped suggests:
https://github.com/RT-Thread-Studio/sdk-bsp-ra8d1-vision-board/blob/master/projects/usb/vision_board_tinyusb_xpad/board/tinyusb/host_register.c

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.

You've been able to hook in your own USB host drivers since #2222

I made this a while ago but I try keep it up to date you https://github.com/Ryzee119/tusb_xinput

Excellent. Your driver works as advertised ... thanks a lot ...