summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-05-22 21:51:30 +0700
committerhathach <[email protected]>2021-05-22 21:51:30 +0700
commitb8e019da321512758959f6fb3b2f0192bda698dc (patch)
treea6b3b0feea6306c15336f74d5be90b646b953a7e
parentdf65c35b31581881b2bf49d9e16608d46f98fe4b (diff)
rename tuh_hid_get_report_cb to tuh_hid_report_received_cb()
-rw-r--r--examples/host/cdc_msc_hid/src/hid_app.c7
-rw-r--r--src/class/hid/hid_host.c2
-rw-r--r--src/class/hid/hid_host.h4
3 files changed, 9 insertions, 4 deletions
diff --git a/examples/host/cdc_msc_hid/src/hid_app.c b/examples/host/cdc_msc_hid/src/hid_app.c
index 79f10251f..67be8d50f 100644
--- a/examples/host/cdc_msc_hid/src/hid_app.c
+++ b/examples/host/cdc_msc_hid/src/hid_app.c
@@ -53,6 +53,9 @@ void hid_app_task(void)
// TinyUSB Callbacks
//--------------------------------------------------------------------+
+// Invoked when device with hid interface is mounted
+// Report descriptor is also available for use. tuh_hid_parse_report_descriptor()
+// can be used to parse common/simple enough descriptor.
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len)
{
printf("HID device address = %d, instance = %d is mounted\r\n", dev_addr, instance);
@@ -66,12 +69,14 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
printf("HID has %u reports and interface protocol = %s\r\n", _report_count[instance], protocol_str[interface_protocol]);
}
+// Invoked when device with hid interface is un-mounted
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance)
{
printf("HID device address = %d, instance = %d is unmounted\r\n", dev_addr, instance);
}
-void tuh_hid_get_report_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
+// Invoked when received Report from device via either regular endpoint
+void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
{
(void) dev_addr;
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index f15f0b72a..63983ca5f 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -223,7 +223,7 @@ bool hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint3
{
TU_LOG2(" Get Report callback (%u, %u)\r\n", dev_addr, instance);
TU_LOG1_MEM(hid_itf->epin_buf, 8, 2);
- tuh_hid_get_report_cb(dev_addr, instance, hid_itf->epin_buf, xferred_bytes);
+ tuh_hid_report_received_cb(dev_addr, instance, hid_itf->epin_buf, xferred_bytes);
// queue next report
hidh_get_report(dev_addr, hid_itf);
diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h
index f962f5b0a..3f9979f52 100644
--- a/src/class/hid/hid_host.h
+++ b/src/class/hid/hid_host.h
@@ -102,8 +102,8 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report_
// Invoked when device with hid interface is un-mounted
TU_ATTR_WEAK void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance);
-// Invoked when received Report from device via either regular or control endpoint
-void tuh_hid_get_report_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
+// Invoked when received Report from device via either regular endpoint
+void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
// Invoked when Sent Report to device via either control endpoint
// len = 0 indicate there is error in the transfer e.g stalled response