From 53ec569372bdccf75be4b4f695e8cf00950b396a Mon Sep 17 00:00:00 2001 From: Simon Kueppers Date: Fri, 24 Feb 2023 15:47:36 +0100 Subject: [PATCH] HID input report cleanup --- stm32/aioc-fw/Src/usb_hid.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/stm32/aioc-fw/Src/usb_hid.c b/stm32/aioc-fw/Src/usb_hid.c index f621380..dbad83c 100644 --- a/stm32/aioc-fw/Src/usb_hid.c +++ b/stm32/aioc-fw/Src/usb_hid.c @@ -23,16 +23,27 @@ uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t { (void) itf; (void) report_id; - (void) report_type; (void) buffer; (void) reqlen; - buffer[0] = 0x00; - buffer[1] = gpioState; - buffer[2] = 0x00; - buffer[3] = 0x00; + switch (report_type) { + case HID_REPORT_TYPE_INPUT: + buffer[0] = 0x00; + buffer[1] = gpioState; + buffer[2] = 0x00; + buffer[3] = 0x00; + return USB_HID_INOUT_REPORT_LEN; - return USB_HID_INOUT_REPORT_LEN; + case HID_REPORT_TYPE_FEATURE: + /* Custom extension for configuring the AIOC */ + break; + + default: + TU_BREAKPOINT(); + break; + } + + return 0; } // Invoked when received SET_REPORT control request