From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEuU0-00070H-Ve for qemu-devel@nongnu.org; Sun, 16 Feb 2014 00:41:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEuTp-0001pH-JL for qemu-devel@nongnu.org; Sun, 16 Feb 2014 00:41:40 -0500 Received: from mail-qa0-x235.google.com ([2607:f8b0:400d:c00::235]:53660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEuTp-0001p9-D4 for qemu-devel@nongnu.org; Sun, 16 Feb 2014 00:41:29 -0500 Received: by mail-qa0-f53.google.com with SMTP id cm18so20443150qab.12 for ; Sat, 15 Feb 2014 21:41:29 -0800 (PST) Received: from manwe.rutgers.edu ([198.151.130.249]) by mx.google.com with ESMTPSA id u4sm32221262qai.21.2014.02.15.21.41.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Feb 2014 21:41:28 -0800 (PST) From: Jan Vesely Date: Sun, 16 Feb 2014 00:41:26 -0500 Message-Id: <1392529286-24938-2-git-send-email-jano.vesely@gmail.com> In-Reply-To: <1392529286-24938-1-git-send-email-jano.vesely@gmail.com> References: <1392529286-24938-1-git-send-email-jano.vesely@gmail.com> Subject: [Qemu-devel] [PATCH 2/2] usb-hid: Add high speed keyboard configuration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Jan Vesely --- Tested on Ubuntu, Fedora, and HelenOS. hw/usb/dev-hid.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 954cde1..53e7bd3 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -56,7 +56,8 @@ enum { STR_PRODUCT_KEYBOARD, STR_SERIALNUMBER, STR_CONFIG_TABLET, - STR_CONFIG_KEYBOARD, + STR_CONFIG_KEYBOARD_FULL, + STR_CONFIG_KEYBOARD_HIGH, STR_CONFIG_MOUSE_FULL, STR_CONFIG_MOUSE_HIGH, }; @@ -68,7 +69,8 @@ static const USBDescStrings desc_strings = { [STR_PRODUCT_KEYBOARD] = "QEMU USB Keyboard", [STR_SERIALNUMBER] = "42", /* == remote wakeup works */ [STR_CONFIG_TABLET] = "HID Tablet", - [STR_CONFIG_KEYBOARD] = "HID Keyboard", + [STR_CONFIG_KEYBOARD_FULL] = "HID Keyboard Full speed configuration (usb 1.1)", + [STR_CONFIG_KEYBOARD_HIGH] = "HID Keyboard High speed configuration (usb 2.0)", [STR_CONFIG_MOUSE_FULL]= "HID Mouse Full speed configuration (usb 1.1)", [STR_CONFIG_MOUSE_HIGH]= "HID Mouse High speed configuration (usb 2.0)", }; @@ -195,7 +197,7 @@ static const USBDescIface desc_iface_tablet2 = { }, }; -static const USBDescIface desc_iface_keyboard = { +static const USBDescIface desc_iface_keyboard_full = { .bInterfaceNumber = 0, .bNumEndpoints = 1, .bInterfaceClass = USB_CLASS_HID, @@ -226,6 +228,37 @@ static const USBDescIface desc_iface_keyboard = { }, }; +static const USBDescIface desc_iface_keyboard_high = { + .bInterfaceNumber = 0, + .bNumEndpoints = 1, + .bInterfaceClass = USB_CLASS_HID, + .bInterfaceSubClass = 0x01, /* boot */ + .bInterfaceProtocol = 0x01, /* keyboard */ + .ndesc = 1, + .descs = (USBDescOther[]) { + { + /* HID descriptor */ + .data = (uint8_t[]) { + 0x09, /* u8 bLength */ + USB_DT_HID, /* u8 bDescriptorType */ + 0x11, 0x01, /* u16 HID_class */ + 0x00, /* u8 country_code */ + 0x01, /* u8 num_descriptors */ + USB_DT_REPORT, /* u8 type: Report */ + 0x3f, 0, /* u16 len */ + }, + }, + }, + .eps = (USBDescEndpoint[]) { + { + .bEndpointAddress = USB_DIR_IN | 0x01, + .bmAttributes = USB_ENDPOINT_XFER_INT, + .wMaxPacketSize = 8, + .bInterval = 0x06, + }, + }, +}; + static const USBDescDevice desc_device_mouse_full = { .bcdUSB = 0x0200, .bMaxPacketSize0 = 8, @@ -294,19 +327,36 @@ static const USBDescDevice desc_device_tablet2 = { }, }; -static const USBDescDevice desc_device_keyboard = { - .bcdUSB = 0x0100, +static const USBDescDevice desc_device_keyboard_full = { + .bcdUSB = 0x0200, + .bMaxPacketSize0 = 8, + .bNumConfigurations = 1, + .confs = (USBDescConfig[]) { + { + .bNumInterfaces = 1, + .bConfigurationValue = 1, + .iConfiguration = STR_CONFIG_KEYBOARD_FULL, + .bmAttributes = 0xa0, + .bMaxPower = 50, + .nif = 1, + .ifs = &desc_iface_keyboard_full, + }, + }, +}; + +static const USBDescDevice desc_device_keyboard_high = { + .bcdUSB = 0x0200, .bMaxPacketSize0 = 8, .bNumConfigurations = 1, .confs = (USBDescConfig[]) { { .bNumInterfaces = 1, .bConfigurationValue = 1, - .iConfiguration = STR_CONFIG_KEYBOARD, + .iConfiguration = STR_CONFIG_KEYBOARD_HIGH, .bmAttributes = 0xa0, .bMaxPower = 50, .nif = 1, - .ifs = &desc_iface_keyboard, + .ifs = &desc_iface_keyboard_high, }, }, }; @@ -368,7 +418,8 @@ static const USBDesc desc_keyboard = { .iProduct = STR_PRODUCT_KEYBOARD, .iSerialNumber = STR_SERIALNUMBER, }, - .full = &desc_device_keyboard, + .full = &desc_device_keyboard_full, + .high = &desc_device_keyboard_high, .str = desc_strings, .msos = &desc_msos_suspend, }; -- 1.8.3.2