summaryrefslogtreecommitdiff
path: root/include/usb_hid.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-06-16 13:44:11 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-19 03:28:43 +0000
commit17696e1470d152308ad39ac0ec1e61f82f4ff260 (patch)
tree0658d2d0e2832a8b9cb4a9519fd6dcf44f0150d8 /include/usb_hid.h
parent94acd01e0c4e9cb9c31c6b6d332d24bb352d669c (diff)
downloadchrome-ec-17696e1470d152308ad39ac0ec1e61f82f4ff260.tar.gz
usb: add USB HID driver
Add a USB HID endpoint providing a keyboard interface. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=build for the Reston keyboard and press keys on the matrix. Change-Id: I3f4cc55acdd33286f0638dabaa9050c37698404f Reviewed-on: https://chromium-review.googlesource.com/204166 Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/usb_hid.h')
-rw-r--r--include/usb_hid.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/usb_hid.h b/include/usb_hid.h
new file mode 100644
index 0000000000..89ec887342
--- /dev/null
+++ b/include/usb_hid.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * USB HID definitions.
+ */
+
+#ifndef USB_HID_H
+#define USB_HID_H
+
+#define USB_HID_SUBCLASS_BOOT 1
+#define USB_HID_PROTOCOL_KEYBOARD 1
+#define USB_HID_PROTOCOL_MOUSE 2
+
+/* USB HID Class requests */
+#define USB_HID_REQ_GET_REPORT 0x01
+#define USB_HID_REQ_GET_IDLE 0x02
+#define USB_HID_REQ_GET_PROTOCOL 0x03
+#define USB_HID_REQ_SET_REPORT 0x09
+#define USB_HID_REQ_SET_IDLE 0x0A
+#define USB_HID_REQ_SET_PROTOCOL 0x0B
+
+/* USB HID class descriptor types */
+#define USB_HID_DT_HID (USB_TYPE_CLASS | 0x01)
+#define USB_HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
+#define USB_HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
+
+struct usb_hid_class_descriptor {
+ uint8_t bDescriptorType;
+ uint16_t wDescriptorLength;
+} __packed;
+
+struct usb_hid_descriptor {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t bcdHID;
+ uint8_t bCountryCode;
+ uint8_t bNumDescriptors;
+ struct usb_hid_class_descriptor desc[1];
+} __packed;
+
+/* class implementation interfaces */
+void set_keyboard_report(uint64_t rpt);
+
+#endif /* USB_H */