* [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration
@ 2014-02-16 5:41 Jan Vesely
2014-02-16 5:41 ` [Qemu-devel] [PATCH 2/2] usb-hid: Add high speed keyboard configuration Jan Vesely
2014-02-17 12:10 ` [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Gerd Hoffmann
0 siblings, 2 replies; 12+ messages in thread
From: Jan Vesely @ 2014-02-16 5:41 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
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 2966066..954cde1 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -55,9 +55,10 @@ enum {
STR_PRODUCT_TABLET,
STR_PRODUCT_KEYBOARD,
STR_SERIALNUMBER,
- STR_CONFIG_MOUSE,
STR_CONFIG_TABLET,
STR_CONFIG_KEYBOARD,
+ STR_CONFIG_MOUSE_FULL,
+ STR_CONFIG_MOUSE_HIGH,
};
static const USBDescStrings desc_strings = {
@@ -66,12 +67,13 @@ static const USBDescStrings desc_strings = {
[STR_PRODUCT_TABLET] = "QEMU USB Tablet",
[STR_PRODUCT_KEYBOARD] = "QEMU USB Keyboard",
[STR_SERIALNUMBER] = "42", /* == remote wakeup works */
- [STR_CONFIG_MOUSE] = "HID Mouse",
[STR_CONFIG_TABLET] = "HID Tablet",
[STR_CONFIG_KEYBOARD] = "HID Keyboard",
+ [STR_CONFIG_MOUSE_FULL]= "HID Mouse Full speed configuration (usb 1.1)",
+ [STR_CONFIG_MOUSE_HIGH]= "HID Mouse High speed configuration (usb 2.0)",
};
-static const USBDescIface desc_iface_mouse = {
+static const USBDescIface desc_iface_mouse_full = {
.bInterfaceNumber = 0,
.bNumEndpoints = 1,
.bInterfaceClass = USB_CLASS_HID,
@@ -102,6 +104,37 @@ static const USBDescIface desc_iface_mouse = {
},
};
+static const USBDescIface desc_iface_mouse_high = {
+ .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 = 0x06,
+ },
+ },
+};
+
static const USBDescIface desc_iface_tablet = {
.bInterfaceNumber = 0,
.bNumEndpoints = 1,
@@ -193,19 +226,36 @@ static const USBDescIface desc_iface_keyboard = {
},
};
-static const USBDescDevice desc_device_mouse = {
- .bcdUSB = 0x0100,
+static const USBDescDevice desc_device_mouse_full = {
+ .bcdUSB = 0x0200,
+ .bMaxPacketSize0 = 8,
+ .bNumConfigurations = 1,
+ .confs = (USBDescConfig[]) {
+ {
+ .bNumInterfaces = 1,
+ .bConfigurationValue = 1,
+ .iConfiguration = STR_CONFIG_MOUSE_FULL,
+ .bmAttributes = 0xa0,
+ .bMaxPower = 50,
+ .nif = 1,
+ .ifs = &desc_iface_mouse_full,
+ },
+ },
+};
+
+static const USBDescDevice desc_device_mouse_high = {
+ .bcdUSB = 0x0200,
.bMaxPacketSize0 = 8,
.bNumConfigurations = 1,
.confs = (USBDescConfig[]) {
{
.bNumInterfaces = 1,
.bConfigurationValue = 1,
- .iConfiguration = STR_CONFIG_MOUSE,
+ .iConfiguration = STR_CONFIG_MOUSE_HIGH,
.bmAttributes = 0xa0,
.bMaxPower = 50,
.nif = 1,
- .ifs = &desc_iface_mouse,
+ .ifs = &desc_iface_mouse_high,
},
},
};
@@ -274,7 +324,8 @@ static const USBDesc desc_mouse = {
.iProduct = STR_PRODUCT_MOUSE,
.iSerialNumber = STR_SERIALNUMBER,
},
- .full = &desc_device_mouse,
+ .full = &desc_device_mouse_full,
+ .high = &desc_device_mouse_high,
.str = desc_strings,
.msos = &desc_msos_suspend,
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 2/2] usb-hid: Add high speed keyboard configuration
2014-02-16 5:41 [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Jan Vesely
@ 2014-02-16 5:41 ` Jan Vesely
2014-02-17 12:10 ` [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Gerd Hoffmann
1 sibling, 0 replies; 12+ messages in thread
From: Jan Vesely @ 2014-02-16 5:41 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration
2014-02-16 5:41 [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Jan Vesely
2014-02-16 5:41 ` [Qemu-devel] [PATCH 2/2] usb-hid: Add high speed keyboard configuration Jan Vesely
@ 2014-02-17 12:10 ` Gerd Hoffmann
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 " Jan Vesely
1 sibling, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2014-02-17 12:10 UTC (permalink / raw)
To: Jan Vesely; +Cc: qemu-devel
On So, 2014-02-16 at 00:41 -0500, Jan Vesely wrote:
> Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
This should have a usb_version property, like usb-tablet has.
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration
2014-02-17 12:10 ` [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Gerd Hoffmann
@ 2014-02-23 7:37 ` Jan Vesely
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 2/2] usb-hid: Add high speed keyboard configuration Jan Vesely
2014-03-17 17:53 ` [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration Ján Veselý
0 siblings, 2 replies; 12+ messages in thread
From: Jan Vesely @ 2014-02-23 7:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
v2: add usb_mouse_properties
use macros for bmAttributes
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
hw/usb/dev-hid.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 65 insertions(+), 8 deletions(-)
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index f36e617..70c2c5f 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -55,9 +55,10 @@ enum {
STR_PRODUCT_TABLET,
STR_PRODUCT_KEYBOARD,
STR_SERIALNUMBER,
- STR_CONFIG_MOUSE,
STR_CONFIG_TABLET,
STR_CONFIG_KEYBOARD,
+ STR_CONFIG_MOUSE_FULL,
+ STR_CONFIG_MOUSE_HIGH,
};
static const USBDescStrings desc_strings = {
@@ -66,12 +67,13 @@ static const USBDescStrings desc_strings = {
[STR_PRODUCT_TABLET] = "QEMU USB Tablet",
[STR_PRODUCT_KEYBOARD] = "QEMU USB Keyboard",
[STR_SERIALNUMBER] = "42", /* == remote wakeup works */
- [STR_CONFIG_MOUSE] = "HID Mouse",
[STR_CONFIG_TABLET] = "HID Tablet",
[STR_CONFIG_KEYBOARD] = "HID Keyboard",
+ [STR_CONFIG_MOUSE_FULL]= "HID Mouse Full speed configuration (usb 1.1)",
+ [STR_CONFIG_MOUSE_HIGH]= "HID Mouse High speed configuration (usb 2.0)",
};
-static const USBDescIface desc_iface_mouse = {
+static const USBDescIface desc_iface_mouse_full = {
.bInterfaceNumber = 0,
.bNumEndpoints = 1,
.bInterfaceClass = USB_CLASS_HID,
@@ -102,6 +104,37 @@ static const USBDescIface desc_iface_mouse = {
},
};
+static const USBDescIface desc_iface_mouse_high = {
+ .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 = 0x06,
+ },
+ },
+};
+
static const USBDescIface desc_iface_tablet = {
.bInterfaceNumber = 0,
.bNumEndpoints = 1,
@@ -193,19 +226,36 @@ static const USBDescIface desc_iface_keyboard = {
},
};
-static const USBDescDevice desc_device_mouse = {
- .bcdUSB = 0x0100,
+static const USBDescDevice desc_device_mouse_full = {
+ .bcdUSB = 0x0200,
+ .bMaxPacketSize0 = 8,
+ .bNumConfigurations = 1,
+ .confs = (USBDescConfig[]) {
+ {
+ .bNumInterfaces = 1,
+ .bConfigurationValue = 1,
+ .iConfiguration = STR_CONFIG_MOUSE_FULL,
+ .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
+ .bMaxPower = 50,
+ .nif = 1,
+ .ifs = &desc_iface_mouse_full,
+ },
+ },
+};
+
+static const USBDescDevice desc_device_mouse_high = {
+ .bcdUSB = 0x0200,
.bMaxPacketSize0 = 8,
.bNumConfigurations = 1,
.confs = (USBDescConfig[]) {
{
.bNumInterfaces = 1,
.bConfigurationValue = 1,
- .iConfiguration = STR_CONFIG_MOUSE,
+ .iConfiguration = STR_CONFIG_MOUSE_HIGH,
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
.bMaxPower = 50,
.nif = 1,
- .ifs = &desc_iface_mouse,
+ .ifs = &desc_iface_mouse_high,
},
},
};
@@ -274,7 +324,8 @@ static const USBDesc desc_mouse = {
.iProduct = STR_PRODUCT_MOUSE,
.iSerialNumber = STR_SERIALNUMBER,
},
- .full = &desc_device_mouse,
+ .full = &desc_device_mouse_full,
+ .high = &desc_device_mouse_high,
.str = desc_strings,
.msos = &desc_msos_suspend,
};
@@ -676,6 +727,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);
@@ -686,6 +742,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
uc->product_desc = "QEMU USB Mouse";
uc->usb_desc = &desc_mouse;
dc->vmsd = &vmstate_usb_ptr;
+ dc->props = usb_mouse_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
--
1.9.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] usb-hid: Add high speed keyboard configuration
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 " Jan Vesely
@ 2014-02-23 7:37 ` Jan Vesely
2014-03-17 17:53 ` [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration Ján Veselý
1 sibling, 0 replies; 12+ messages in thread
From: Jan Vesely @ 2014-02-23 7:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
v2: add usb_keyboard_properties
use macros for bmAttributes
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
hw/usb/dev-hid.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 65 insertions(+), 8 deletions(-)
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index 70c2c5f..6ead61c 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,
+ .iConfiguration = STR_CONFIG_KEYBOARD_FULL,
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
.bMaxPower = 50,
.nif = 1,
- .ifs = &desc_iface_keyboard,
+ .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_HIGH,
+ .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
+ .bMaxPower = 50,
+ .nif = 1,
+ .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,
};
@@ -753,6 +804,11 @@ static const TypeInfo usb_mouse_info = {
.class_init = usb_mouse_class_initfn,
};
+static Property usb_keyboard_properties[] = {
+ DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -763,6 +819,7 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
uc->product_desc = "QEMU USB Keyboard";
uc->usb_desc = &desc_keyboard;
dc->vmsd = &vmstate_usb_kbd;
+ dc->props = usb_keyboard_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
--
1.9.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 " Jan Vesely
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 2/2] usb-hid: Add high speed keyboard configuration Jan Vesely
@ 2014-03-17 17:53 ` Ján Veselý
2014-04-03 5:27 ` Ján Veselý
1 sibling, 1 reply; 12+ messages in thread
From: Ján Veselý @ 2014-03-17 17:53 UTC (permalink / raw)
To: QEMU; +Cc: Gerd Hoffmann
ping
any problem with v2?
regards,
Jan
On Sun, Feb 23, 2014 at 2:37 AM, Jan Vesely <jano.vesely@gmail.com> wrote:
> v2: add usb_mouse_properties
> use macros for bmAttributes
>
> Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
> ---
> hw/usb/dev-hid.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 65 insertions(+), 8 deletions(-)
>
> diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
> index f36e617..70c2c5f 100644
> --- a/hw/usb/dev-hid.c
> +++ b/hw/usb/dev-hid.c
> @@ -55,9 +55,10 @@ enum {
> STR_PRODUCT_TABLET,
> STR_PRODUCT_KEYBOARD,
> STR_SERIALNUMBER,
> - STR_CONFIG_MOUSE,
> STR_CONFIG_TABLET,
> STR_CONFIG_KEYBOARD,
> + STR_CONFIG_MOUSE_FULL,
> + STR_CONFIG_MOUSE_HIGH,
> };
>
> static const USBDescStrings desc_strings = {
> @@ -66,12 +67,13 @@ static const USBDescStrings desc_strings = {
> [STR_PRODUCT_TABLET] = "QEMU USB Tablet",
> [STR_PRODUCT_KEYBOARD] = "QEMU USB Keyboard",
> [STR_SERIALNUMBER] = "42", /* == remote wakeup works */
> - [STR_CONFIG_MOUSE] = "HID Mouse",
> [STR_CONFIG_TABLET] = "HID Tablet",
> [STR_CONFIG_KEYBOARD] = "HID Keyboard",
> + [STR_CONFIG_MOUSE_FULL]= "HID Mouse Full speed configuration (usb 1.1)",
> + [STR_CONFIG_MOUSE_HIGH]= "HID Mouse High speed configuration (usb 2.0)",
> };
>
> -static const USBDescIface desc_iface_mouse = {
> +static const USBDescIface desc_iface_mouse_full = {
> .bInterfaceNumber = 0,
> .bNumEndpoints = 1,
> .bInterfaceClass = USB_CLASS_HID,
> @@ -102,6 +104,37 @@ static const USBDescIface desc_iface_mouse = {
> },
> };
>
> +static const USBDescIface desc_iface_mouse_high = {
> + .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 = 0x06,
> + },
> + },
> +};
> +
> static const USBDescIface desc_iface_tablet = {
> .bInterfaceNumber = 0,
> .bNumEndpoints = 1,
> @@ -193,19 +226,36 @@ static const USBDescIface desc_iface_keyboard = {
> },
> };
>
> -static const USBDescDevice desc_device_mouse = {
> - .bcdUSB = 0x0100,
> +static const USBDescDevice desc_device_mouse_full = {
> + .bcdUSB = 0x0200,
> + .bMaxPacketSize0 = 8,
> + .bNumConfigurations = 1,
> + .confs = (USBDescConfig[]) {
> + {
> + .bNumInterfaces = 1,
> + .bConfigurationValue = 1,
> + .iConfiguration = STR_CONFIG_MOUSE_FULL,
> + .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
> + .bMaxPower = 50,
> + .nif = 1,
> + .ifs = &desc_iface_mouse_full,
> + },
> + },
> +};
> +
> +static const USBDescDevice desc_device_mouse_high = {
> + .bcdUSB = 0x0200,
> .bMaxPacketSize0 = 8,
> .bNumConfigurations = 1,
> .confs = (USBDescConfig[]) {
> {
> .bNumInterfaces = 1,
> .bConfigurationValue = 1,
> - .iConfiguration = STR_CONFIG_MOUSE,
> + .iConfiguration = STR_CONFIG_MOUSE_HIGH,
> .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
> .bMaxPower = 50,
> .nif = 1,
> - .ifs = &desc_iface_mouse,
> + .ifs = &desc_iface_mouse_high,
> },
> },
> };
> @@ -274,7 +324,8 @@ static const USBDesc desc_mouse = {
> .iProduct = STR_PRODUCT_MOUSE,
> .iSerialNumber = STR_SERIALNUMBER,
> },
> - .full = &desc_device_mouse,
> + .full = &desc_device_mouse_full,
> + .high = &desc_device_mouse_high,
> .str = desc_strings,
> .msos = &desc_msos_suspend,
> };
> @@ -676,6 +727,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);
> @@ -686,6 +742,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
> uc->product_desc = "QEMU USB Mouse";
> uc->usb_desc = &desc_mouse;
> dc->vmsd = &vmstate_usb_ptr;
> + dc->props = usb_mouse_properties;
> set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
> }
>
> --
> 1.9.0
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration
2014-03-17 17:53 ` [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration Ján Veselý
@ 2014-04-03 5:27 ` Ján Veselý
2014-04-07 8:02 ` Gerd Hoffmann
0 siblings, 1 reply; 12+ messages in thread
From: Ján Veselý @ 2014-04-03 5:27 UTC (permalink / raw)
To: QEMU; +Cc: Gerd Hoffmann
ping2
is there anything I can do to help these patches get merged?
Jan
On Mon, Mar 17, 2014 at 1:53 PM, Ján Veselý <jano.vesely@gmail.com> wrote:
> ping
>
> any problem with v2?
>
> regards,
> Jan
>
> On Sun, Feb 23, 2014 at 2:37 AM, Jan Vesely <jano.vesely@gmail.com> wrote:
>> v2: add usb_mouse_properties
>> use macros for bmAttributes
>>
>> Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
>> ---
>> hw/usb/dev-hid.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-------
>> 1 file changed, 65 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
>> index f36e617..70c2c5f 100644
>> --- a/hw/usb/dev-hid.c
>> +++ b/hw/usb/dev-hid.c
>> @@ -55,9 +55,10 @@ enum {
>> STR_PRODUCT_TABLET,
>> STR_PRODUCT_KEYBOARD,
>> STR_SERIALNUMBER,
>> - STR_CONFIG_MOUSE,
>> STR_CONFIG_TABLET,
>> STR_CONFIG_KEYBOARD,
>> + STR_CONFIG_MOUSE_FULL,
>> + STR_CONFIG_MOUSE_HIGH,
>> };
>>
>> static const USBDescStrings desc_strings = {
>> @@ -66,12 +67,13 @@ static const USBDescStrings desc_strings = {
>> [STR_PRODUCT_TABLET] = "QEMU USB Tablet",
>> [STR_PRODUCT_KEYBOARD] = "QEMU USB Keyboard",
>> [STR_SERIALNUMBER] = "42", /* == remote wakeup works */
>> - [STR_CONFIG_MOUSE] = "HID Mouse",
>> [STR_CONFIG_TABLET] = "HID Tablet",
>> [STR_CONFIG_KEYBOARD] = "HID Keyboard",
>> + [STR_CONFIG_MOUSE_FULL]= "HID Mouse Full speed configuration (usb 1.1)",
>> + [STR_CONFIG_MOUSE_HIGH]= "HID Mouse High speed configuration (usb 2.0)",
>> };
>>
>> -static const USBDescIface desc_iface_mouse = {
>> +static const USBDescIface desc_iface_mouse_full = {
>> .bInterfaceNumber = 0,
>> .bNumEndpoints = 1,
>> .bInterfaceClass = USB_CLASS_HID,
>> @@ -102,6 +104,37 @@ static const USBDescIface desc_iface_mouse = {
>> },
>> };
>>
>> +static const USBDescIface desc_iface_mouse_high = {
>> + .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 = 0x06,
>> + },
>> + },
>> +};
>> +
>> static const USBDescIface desc_iface_tablet = {
>> .bInterfaceNumber = 0,
>> .bNumEndpoints = 1,
>> @@ -193,19 +226,36 @@ static const USBDescIface desc_iface_keyboard = {
>> },
>> };
>>
>> -static const USBDescDevice desc_device_mouse = {
>> - .bcdUSB = 0x0100,
>> +static const USBDescDevice desc_device_mouse_full = {
>> + .bcdUSB = 0x0200,
>> + .bMaxPacketSize0 = 8,
>> + .bNumConfigurations = 1,
>> + .confs = (USBDescConfig[]) {
>> + {
>> + .bNumInterfaces = 1,
>> + .bConfigurationValue = 1,
>> + .iConfiguration = STR_CONFIG_MOUSE_FULL,
>> + .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
>> + .bMaxPower = 50,
>> + .nif = 1,
>> + .ifs = &desc_iface_mouse_full,
>> + },
>> + },
>> +};
>> +
>> +static const USBDescDevice desc_device_mouse_high = {
>> + .bcdUSB = 0x0200,
>> .bMaxPacketSize0 = 8,
>> .bNumConfigurations = 1,
>> .confs = (USBDescConfig[]) {
>> {
>> .bNumInterfaces = 1,
>> .bConfigurationValue = 1,
>> - .iConfiguration = STR_CONFIG_MOUSE,
>> + .iConfiguration = STR_CONFIG_MOUSE_HIGH,
>> .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
>> .bMaxPower = 50,
>> .nif = 1,
>> - .ifs = &desc_iface_mouse,
>> + .ifs = &desc_iface_mouse_high,
>> },
>> },
>> };
>> @@ -274,7 +324,8 @@ static const USBDesc desc_mouse = {
>> .iProduct = STR_PRODUCT_MOUSE,
>> .iSerialNumber = STR_SERIALNUMBER,
>> },
>> - .full = &desc_device_mouse,
>> + .full = &desc_device_mouse_full,
>> + .high = &desc_device_mouse_high,
>> .str = desc_strings,
>> .msos = &desc_msos_suspend,
>> };
>> @@ -676,6 +727,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);
>> @@ -686,6 +742,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
>> uc->product_desc = "QEMU USB Mouse";
>> uc->usb_desc = &desc_mouse;
>> dc->vmsd = &vmstate_usb_ptr;
>> + dc->props = usb_mouse_properties;
>> set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
>> }
>>
>> --
>> 1.9.0
>>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration
2014-04-03 5:27 ` Ján Veselý
@ 2014-04-07 8:02 ` Gerd Hoffmann
[not found] ` <CA+K+NcQZf-__sqSBTewBooUTUWMDP_m34iDVQX7YsHtUzAwb6g@mail.gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2014-04-07 8:02 UTC (permalink / raw)
To: Ján Veselý; +Cc: QEMU
On Do, 2014-04-03 at 01:27 -0400, Ján Veselý wrote:
> ping2
>
> is there anything I can do to help these patches get merged?
Well, v2 is a step into the right direction but not complete yet. The
usb_ver property hasn't any effect for mouse and keyboard. Also we'll
need a compat property so older machine types continue to have usb1
mouse+keyboard.
The compat property stuff is a bit tricky so my plan was to just do that
myself, but I havn't found the time yet.
If you wanna tackle the challenge have a look at
427e3aa151c749225364d0c30640e2e3c1756d9d (tablet patch). keyboard+mouse
need to do the same.
Also some cleanups can be done, such as moving the "switch
(us->usb_version) { ... }" from usb_tablet_initfn to usb_hid_initfn to
avoid duplicating it.
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration
[not found] ` <1397629640.23535.7.camel@nilsson.home.kraxel.org>
@ 2014-09-11 4:57 ` Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH 1/3] usb-hid: Move descriptor decision to usb-hid initfn Jan Vesely
0 siblings, 1 reply; 12+ messages in thread
From: Jan Vesely @ 2014-09-11 4:57 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU
[-- Attachment #1: Type: text/plain, Size: 1784 bytes --]
Hi Gerd,
sorry for taking so long to get back to this. My schedule has been super
busy past couple of months.
I have rebased the patches and moved the usb version desc selection to
hid_initfn as you suggested. I also made the changes follow the tablet
example as closely as possible
I tested the patches on ubuntu 64 and fedora 64 liveCDs and both mouse
and keyboard still work ok.
thanks,
jan
On Wed, 2014-04-16 at 08:27 +0200, Gerd Hoffmann wrote:
> On Di, 2014-04-15 at 19:33 -0400, Ján Veselý wrote:
> > Hi,
> >
> > I found some more time to work on this. However, I'm not sure I
> > understand the purpose of compat property:
> > I noticed that the only place it's set is in PC_COMPAT_1_3 (is this
> > what you meant by older devices?),
>
> Older machine types, yes. This switches the tablet to usb1 by default
> if you start qemu with -M pc-1.3 (or older), because it was usb1 only in
> qemu 1.3 & older.
>
> > I guess same setting for FS mouse and kbd should be added there as well.
>
> They need to go to the (probably not added yet) PC_COMPAT_2_0.
>
> > The switch statement in usb_tablet_initfn selects between two
> > descriptor structures, however, these structures are almost identical
> > with the sole exception of .high field being set in the HS version
> > (desc_tablet2).
> >
> > So changing the switch statement to:
> > if (us->usb_version < 2)
> > dev->usb_desc->high = NULL;
> >
> > should be OK for all usb hid devices, right?
>
> No. That struct is shared between all device instances, so if you muck
> with it all devices are affected, i.e. this ...
>
> qemu -device usb-tablet,usb_ver=1 -device usb_tablet,usb_ver=2
>
> will not work correctly.
>
> cheers,
> Gerd
>
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 1/3] usb-hid: Move descriptor decision to usb-hid initfn
2014-09-11 4:57 ` Jan Vesely
@ 2014-09-11 4:58 ` Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH v3 2/3] usb-hid: Add high speed mouse configuration Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH 3/3] usb-hid: Add high speed keyboard configuration Jan Vesely
0 siblings, 2 replies; 12+ messages in thread
From: Jan Vesely @ 2014-09-11 4:58 UTC (permalink / raw)
To: Gerd Hoffmann, QEMU
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
hw/usb/dev-hid.c | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index 67a57f1..b3d02b2 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -566,9 +566,22 @@ static void usb_hid_handle_destroy(USBDevice *dev)
hid_free(&us->hid);
}
-static int usb_hid_initfn(USBDevice *dev, int kind)
+static int usb_hid_initfn(USBDevice *dev, int kind,
+ const USBDesc *usb1, const USBDesc *usb2)
{
USBHIDState *us = DO_UPCAST(USBHIDState, dev, dev);
+ switch (us->usb_version) {
+ case 1:
+ dev->usb_desc = usb1;
+ break;
+ case 2:
+ dev->usb_desc = usb2;
+ break;
+ default:
+ error_report("Invalid usb version %d for hid device (must be 1 or 2)",
+ us->usb_version);
+ return -1;
+ }
if (dev->serial) {
usb_desc_set_string(dev, STR_SERIALNUMBER, dev->serial);
@@ -584,32 +597,17 @@ static int usb_hid_initfn(USBDevice *dev, int kind)
static int usb_tablet_initfn(USBDevice *dev)
{
- USBHIDState *us = DO_UPCAST(USBHIDState, dev, dev);
-
- switch (us->usb_version) {
- case 1:
- dev->usb_desc = &desc_tablet;
- break;
- case 2:
- dev->usb_desc = &desc_tablet2;
- break;
- default:
- error_report("Invalid usb version %d for usb-tabler (must be 1 or 2)",
- us->usb_version);
- return -1;
- }
-
- return usb_hid_initfn(dev, HID_TABLET);
+ return usb_hid_initfn(dev, HID_TABLET, &desc_tablet, &desc_tablet2);
}
static int usb_mouse_initfn(USBDevice *dev)
{
- return usb_hid_initfn(dev, HID_MOUSE);
+ return usb_hid_initfn(dev, HID_MOUSE, &desc_mouse, &desc_mouse);
}
static int usb_keyboard_initfn(USBDevice *dev)
{
- return usb_hid_initfn(dev, HID_KEYBOARD);
+ return usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, &desc_keyboard);
}
static int usb_ptr_post_load(void *opaque, int version_id)
@@ -691,7 +689,6 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
usb_hid_class_initfn(klass, data);
uc->init = usb_mouse_initfn;
uc->product_desc = "QEMU USB Mouse";
- uc->usb_desc = &desc_mouse;
dc->vmsd = &vmstate_usb_ptr;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -716,7 +713,6 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
usb_hid_class_initfn(klass, data);
uc->init = usb_keyboard_initfn;
uc->product_desc = "QEMU USB Keyboard";
- uc->usb_desc = &desc_keyboard;
dc->vmsd = &vmstate_usb_kbd;
dc->props = usb_keyboard_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
--
1.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v3 2/3] usb-hid: Add high speed mouse configuration
2014-09-11 4:58 ` [Qemu-devel] [PATCH 1/3] usb-hid: Move descriptor decision to usb-hid initfn Jan Vesely
@ 2014-09-11 4:58 ` Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH 3/3] usb-hid: Add high speed keyboard configuration Jan Vesely
1 sibling, 0 replies; 12+ messages in thread
From: Jan Vesely @ 2014-09-11 4:58 UTC (permalink / raw)
To: Gerd Hoffmann, QEMU
v2: add usb_mouse_properties
use macros for bmAttributes
v3: rebase
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
hw/usb/dev-hid.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 1 deletion(-)
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index b3d02b2..643b013 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,
@@ -602,7 +665,7 @@ static int usb_tablet_initfn(USBDevice *dev)
static int usb_mouse_initfn(USBDevice *dev)
{
- return usb_hid_initfn(dev, HID_MOUSE, &desc_mouse, &desc_mouse);
+ return usb_hid_initfn(dev, HID_MOUSE, &desc_mouse, &desc_mouse2);
}
static int usb_keyboard_initfn(USBDevice *dev)
@@ -681,6 +744,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);
@@ -690,6 +758,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_mouse_initfn;
uc->product_desc = "QEMU USB Mouse";
dc->vmsd = &vmstate_usb_ptr;
+ dc->props = usb_mouse_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
--
1.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 3/3] usb-hid: Add high speed keyboard configuration
2014-09-11 4:58 ` [Qemu-devel] [PATCH 1/3] usb-hid: Move descriptor decision to usb-hid initfn Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH v3 2/3] usb-hid: Add high speed mouse configuration Jan Vesely
@ 2014-09-11 4:58 ` Jan Vesely
1 sibling, 0 replies; 12+ messages in thread
From: Jan Vesely @ 2014-09-11 4:58 UTC (permalink / raw)
To: Gerd Hoffmann, QEMU
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
---
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 643b013..ac7e393 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) */
@@ -670,7 +733,7 @@ static int usb_mouse_initfn(USBDevice *dev)
static int usb_keyboard_initfn(USBDevice *dev)
{
- return usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, &desc_keyboard);
+ return usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, &desc_keyboard2);
}
static int usb_ptr_post_load(void *opaque, int version_id)
@@ -770,6 +833,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(),
};
--
1.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-09-11 4:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 5:41 [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Jan Vesely
2014-02-16 5:41 ` [Qemu-devel] [PATCH 2/2] usb-hid: Add high speed keyboard configuration Jan Vesely
2014-02-17 12:10 ` [Qemu-devel] [PATCH 1/2] usb-hid: Add high speed mouse configuration Gerd Hoffmann
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 " Jan Vesely
2014-02-23 7:37 ` [Qemu-devel] [PATCH v2 2/2] usb-hid: Add high speed keyboard configuration Jan Vesely
2014-03-17 17:53 ` [Qemu-devel] [PATCH v2 1/2] usb-hid: Add high speed mouse configuration Ján Veselý
2014-04-03 5:27 ` Ján Veselý
2014-04-07 8:02 ` Gerd Hoffmann
[not found] ` <CA+K+NcQZf-__sqSBTewBooUTUWMDP_m34iDVQX7YsHtUzAwb6g@mail.gmail.com>
[not found] ` <1397629640.23535.7.camel@nilsson.home.kraxel.org>
2014-09-11 4:57 ` Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH 1/3] usb-hid: Move descriptor decision to usb-hid initfn Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH v3 2/3] usb-hid: Add high speed mouse configuration Jan Vesely
2014-09-11 4:58 ` [Qemu-devel] [PATCH 3/3] usb-hid: Add high speed keyboard configuration Jan Vesely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).