Where is "Adafruit_USBD_HID::setReportCallback" used?

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
xivzunedu
 
Posts: 31
Joined: Thu Aug 16, 2018 5:14 pm

Where is "Adafruit_USBD_HID::setReportCallback" used?

Post by xivzunedu »

Can anyone point me to a usage of Adafruit_USBD_HID::setReportCallback?

I've spent the weekend trying to implement TinyUSB for a project. I would just used Adafruit's library but the chip I'm using isn't supported by the library.

The TinyUSB docs, unfortanately, aren't as thorough as Adafruit's and I can't find an example that implements tud_hid_get_report_cb fully. I believe the equivalent of these functions in Adafruit's library are Adafruit_USBD_HID::setReportCallback. I can't find an example where this method is called though. I also can't find where its arguments' types, get_report_callback_t and set_report_callback_t are defined. Any help?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Where is "Adafruit_USBD_HID::setReportCallback" used?

Post by adafruit_support_mike »

The callback is used directly in Adafruit_USBD_HID::tud_hid_set_report_cb():

https://github.com/adafruit/Adafruit_Ti ... D.cpp#L230

which is called by the USB HID API:

https://github.com/adafruit/Adafruit_Ti ... ice.c#L411
I also can't find where its arguments' types, get_report_callback_t and set_report_callback_t are defined
The types are defined in the header:

https://github.com/adafruit/Adafruit_Ti ... .h#L32-L38

User avatar
xivzunedu
 
Posts: 31
Joined: Thu Aug 16, 2018 5:14 pm

Re: Where is "Adafruit_USBD_HID::setReportCallback" used?

Post by xivzunedu »

Thanks for the reply.

From what I can tell Adafruit_USB_D_HID::setReportCallback sets what _hid_dev->_set_report_cb and _hid_dev->_set_report_cb point to. I was asking about the former not the later.

From the examples in the HID directory, one should call Adafruit_USBD_HID::setReportCallback after creating an instance of Adafruit_USBD_HID, but some of the examples don't use the method at all. And if they do, they pass NULL as the get_report_cb. Bummer, because I thought this callback was why my host wasn't recognizing my HID device. :/ Back to the drawing board I guess.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Where is "Adafruit_USBD_HID::setReportCallback" used?

Post by adafruit_support_mike »

Let me pass this to the author of that code. They might be able to give you more information.

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Where is "Adafruit_USBD_HID::setReportCallback" used?

Post by hathach »

hi, first of all, can you tell us which mcu and board you are using. Adafruit_USBD_HID::setReportCallback() is for hooking callback for set/get report request (via control transfer) e.g setting LED on caplock keyboard. It is optional and that is why it is not used in most examples. It probably has nothing to do with the HID device not recognized in your code. I think you should dig deeper into the host error with kernel log i.e dmesg or an usb analyzer to know what is missing.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”