summaryrefslogtreecommitdiff
path: root/hw/usb/dev-unifying.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-03-19 15:18:50 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-03-19 15:18:50 +0100
commit198529586fff48da10e4c5d56c9a44db2b6a0a1d (patch)
tree573ee7ae04f3f96b0a24e666396ffef75eb0839a /hw/usb/dev-unifying.c
parent4e6cc45456993307d605dfe50b5e370ba93fac9d (diff)
downloadqemu-198529586fff48da10e4c5d56c9a44db2b6a0a1d.tar.gz
unifying: move mode to LHIdDevice, init/reset functionality
WIP (partially untested). Handle input reports, respond with HID events if there are no queued output reports. Implemented input report processing for receiver: 0x80 (Switch and Keep-Alive), 0x81 (Get Paired Devices). Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw/usb/dev-unifying.c')
-rw-r--r--hw/usb/dev-unifying.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/usb/dev-unifying.c b/hw/usb/dev-unifying.c
index e60a472ba7..e7e2bd600b 100644
--- a/hw/usb/dev-unifying.c
+++ b/hw/usb/dev-unifying.c
@@ -355,16 +355,21 @@ static void usb_ltunify_hid_event(HIDState *hs)
}
s = container_of(hs, USBLtunifyState, hid[ifnum]);
- usb_wakeup(s->intr[ifnum], 0);
+ /* TODO: devices can get unpaired. Move HIDState to LHidDevice! */
+ if (s->devices[ifnum].mode == LTUNIFY_MODE_HID) {
+ usb_wakeup(s->intr[ifnum], 0);
+ } else {
+ usb_wakeup(s->intr[IFACE_HIDPP], 0);
+ }
}
static void usb_ltunify_handle_reset(USBDevice *dev)
{
USBLtunifyState *s = (USBLtunifyState *) dev;
- s->mode = LTUNIFY_MODE_HID;
hid_reset(&s->hid[IFACE_KBD]);
hid_reset(&s->hid[IFACE_MSE]);
+ hidpp_reset(s);
}
static void usb_ltunify_handle_control_hid(USBDevice *dev, USBPacket *p,
@@ -569,6 +574,8 @@ static int usb_ltunify_initfn(USBDevice *dev)
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);
+
// TODO: API sucks...
s->usb_dump_state = usb_dump_init_alloc("/tmp/usbdump.pcap");
return 0;