summaryrefslogtreecommitdiff
path: root/hw/usb/dev-unifying.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-03-24 18:21:04 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-03-24 18:21:04 +0100
commitbed6803378b4e1eb258f3e5a25eb1be82e7117e5 (patch)
treecc86135437e90b11984a5a8c7aad91cb878707c0 /hw/usb/dev-unifying.c
parent2382e2c43c3386dab0a44f4cd90a351a91329a5c (diff)
downloadqemu-bed6803378b4e1eb258f3e5a25eb1be82e7117e5.tar.gz
unifying: allow keyboard to be disabled with nokbd
Used for debugging WinXP. Turns out that even usb-kbd is broken, so it must be the USB stack used by WinXP that is problematic. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw/usb/dev-unifying.c')
-rw-r--r--hw/usb/dev-unifying.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/hw/usb/dev-unifying.c b/hw/usb/dev-unifying.c
index c9364f089c..926e2f7e56 100644
--- a/hw/usb/dev-unifying.c
+++ b/hw/usb/dev-unifying.c
@@ -366,7 +366,9 @@ static void usb_ltunify_handle_reset(USBDevice *dev)
{
USBLtunifyState *s = (USBLtunifyState *) dev;
- hid_reset(&s->hid[IFACE_KBD]);
+ if (s->enable_kbd) {
+ hid_reset(&s->hid[IFACE_KBD]);
+ }
hid_reset(&s->hid[IFACE_MSE]);
hidpp_reset(s);
}
@@ -375,7 +377,12 @@ static void usb_ltunify_handle_control_hid(USBDevice *dev, USBPacket *p,
int request, int value, int index, int length, uint8_t *data)
{
USBLtunifyState *s = (USBLtunifyState *) dev;
- HIDState *hs = &s->hid[index];
+ HIDState *hs = NULL;
+
+ if (index == IFACE_KBD && !s->enable_kbd) {
+ goto fail;
+ }
+ hs = &s->hid[index];
switch (request) {
case HID_GET_REPORT:
@@ -569,7 +576,9 @@ static void usb_ltunify_handle_destroy(USBDevice *dev)
USBLtunifyState *s = (USBLtunifyState *) dev;
hid_free(&s->hid[IFACE_MSE]);
- hid_free(&s->hid[IFACE_KBD]);
+ if (s->enable_kbd) {
+ hid_free(&s->hid[IFACE_KBD]);
+ }
if (s->usb_dump_state) {
usb_dump_cleanup(s->usb_dump_state);
@@ -592,7 +601,9 @@ static int usb_ltunify_initfn(USBDevice *dev)
/* the receiver supports multiple HID devices. Let's load some even if not
* all of them are paired. */
- hid_init(&s->hid[IFACE_KBD], HID_KEYBOARD, usb_ltunify_hid_event);
+ if (s->enable_kbd) {
+ hid_init(&s->hid[IFACE_KBD], HID_KEYBOARD, usb_ltunify_hid_event);
+ }
hid_init(&s->hid[IFACE_MSE], HID_MOUSE, usb_ltunify_hid_event);
hidpp_init(s);
@@ -609,6 +620,7 @@ static const VMStateDescription vmstate_usb_ltunify = {
};
static Property usb_ltunify_properties[] = {
+ DEFINE_PROP_BOOL("kbd", USBLtunifyState, enable_kbd, true),
DEFINE_PROP_STRING("usbdump", USBLtunifyState, usbdump_filename),
DEFINE_PROP_END_OF_LIST(),
};