summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2020-12-08 18:00:01 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-23 06:24:18 +0000
commita3113149a50a82c38316d4813b41e5068ad17362 (patch)
tree8f11154d1cae5c75991050fe7843e91003d0de4d /chip
parent430c4a22e11a19d7ab4a7818b2f08764b4757c28 (diff)
downloadchrome-ec-a3113149a50a82c38316d4813b41e5068ad17362.tar.gz
chip/stm32/usb_hid_keyboard: Implement HID GET_REPORT
Implement HID GET_REPORT with INPUT type. BRANCH=nocturne,kukui BUG=b:174539061 TEST=With associated kernel CL: cd /sys/bus/usb/drivers/usbhid echo 1-1.1:1.0 > unbind; echo 1-1.1:1.0 > bind Change-Id: If62c92e55fa5454116816681c2ab46d5e796c4b5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578620 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/stm32/usb_hid_keyboard.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/chip/stm32/usb_hid_keyboard.c b/chip/stm32/usb_hid_keyboard.c
index cddeea289e..c637cf4363 100644
--- a/chip/stm32/usb_hid_keyboard.c
+++ b/chip/stm32/usb_hid_keyboard.c
@@ -527,27 +527,33 @@ static void hid_keyboard_feature_init(void)
}
}
DECLARE_HOOK(HOOK_INIT, hid_keyboard_feature_init, HOOK_PRIO_DEFAULT - 1);
+#endif
static int hid_keyboard_get_report(uint8_t report_id, uint8_t report_type,
const uint8_t **buffer_ptr, int *buffer_size)
{
+ if (report_type == REPORT_TYPE_INPUT) {
+ *buffer_ptr = (uint8_t *)&report;
+ *buffer_size = sizeof(report);
+ return 0;
+ }
+
+#ifdef CONFIG_USB_HID_KEYBOARD_VIVALDI
if (report_type == REPORT_TYPE_FEATURE) {
*buffer_ptr = (uint8_t *)feature_report;
*buffer_size = sizeof(feature_report);
return 0;
}
+#endif
return -1;
}
-#endif
static struct usb_hid_config_t hid_config_kb = {
.report_desc = report_desc,
.report_size = sizeof(report_desc),
.hid_desc = &hid_desc_kb,
-#ifdef CONFIG_USB_HID_KEYBOARD_VIVALDI
.get_report = &hid_keyboard_get_report,
-#endif
};
static int hid_keyboard_iface_request(usb_uint *ep0_buf_rx,