From 2f861d736f8b156aa87de3f0e250380ca292f767 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 6 Jan 2016 16:30:01 +0000 Subject: [usb] Add support for numeric keypad on USB keyboards Signed-off-by: Michael Brown --- src/include/ipxe/usbhid.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/include/ipxe') diff --git a/src/include/ipxe/usbhid.h b/src/include/ipxe/usbhid.h index fe9d84455..233534e0f 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 ); -- cgit v1.2.3-55-g7522