From 216c906e62626acc82427a00e9410ff39d9669a1 Mon Sep 17 00:00:00 2001 From: Hervé Poussineau Date: Sun, 7 Feb 2016 21:34:08 +0100 Subject: cuda: port SET_DEVICE_LIST command to new framework Also implement the command, by taking device list mask into account when polling ADB devices. Signed-off-by: Hervé Poussineau Reviewed-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/input/adb.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'hw/input') diff --git a/hw/input/adb.c b/hw/input/adb.c index c384856c13..f0ad0d4471 100644 --- a/hw/input/adb.c +++ b/hw/input/adb.c @@ -89,7 +89,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) } /* XXX: move that to cuda ? */ -int adb_poll(ADBBusState *s, uint8_t *obuf) +int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask) { ADBDevice *d; int olen, i; @@ -100,13 +100,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf) if (s->poll_index >= s->nb_devices) s->poll_index = 0; d = s->devices[s->poll_index]; - buf[0] = ADB_READREG | (d->devaddr << 4); - olen = adb_request(s, obuf + 1, buf, 1); - /* if there is data, we poll again the same device */ - if (olen > 0) { - obuf[0] = buf[0]; - olen++; - break; + if ((1 << d->devaddr) & poll_mask) { + buf[0] = ADB_READREG | (d->devaddr << 4); + olen = adb_request(s, obuf + 1, buf, 1); + /* if there is data, we poll again the same device */ + if (olen > 0) { + obuf[0] = buf[0]; + olen++; + break; + } } s->poll_index++; } -- cgit v1.2.3-55-g7522