From patchwork Tue Sep 30 02:21:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vesely X-Patchwork-Id: 394698 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 BE6A01400F1 for ; Tue, 30 Sep 2014 12:22:09 +1000 (EST) Received: from localhost ([::1]:40201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYn4o-0001rd-Dz for incoming@patchwork.ozlabs.org; Mon, 29 Sep 2014 22:22:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYn4F-0001Di-Pj for qemu-devel@nongnu.org; Mon, 29 Sep 2014 22:21:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYn46-0005p5-NZ for qemu-devel@nongnu.org; Mon, 29 Sep 2014 22:21:31 -0400 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:39201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYn46-0005oV-H5 for qemu-devel@nongnu.org; Mon, 29 Sep 2014 22:21:22 -0400 Received: by mail-qa0-f43.google.com with SMTP id i13so9636658qae.30 for ; Mon, 29 Sep 2014 19:21:16 -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=vif3ddL4vdaw00anSIzKc0zPxMjgvdR0RsSvHu94j8c=; b=sp4isH8uxNUJFhZQtFk3rX33Ygj5OpX9BBqehyYRk3SEFd6nLUbdYFQOZxsqGTYBbK L1E7Ws8ZwGNBbFE9tbRveWfaN5zhjotiH9HFPjd7F2cxe4os9ndP4xirE/SNS9Zq/nt4 eWqurwR25W2CtPyxUk1vXadvFaM2j0g/k6Ss71+gQxfHWA49VTdKk12cvgDvK2F4C/aU yGlgC1DB03Bkxx7ax2iW0S+Jlyeyc4wPBBPRmjUx6at8fM75kKOwIlklPHSPG7TAmqga kLQsNJe/onBl+8q9Aqzm+iK7EiZSKs9zuzCqSnR8Erep5S0ItLXra6WJG3ekiyzpFRA7 PGCw== X-Received: by 10.224.10.198 with SMTP id q6mr59042952qaq.55.1412043676839; Mon, 29 Sep 2014 19:21:16 -0700 (PDT) Received: from manwe.home (ool-2f14df14.dyn.optonline.net. [47.20.223.20]) by mx.google.com with ESMTPSA id s4sm12798517qay.36.2014.09.29.19.21.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Sep 2014 19:21:16 -0700 (PDT) From: Jan Vesely To: QEMU Date: Mon, 29 Sep 2014 22:21:10 -0400 Message-Id: <1412043671-15673-2-git-send-email-jano.vesely@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1412043671-15673-1-git-send-email-jano.vesely@gmail.com> References: <1412043671-15673-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:c00::22b Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v4 2/3] usb-hid: Add high speed mouse 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 Signed-off-by: Jan Vesely --- v2: add usb_mouse_properties use macros for bmAttributes v3: rebase v4: add compat property rebase hw/i386/pc_piix.c | 4 ++++ hw/usb/dev-hid.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 103d756..6a170b4 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -545,6 +545,10 @@ static QEMUMachine pc_i440fx_machine_v1_4 = { .property = "usb_version",\ .value = stringify(1),\ },{\ + .driver = "usb-mouse",\ + .property = "usb_version",\ + .value = stringify(1),\ + },{\ .driver = "virtio-net-pci",\ .property = "ctrl_mac_addr",\ .value = "off", \ diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 5d37d63..c238fcd 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -104,6 +104,37 @@ static const USBDescIface desc_iface_mouse = { }, }; +static const USBDescIface desc_iface_mouse2 = { + .bInterfaceNumber = 0, + .bNumEndpoints = 1, + .bInterfaceClass = USB_CLASS_HID, + .bInterfaceSubClass = 0x01, /* boot */ + .bInterfaceProtocol = 0x02, + .ndesc = 1, + .descs = (USBDescOther[]) { + { + /* HID descriptor */ + .data = (uint8_t[]) { + 0x09, /* u8 bLength */ + USB_DT_HID, /* u8 bDescriptorType */ + 0x01, 0x00, /* u16 HID_class */ + 0x00, /* u8 country_code */ + 0x01, /* u8 num_descriptors */ + USB_DT_REPORT, /* u8 type: Report */ + 52, 0, /* u16 len */ + }, + }, + }, + .eps = (USBDescEndpoint[]) { + { + .bEndpointAddress = USB_DIR_IN | 0x01, + .bmAttributes = USB_ENDPOINT_XFER_INT, + .wMaxPacketSize = 4, + .bInterval = 7, /* 2 ^ (8-1) * 125 usecs = 8 ms */ + }, + }, +}; + static const USBDescIface desc_iface_tablet = { .bInterfaceNumber = 0, .bNumEndpoints = 1, @@ -212,6 +243,23 @@ static const USBDescDevice desc_device_mouse = { }, }; +static const USBDescDevice desc_device_mouse2 = { + .bcdUSB = 0x0200, + .bMaxPacketSize0 = 64, + .bNumConfigurations = 1, + .confs = (USBDescConfig[]) { + { + .bNumInterfaces = 1, + .bConfigurationValue = 1, + .iConfiguration = STR_CONFIG_MOUSE, + .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP, + .bMaxPower = 50, + .nif = 1, + .ifs = &desc_iface_mouse2, + }, + }, +}; + static const USBDescDevice desc_device_tablet = { .bcdUSB = 0x0100, .bMaxPacketSize0 = 8, @@ -281,6 +329,21 @@ static const USBDesc desc_mouse = { .msos = &desc_msos_suspend, }; +static const USBDesc desc_mouse2 = { + .id = { + .idVendor = 0x0627, + .idProduct = 0x0001, + .bcdDevice = 0, + .iManufacturer = STR_MANUFACTURER, + .iProduct = STR_PRODUCT_MOUSE, + .iSerialNumber = STR_SERIALNUMBER, + }, + .full = &desc_device_mouse, + .high = &desc_device_mouse2, + .str = desc_strings, + .msos = &desc_msos_suspend, +}; + static const USBDesc desc_tablet = { .id = { .idVendor = 0x0627, @@ -606,7 +669,7 @@ static void usb_tablet_realize(USBDevice *dev, Error **errp) static void usb_mouse_realize(USBDevice *dev, Error **errp) { - usb_hid_initfn(dev, HID_MOUSE, &desc_mouse, NULL, errp); + usb_hid_initfn(dev, HID_MOUSE, &desc_mouse, &desc_mouse2, errp); } static void usb_keyboard_realize(USBDevice *dev, Error **errp) @@ -685,6 +748,11 @@ static const TypeInfo usb_tablet_info = { .class_init = usb_tablet_class_initfn, }; +static Property usb_mouse_properties[] = { + DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), + DEFINE_PROP_END_OF_LIST(), +}; + static void usb_mouse_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -694,6 +762,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data) uc->realize = usb_mouse_realize; uc->product_desc = "QEMU USB Mouse"; dc->vmsd = &vmstate_usb_ptr; + dc->props = usb_mouse_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); }