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?
Where is "Adafruit_USBD_HID::setReportCallback" used?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- xivzunedu
- Posts: 31
- Joined: Thu Aug 16, 2018 5:14 pm
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Where is "Adafruit_USBD_HID::setReportCallback" used?
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
https://github.com/adafruit/Adafruit_Ti ... .h#L32-L38
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
The types are defined in the header:I also can't find where its arguments' types, get_report_callback_t and set_report_callback_t are defined
https://github.com/adafruit/Adafruit_Ti ... .h#L32-L38
- xivzunedu
- Posts: 31
- Joined: Thu Aug 16, 2018 5:14 pm
Re: Where is "Adafruit_USBD_HID::setReportCallback" used?
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.
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.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Where is "Adafruit_USBD_HID::setReportCallback" used?
Let me pass this to the author of that code. They might be able to give you more information.
- hathach
- Posts: 1270
- Joined: Tue Apr 23, 2013 1:02 am
Re: Where is "Adafruit_USBD_HID::setReportCallback" used?
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.
Please be positive and constructive with your questions and comments.