* [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration
@ 2014-10-15 11:52 Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 1/4] usb-hid: Move descriptor decision to usb-hid initfn Gerd Hoffmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-15 11:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
usb patch queue, bringing high speed configurations for usb mouse &
keyboard, so you can hook them up to ehci without companion controllers.
Also a small xhci fix.
please pull,
Gerd
The following changes since commit b1d28ec6a7dbdaadda39d29322f0de694aeb0b74:
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20141010' into staging (2014-10-10 14:55:29 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-usb-20141015-2
for you to fetch changes up to ac20e1bb0e77cdf79c6e3f90ff910a46d8ca04c9:
xhci: remove dead code (2014-10-15 13:39:48 +0200)
----------------------------------------------------------------
usb: add high speed mouse & keyboard configuration
----------------------------------------------------------------
Gerd Hoffmann (1):
xhci: remove dead code
Jan Vesely (3):
usb-hid: Move descriptor decision to usb-hid initfn
usb-hid: Add high speed mouse configuration
usb-hid: Add high speed keyboard configuration
hw/usb/dev-hid.c | 174 +++++++++++++++++++++++++++++++++++++++++++++------
hw/usb/hcd-xhci.c | 6 --
include/hw/i386/pc.h | 8 +++
3 files changed, 162 insertions(+), 26 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/4] usb-hid: Move descriptor decision to usb-hid initfn
2014-10-15 11:52 [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Gerd Hoffmann
@ 2014-10-15 11:52 ` Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 2/4] usb-hid: Add high speed mouse configuration Gerd Hoffmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-15 11:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Vesely, Gerd Hoffmann
From: Jan Vesely <jano.vesely@gmail.com>
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-hid.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index 467ec86..5d37d63 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -566,9 +566,26 @@ static void usb_hid_handle_destroy(USBDevice *dev)
hid_free(&us->hid);
}
-static void usb_hid_initfn(USBDevice *dev, int kind)
+static void usb_hid_initfn(USBDevice *dev, int kind,
+ const USBDesc *usb1, const USBDesc *usb2,
+ Error **errp)
{
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:
+ dev->usb_desc = NULL;
+ }
+ if (!dev->usb_desc) {
+ error_setg(errp, "Invalid usb version %d for usb hid device",
+ us->usb_version);
+ return;
+ }
if (dev->serial) {
usb_desc_set_string(dev, STR_SERIALNUMBER, dev->serial);
@@ -583,32 +600,18 @@ static void usb_hid_initfn(USBDevice *dev, int kind)
static void usb_tablet_realize(USBDevice *dev, Error **errp)
{
- 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_setg(errp, "Invalid usb version %d for usb-tablet "
- "(must be 1 or 2)", us->usb_version);
- return;
- }
- usb_hid_initfn(dev, HID_TABLET);
+ usb_hid_initfn(dev, HID_TABLET, &desc_tablet, &desc_tablet2, errp);
}
static void usb_mouse_realize(USBDevice *dev, Error **errp)
{
- usb_hid_initfn(dev, HID_MOUSE);
+ usb_hid_initfn(dev, HID_MOUSE, &desc_mouse, NULL, errp);
}
static void usb_keyboard_realize(USBDevice *dev, Error **errp)
{
- usb_hid_initfn(dev, HID_KEYBOARD);
+ usb_hid_initfn(dev, HID_KEYBOARD, &desc_keyboard, NULL, errp);
}
static int usb_ptr_post_load(void *opaque, int version_id)
@@ -690,7 +693,6 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
usb_hid_class_initfn(klass, data);
uc->realize = usb_mouse_realize;
uc->product_desc = "QEMU USB Mouse";
- uc->usb_desc = &desc_mouse;
dc->vmsd = &vmstate_usb_ptr;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -715,7 +717,6 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
usb_hid_class_initfn(klass, data);
uc->realize = usb_keyboard_realize;
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.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/4] usb-hid: Add high speed mouse configuration
2014-10-15 11:52 [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 1/4] usb-hid: Move descriptor decision to usb-hid initfn Gerd Hoffmann
@ 2014-10-15 11:52 ` Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 3/4] usb-hid: Add high speed keyboard configuration Gerd Hoffmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-15 11:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Vesely, Gerd Hoffmann, Anthony Liguori, Michael S. Tsirkin
From: Jan Vesely <jano.vesely@gmail.com>
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
[ kraxel: fixup compat property to apply to 2.1 & older ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-hid.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++-
include/hw/i386/pc.h | 4 +++
2 files changed, 74 insertions(+), 1 deletion(-)
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);
}
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 77316d5..3b31749 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -306,6 +306,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.driver = "intel-hda",\
.property = "old_msi_addr",\
.value = "on",\
+ },{\
+ .driver = "usb-mouse",\
+ .property = "usb_version",\
+ .value = stringify(1),\
}
#define PC_COMPAT_2_0 \
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 3/4] usb-hid: Add high speed keyboard configuration
2014-10-15 11:52 [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 1/4] usb-hid: Move descriptor decision to usb-hid initfn Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 2/4] usb-hid: Add high speed mouse configuration Gerd Hoffmann
@ 2014-10-15 11:52 ` Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 4/4] xhci: remove dead code Gerd Hoffmann
2014-10-22 15:39 ` [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-15 11:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Vesely, Gerd Hoffmann, Anthony Liguori, Michael S. Tsirkin
From: Jan Vesely <jano.vesely@gmail.com>
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
[ kraxel: fixup compat property to apply to 2.1 & older ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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 \
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 4/4] xhci: remove dead code
2014-10-15 11:52 [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Gerd Hoffmann
` (2 preceding siblings ...)
2014-10-15 11:52 ` [Qemu-devel] [PULL 3/4] usb-hid: Add high speed keyboard configuration Gerd Hoffmann
@ 2014-10-15 11:52 ` Gerd Hoffmann
2014-10-22 15:39 ` [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-15 11:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index c556367..a27c9d3 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1608,12 +1608,6 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid,
"data might be lost\n");
}
- uint8_t ep = epid>>1;
-
- if (epid & 1) {
- ep |= 0x80;
- }
-
if (!xhci->slots[slotid-1].uport ||
!xhci->slots[slotid-1].uport->dev ||
!xhci->slots[slotid-1].uport->dev->attached) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration
2014-10-15 11:52 [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Gerd Hoffmann
` (3 preceding siblings ...)
2014-10-15 11:52 ` [Qemu-devel] [PULL 4/4] xhci: remove dead code Gerd Hoffmann
@ 2014-10-22 15:39 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2014-10-22 15:39 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 15 October 2014 12:52, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> usb patch queue, bringing high speed configurations for usb mouse &
> keyboard, so you can hook them up to ehci without companion controllers.
> Also a small xhci fix.
>
> please pull,
> Gerd
>
> The following changes since commit b1d28ec6a7dbdaadda39d29322f0de694aeb0b74:
>
> Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20141010' into staging (2014-10-10 14:55:29 +0100)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-usb-20141015-2
>
> for you to fetch changes up to ac20e1bb0e77cdf79c6e3f90ff910a46d8ca04c9:
>
> xhci: remove dead code (2014-10-15 13:39:48 +0200)
>
> ----------------------------------------------------------------
> usb: add high speed mouse & keyboard configuration
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-22 15:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15 11:52 [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 1/4] usb-hid: Move descriptor decision to usb-hid initfn Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 2/4] usb-hid: Add high speed mouse configuration Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 3/4] usb-hid: Add high speed keyboard configuration Gerd Hoffmann
2014-10-15 11:52 ` [Qemu-devel] [PULL 4/4] xhci: remove dead code Gerd Hoffmann
2014-10-22 15:39 ` [Qemu-devel] [PULL 0/4] usb: add high speed mouse & keyboard configuration Peter Maydell
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).