aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2016-01-06 16:30:01 +0000
committerMichael Brown <mcb30@ipxe.org>2016-01-06 18:55:08 +0000
commit2f861d736f8b156aa87de3f0e250380ca292f767 (patch)
tree4c98803b2380a5b0585d26107e5a69c5f2c71b9b /src/include
parent173c48a57e43b747ab8ace1e5a59bfdb2132ddee (diff)
downloadipxe-2f861d736f8b156aa87de3f0e250380ca292f767.zip
ipxe-2f861d736f8b156aa87de3f0e250380ca292f767.tar.gz
ipxe-2f861d736f8b156aa87de3f0e250380ca292f767.tar.bz2
[usb] Add support for numeric keypad on USB keyboards
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/usbhid.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/include/ipxe/usbhid.h b/src/include/ipxe/usbhid.h
index fe9d844..233534e 100644
--- a/src/include/ipxe/usbhid.h
+++ b/src/include/ipxe/usbhid.h
@@ -33,6 +33,20 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
USB_REQUEST_TYPE ( 0x0a ) )
+/** Set report */
+#define USBHID_SET_REPORT \
+ ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
+ USB_REQUEST_TYPE ( 0x09 ) )
+
+/** Input report type */
+#define USBHID_REPORT_INPUT 0x01
+
+/** Output report type */
+#define USBHID_REPORT_OUTPUT 0x02
+
+/** Feature report type */
+#define USBHID_REPORT_FEATURE 0x03
+
/** A USB human interface device */
struct usb_hid {
/** USB function */
@@ -97,6 +111,26 @@ usbhid_set_idle ( struct usb_device *usb, unsigned int interface,
interface, NULL, 0 );
}
+/**
+ * Set report
+ *
+ * @v usb USB device
+ * @v interface Interface number
+ * @v type Report type
+ * @v report Report ID
+ * @v data Report data
+ * @v len Length of report data
+ * @ret rc Return status code
+ */
+static inline __attribute__ (( always_inline )) int
+usbhid_set_report ( struct usb_device *usb, unsigned int interface,
+ unsigned int type, unsigned int report, void *data,
+ size_t len ) {
+
+ return usb_control ( usb, USBHID_SET_REPORT, ( ( type << 8 ) | report ),
+ interface, data, len );
+}
+
extern int usbhid_open ( struct usb_hid *hid );
extern void usbhid_close ( struct usb_hid *hid );
extern int usbhid_refill ( struct usb_hid *hid );