usb: hid: add a INT IN transfer complete callback.
int_in_ready is an optional callback that is called when the current interrupt IN transfer has completed. This can be used to wait for the endpoint to go idle or to trigger the next transfer. This is needed for protocols like FIDO U2F that use the interrupt endpoint for transfers. Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
parent
9708372080
commit
0d04aef6fe
2 changed files with 13 additions and 1 deletions
|
@ -49,6 +49,7 @@ struct usb_hid_descriptor {
|
|||
|
||||
typedef int (*hid_cb_t)(struct usb_setup_packet *setup, s32_t *len,
|
||||
u8_t **data);
|
||||
typedef void (*hid_int_ready_callback)(void);
|
||||
|
||||
struct hid_ops {
|
||||
hid_cb_t get_report;
|
||||
|
@ -57,6 +58,13 @@ struct hid_ops {
|
|||
hid_cb_t set_report;
|
||||
hid_cb_t set_idle;
|
||||
hid_cb_t set_protocol;
|
||||
/*
|
||||
* int_in_ready is an optional callback that is called when
|
||||
* the current interrupt IN transfer has completed. This can
|
||||
* be used to wait for the endpoint to go idle or to trigger
|
||||
* the next transfer.
|
||||
*/
|
||||
hid_int_ready_callback int_in_ready;
|
||||
};
|
||||
|
||||
/* HID Report Definitions */
|
||||
|
|
|
@ -130,7 +130,11 @@ static int hid_custom_handle_req(struct usb_setup_packet *setup,
|
|||
|
||||
static void hid_int_in(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
|
||||
{
|
||||
SYS_LOG_DBG("ep %x status %d", ep, ep_status);
|
||||
if (ep_status != USB_DC_EP_DATA_IN ||
|
||||
hid_device.ops->int_in_ready == NULL) {
|
||||
return;
|
||||
}
|
||||
hid_device.ops->int_in_ready();
|
||||
}
|
||||
|
||||
/* Describe Endpoints configuration */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue