adb: fix read reg 3 byte ordering
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tue, 12 Jun 2018 16:44:00 +0000 (17:44 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Sat, 16 Jun 2018 06:32:33 +0000 (16:32 +1000)
According to the Apple ADB documentation, register 3 is a 2-byte register
with the device address in the first byte, and the handler ID in the second
byte.

This is currently the opposite away to which QEMU returns them so switch the
order around.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/input/adb-kbd.c
hw/input/adb-mouse.c

index 50b62712c858f2e4bc4c3e41a719771d3c4ae95f..0ad384dc893d9c02462223feef1ec803b4ed6f67 100644 (file)
@@ -290,8 +290,8 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
             olen = 2;
             break;
         case 3:
-            obuf[0] = d->handler;
-            obuf[1] = d->devaddr;
+            obuf[0] = d->devaddr;
+            obuf[1] = d->handler;
             olen = 2;
             break;
         }
index 3ba6027d336acd3715967632893ed9d1303472b2..473045fbacc3805e6e8b9e5ed856c54a9b47560e 100644 (file)
@@ -172,8 +172,8 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,
         case 1:
             break;
         case 3:
-            obuf[0] = d->handler;
-            obuf[1] = d->devaddr;
+            obuf[0] = d->devaddr;
+            obuf[1] = d->handler;
             olen = 2;
             break;
         }