From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzDAm-0003TK-7A for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:38:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzDAk-0006LH-Vh for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:38:32 -0400 Date: Wed, 26 Oct 2016 11:07:47 +1100 From: David Gibson Message-ID: <20161026000747.GM11052@umbus.fritz.box> References: <1477378861-18062-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FC52J0nKTzya17Ed" Content-Disposition: inline In-Reply-To: <1477378861-18062-1-git-send-email-hpoussin@reactos.org> Subject: Re: [Qemu-devel] [PATCH] adb: change handler only when recognized List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Herv=E9?= Poussineau Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org --FC52J0nKTzya17Ed Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 25, 2016 at 09:01:01AM +0200, Herv=E9 Poussineau wrote: > ADB devices must take new handler into account only when they recognize i= t. > This lets operating systems probe for valid/invalid handles, to know devi= ce capabilities. >=20 > Add a FIXME in keyboard handler, which should use a different translation > table depending of the selected handler. >=20 > Signed-off-by: Herv=E9 Poussineau Applied to ppc-for-2.8, thanks. > --- > hw/input/adb.c | 26 +++++++++++++++++++++++--- > 1 file changed, 23 insertions(+), 3 deletions(-) >=20 > 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 *ob= uf, > d->devaddr =3D buf[1] & 0xf; > break; > default: > - /* XXX: check this */ > d->devaddr =3D buf[1] & 0xf; > - d->handler =3D buf[2]; > + /* we support handlers: > + * 1: Apple Standard Keyboard > + * 2: Apple Extended Keyboard (LShift =3D RShift) > + * 3: Apple Extended Keyboard (LShift !=3D RShift) > + */ > + if (buf[2] =3D=3D 1 || buf[2] =3D=3D 2 || buf[2] =3D=3D = 3) { > + d->handler =3D buf[2]; > + } > break; > } > } > @@ -437,6 +443,7 @@ static void adb_keyboard_event(DeviceState *dev, Qemu= Console *src, > if (qcode >=3D ARRAY_SIZE(qcode_to_adb_keycode)) { > return; > } > + /* FIXME: take handler into account when translating qcode */ > keycode =3D qcode_to_adb_keycode[qcode]; > if (keycode =3D=3D NO_KEY) { /* We don't want to send this to the g= uest */ > ADB_DPRINTF("Ignoring NO_KEY\n"); > @@ -631,8 +638,21 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *= obuf, > d->devaddr =3D buf[1] & 0xf; > break; > default: > - /* XXX: check this */ > d->devaddr =3D buf[1] & 0xf; > + /* we support handlers: > + * 0x01: Classic Apple Mouse Protocol / 100 cpi operatio= ns > + * 0x02: Classic Apple Mouse Protocol / 200 cpi operatio= ns > + * 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] =3D=3D 1 || buf[2] =3D=3D 2) { > + d->handler =3D buf[2]; > + } > break; > } > } --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --FC52J0nKTzya17Ed Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYD/PTAAoJEGw4ysog2bOS53oP+gPVkBcDcHmolWuwBWtsDuPN 3yN/lKAGfa3vvh1+URjh2PuW/5KXoxPEpwC4PofMaESnHnXkr917gjoPf4rGQ17B qZWzk8xwkIOtxfIalPSyGqTVwu3HahNA3wSwsFgc9Pw1vkeDrXEQjEYUhKMkr8aU 5sHiVUeYcxV6Z0V/qFehwQ1JldQvZzBnX13xB9+VFHL7caJtv4zcu6L9gCHll45Q SwR+n1X8m8JOfoLff6NOXfddnp8BdpVCtHN6OA09ULWEccfrrwOZiQflu/SaKRhZ R/DSqFDS+wEJmEh0N2XAGuBm3Nv2Ro3j8o3HZGtIEx7CWVf+Oa6LHw6kFBO4yXgJ Q9rZ/FgyVVCEfM4JuODTw0psLIQvSLzuU5HIvGkYKh8MhklocBn/6HdXBUSfyBiu QNAk35+gEU96awD9L70PDfiV8K9jbrLDzYoYg7MK6gYnUUZ1kOSaM20EMBwF/YYI oT4ZNCjn0jorAl3UAzDYzyyHwb+7VxYEr46jqAAEnYiffJwVPTolVosP17Di4aE2 BglCQZrrBHaFmUvn1190+Mm1ZK6lVw03GZgrv2a9gzWqNFgzZCPIumq9rbRe/5Jh CCycwV1I/kRXvj4G1rNmSv5Is2t4ODftHPzkA/DGKDg9tz6cUiL9lB8I/QqMct6q gpNAVqKx397I6Tel8lpM =Unzn -----END PGP SIGNATURE----- --FC52J0nKTzya17Ed--