summaryrefslogtreecommitdiff
path: root/src/class/hid/hid_device.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-06-27 12:22:36 +0700
committerhathach <[email protected]>2022-06-27 12:22:36 +0700
commit556b5d5044bd02e89d6b6c6f21e95d46f5fcdfc1 (patch)
treeb9235ea6447ddd65cc7718f76a34e8aa6dd6b2c6 /src/class/hid/hid_device.c
parent0b3503cb33e6a269e573a75b6ed67d69aee12dbb (diff)
change report len in hid API from uint8_t to uint16_t
since HS interrupt endpoint can be up to 1024, 8-bit is not enough. affected APIs are: - tud_hid_n_report() / tud_hid_report() - tud_hid_report_complete_cb()
Diffstat (limited to 'src/class/hid/hid_device.c')
-rw-r--r--src/class/hid/hid_device.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c
index cdf155e1c..210050858 100644
--- a/src/class/hid/hid_device.c
+++ b/src/class/hid/hid_device.c
@@ -81,7 +81,7 @@ bool tud_hid_n_ready(uint8_t instance)
return tud_ready() && (ep_in != 0) && !usbd_edpt_busy(rhport, ep_in);
}
-bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, uint8_t len)
+bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, uint16_t len)
{
uint8_t const rhport = 0;
hidd_interface_t * p_hid = &_hidd_itf[instance];
@@ -92,7 +92,7 @@ bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, u
// prepare data
if (report_id)
{
- len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE-1);
+ len = tu_min16(len, CFG_TUD_HID_EP_BUFSIZE-1);
p_hid->epin_buf[0] = report_id;
memcpy(p_hid->epin_buf+1, report, len);
@@ -100,7 +100,7 @@ bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const* report, u
}else
{
// If report id = 0, skip ID field
- len = tu_min8(len, CFG_TUD_HID_EP_BUFSIZE);
+ len = tu_min16(len, CFG_TUD_HID_EP_BUFSIZE);
memcpy(p_hid->epin_buf, report, len);
}
@@ -402,7 +402,7 @@ bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
{
if (tud_hid_report_complete_cb)
{
- tud_hid_report_complete_cb(instance, p_hid->epin_buf, (uint8_t) xferred_bytes);
+ tud_hid_report_complete_cb(instance, p_hid->epin_buf, (uint16_t) xferred_bytes);
}
}
// Received report