From bed6803378b4e1eb258f3e5a25eb1be82e7117e5 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 24 Mar 2014 18:21:04 +0100 Subject: 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 --- hw/usb/dev-unifying.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'hw/usb/dev-unifying.c') 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(), }; -- cgit v1.2.1