From patchwork Thu Sep 25 21:38:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vesely X-Patchwork-Id: 393476 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 DF2C51400EA for ; Fri, 26 Sep 2014 07:39:30 +1000 (EST) Received: from localhost ([::1]:43267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXGl6-0007ns-9g for incoming@patchwork.ozlabs.org; Thu, 25 Sep 2014 17:39:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXGkU-0006uc-7r for qemu-devel@nongnu.org; Thu, 25 Sep 2014 17:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXGkI-00016y-Ld for qemu-devel@nongnu.org; Thu, 25 Sep 2014 17:38:50 -0400 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:40594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXGkI-0000yf-Bw for qemu-devel@nongnu.org; Thu, 25 Sep 2014 17:38:38 -0400 Received: by mail-qg0-f42.google.com with SMTP id z60so7044968qgd.29 for ; Thu, 25 Sep 2014 14:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8sUfxT7BWTpNvm3NuUdKmluLvW90tg/n8iE0U08jh6Y=; b=C+F5ce+Yrup0bMkESssvB+Z+EOzj7im8ST78Km4LxDLK+CrFJKcEsaU6cl+8Z1mzhd I+8k1ng51yPmNOkBEfzklsCdqd0T96ST60rAFQ4YLTjw1JFq3ROcg7Hy5rN1ZPXbDnjD wFy7HqmEOA+rsPe2C44caTjevp4DwppAlK0RiTHI6ExngS5ZUl+GZXcefISsW4E2zhI0 0wojZOIxbxdS76er3xDUUcrnNxgtwDk9Xt0s1/SOFJRcpDJ7SYN+EMKVfHfqVGEovTXK icJ/lFX26P2tiuBYQxiG8sJFlBj07149IbcJNgNY9OVKTENObvqGSOf4cIh2mdpwHcXB QYMw== X-Received: by 10.224.80.131 with SMTP id t3mr22459472qak.35.1411681112541; Thu, 25 Sep 2014 14:38:32 -0700 (PDT) Received: from manwe.home (ool-2f14df14.dyn.optonline.net. [47.20.223.20]) by mx.google.com with ESMTPSA id y6sm3060910qgy.34.2014.09.25.14.38.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Sep 2014 14:38:32 -0700 (PDT) From: Jan Vesely To: QEMU Date: Thu, 25 Sep 2014 17:38:14 -0400 Message-Id: <1411681094-8474-3-git-send-email-jano.vesely@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411681094-8474-1-git-send-email-jano.vesely@gmail.com> References: <1411681094-8474-1-git-send-email-jano.vesely@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::22a Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v2 3/3] 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 v2: rebase Signed-off-by: Jan Vesely --- hw/usb/dev-hid.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index a946528..7b67489 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) */ @@ -671,7 +734,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, &desc_keyboard, errp); + usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, &desc_keyboard2, errp); } static int usb_ptr_post_load(void *opaque, int version_id) @@ -771,6 +834,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(), };