[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 50/73] adb: change handler only when recognized
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 50/73] adb: change handler only when recognized |
Date: |
Fri, 28 Oct 2016 12:37:51 +1100 |
From: Hervé Poussineau <address@hidden>
ADB devices must take new handler into account only when they recognize it.
This lets operating systems probe for valid/invalid handles, to know device
capabilities.
Add a FIXME in keyboard handler, which should use a different translation
table depending of the selected handler.
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/input/adb.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/hw/input/adb.c b/hw/input/adb.c
index 3d39368..43d3205 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -396,9 +396,15 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
d->devaddr = buf[1] & 0xf;
break;
default:
- /* XXX: check this */
d->devaddr = buf[1] & 0xf;
- d->handler = buf[2];
+ /* we support handlers:
+ * 1: Apple Standard Keyboard
+ * 2: Apple Extended Keyboard (LShift = RShift)
+ * 3: Apple Extended Keyboard (LShift != RShift)
+ */
+ if (buf[2] == 1 || buf[2] == 2 || buf[2] == 3) {
+ d->handler = buf[2];
+ }
break;
}
}
@@ -437,6 +443,7 @@ static void adb_keyboard_event(DeviceState *dev,
QemuConsole *src,
if (qcode >= ARRAY_SIZE(qcode_to_adb_keycode)) {
return;
}
+ /* FIXME: take handler into account when translating qcode */
keycode = qcode_to_adb_keycode[qcode];
if (keycode == NO_KEY) { /* We don't want to send this to the guest */
ADB_DPRINTF("Ignoring NO_KEY\n");
@@ -631,8 +638,21 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,
d->devaddr = buf[1] & 0xf;
break;
default:
- /* XXX: check this */
d->devaddr = buf[1] & 0xf;
+ /* we support handlers:
+ * 0x01: Classic Apple Mouse Protocol / 100 cpi operations
+ * 0x02: Classic Apple Mouse Protocol / 200 cpi operations
+ * we don't support handlers (at least):
+ * 0x03: Mouse systems A3 trackball
+ * 0x04: Extended Apple Mouse Protocol
+ * 0x2f: Microspeed mouse
+ * 0x42: Macally
+ * 0x5f: Microspeed mouse
+ * 0x66: Microspeed mouse
+ */
+ if (buf[2] == 1 || buf[2] == 2) {
+ d->handler = buf[2];
+ }
break;
}
}
--
2.7.4
- [Qemu-ppc] [PULL 53/73] libqos: Move BAR assignment to common code, (continued)
- [Qemu-ppc] [PULL 53/73] libqos: Move BAR assignment to common code, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 54/73] libqos: Better handling of PCI legacy IO, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 51/73] libqos: Give qvirtio_config_read*() consistent semantics, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 62/73] libqos: Change PCI accessors to take opaque BAR handle, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 59/73] libqos: Add 64-bit PCI IO accessors, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 61/73] tests: Don't assume structure of PCI IO base in ahci-test, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 67/73] spapr: update spapr hotplug documentation, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 60/73] tests: Use qpci_mem{read, write} in ivshmem-test, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 57/73] libqos: Implement mmio accessors in terms of mem{read, write}, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 63/73] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 50/73] adb: change handler only when recognized,
David Gibson <=
- [Qemu-ppc] [PULL 68/73] spapr_events: add support for dedicated hotplug event source, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 72/73] spapr: Memory hot-unplug support, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 73/73] ppc: allow certain HV interrupts to be delivered to guests, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 22/73] ppc: add skiboot firmware for the pnv platform, David Gibson, 2016/10/28
- [Qemu-ppc] [PULL 01/73] pseries: Update SLOF firmware image to 20161019, David Gibson, 2016/10/28
- Re: [Qemu-ppc] [PULL 00/73] ppc-for-2.8 queue 20161028, Peter Maydell, 2016/10/28