From patchwork Wed Oct 15 11:52:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 399960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2B4AA140146 for ; Wed, 15 Oct 2014 22:55:23 +1100 (EST) Received: from localhost ([::1]:44113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeNAn-00040C-9y for incoming@patchwork.ozlabs.org; Wed, 15 Oct 2014 07:55:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeN8I-0008JS-DT for qemu-devel@nongnu.org; Wed, 15 Oct 2014 07:52:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeN8B-0000m7-ED for qemu-devel@nongnu.org; Wed, 15 Oct 2014 07:52:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeN8B-0000l9-6c for qemu-devel@nongnu.org; Wed, 15 Oct 2014 07:52:39 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9FBqaLo016402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 15 Oct 2014 07:52:36 -0400 Received: from nilsson.home.kraxel.org (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9FBqZXo031565; Wed, 15 Oct 2014 07:52:35 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 4615680808; Wed, 15 Oct 2014 13:52:35 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 15 Oct 2014 13:52:32 +0200 Message-Id: <1413373953-19493-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1413373953-19493-1-git-send-email-kraxel@redhat.com> References: <1413373953-19493-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jan Vesely , Gerd Hoffmann , Anthony Liguori , "Michael S. Tsirkin" Subject: [Qemu-devel] [PULL 3/4] usb-hid: Add high speed keyboard configuration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Vesely Signed-off-by: Jan Vesely [ kraxel: fixup compat property to apply to 2.1 & older ] Signed-off-by: Gerd Hoffmann --- hw/usb/dev-hid.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++- include/hw/i386/pc.h | 4 ++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index c238fcd..507c966 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -226,6 +226,37 @@ static const USBDescIface desc_iface_keyboard = { }, }; +static const USBDescIface desc_iface_keyboard2 = { + .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 = 7, /* 2 ^ (8-1) * 125 usecs = 8 ms */ + }, + }, +}; + static const USBDescDevice desc_device_mouse = { .bcdUSB = 0x0100, .bMaxPacketSize0 = 8, @@ -311,6 +342,23 @@ static const USBDescDevice desc_device_keyboard = { }, }; +static const USBDescDevice desc_device_keyboard2 = { + .bcdUSB = 0x0200, + .bMaxPacketSize0 = 64, + .bNumConfigurations = 1, + .confs = (USBDescConfig[]) { + { + .bNumInterfaces = 1, + .bConfigurationValue = 1, + .iConfiguration = STR_CONFIG_KEYBOARD, + .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP, + .bMaxPower = 50, + .nif = 1, + .ifs = &desc_iface_keyboard2, + }, + }, +}; + static const USBDescMSOS desc_msos_suspend = { .SelectiveSuspendEnabled = true, }; @@ -387,6 +435,21 @@ static const USBDesc desc_keyboard = { .msos = &desc_msos_suspend, }; +static const USBDesc desc_keyboard2 = { + .id = { + .idVendor = 0x0627, + .idProduct = 0x0001, + .bcdDevice = 0, + .iManufacturer = STR_MANUFACTURER, + .iProduct = STR_PRODUCT_KEYBOARD, + .iSerialNumber = STR_SERIALNUMBER, + }, + .full = &desc_device_keyboard, + .high = &desc_device_keyboard2, + .str = desc_strings, + .msos = &desc_msos_suspend, +}; + static const uint8_t qemu_mouse_hid_report_descriptor[] = { 0x05, 0x01, /* Usage Page (Generic Desktop) */ 0x09, 0x02, /* Usage (Mouse) */ @@ -674,7 +737,7 @@ static void usb_mouse_realize(USBDevice *dev, Error **errp) static void usb_keyboard_realize(USBDevice *dev, Error **errp) { - usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, NULL, errp); + usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, &desc_keyboard2, errp); } static int usb_ptr_post_load(void *opaque, int version_id) @@ -774,6 +837,7 @@ static const TypeInfo usb_mouse_info = { }; static Property usb_keyboard_properties[] = { + DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), DEFINE_PROP_STRING("display", USBHIDState, display), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 3b31749..db21a61 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -310,6 +310,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = "usb-mouse",\ .property = "usb_version",\ .value = stringify(1),\ + },{\ + .driver = "usb-kbd",\ + .property = "usb_version",\ + .value = stringify(1),\ } #define PC_COMPAT_2_0 \