diff options
| author | hathach <[email protected]> | 2020-09-10 23:32:08 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-09-10 23:32:08 +0700 |
| commit | 801f8b5b38b90cb3e15d0a1bb2accae58cde6130 (patch) | |
| tree | 6df3589930a5a185a3b28c2162508a6dd03122a6 /src/class/hid | |
| parent | ed6d48b81e8a5d1ed8b518921b30b87c7daecee5 (diff) | |
update claim edpt for hid and midi
Diffstat (limited to 'src/class/hid')
| -rw-r--r-- | src/class/hid/hid_device.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index c46fc591a..10267d734 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -72,18 +72,21 @@ static inline hidd_interface_t* get_interface_by_itfnum(uint8_t itf_num) //--------------------------------------------------------------------+ bool tud_hid_ready(void) { - uint8_t itf = 0; + uint8_t const itf = 0; uint8_t const ep_in = _hidd_itf[itf].ep_in; - return tud_ready() && (ep_in != 0) && usbd_edpt_ready(TUD_OPT_RHPORT, ep_in); + return tud_ready() && (ep_in != 0) && !usbd_edpt_busy(TUD_OPT_RHPORT, ep_in); } bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len) { - TU_VERIFY( tud_hid_ready() ); - - uint8_t itf = 0; + uint8_t const rhport = 0; + uint8_t const itf = 0; hidd_interface_t * p_hid = &_hidd_itf[itf]; + // claim endpoint + TU_VERIFY( usbd_edpt_claim(rhport, p_hid->ep_in) ); + + // prepare data if (report_id) { len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE-1); |
