From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQRr7-0002Tn-0s for qemu-devel@nongnu.org; Fri, 23 Jan 2009 14:38:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQRr6-0002SL-7L for qemu-devel@nongnu.org; Fri, 23 Jan 2009 14:38:16 -0500 Received: from [199.232.76.173] (port=50585 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQRr5-0002S6-P9 for qemu-devel@nongnu.org; Fri, 23 Jan 2009 14:38:15 -0500 Received: from smtp1-g21.free.fr ([212.27.42.1]:60744) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQRr4-0006gX-V7 for qemu-devel@nongnu.org; Fri, 23 Jan 2009 14:38:15 -0500 Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id 5E9C09401E9 for ; Fri, 23 Jan 2009 20:38:07 +0100 (CET) Received: from laptop (vaf26-2-82-244-111-82.fbx.proxad.net [82.244.111.82]) by smtp1-g21.free.fr (Postfix) with ESMTP id 6581F940105 for ; Fri, 23 Jan 2009 20:38:05 +0100 (CET) From: "=?utf-8?q?Fran=C3=A7ois?= Revol" Date: Fri, 23 Jan 2009 20:38:38 +0100 CET Message-Id: <16891468688-BeMail@laptop> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [RESENT][RFC][PATCH] Fix usb-wacom coord scales Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I didn't receive many comments on that yet... Anyone fancy testing it =3F Fran=C3=A7ois. ------ Forwarded Message: ------ To: qemu-devel@nongnu.org From: "Fran=C3=A7ois Revol" Subject: [PATCH] Fix usb-wacom coord scales Date: Tue, 20 Jan 2009 02:36:09 +0100 CET Hi, I already raised the issue some time ago: http://article.gmane.org/gmane.comp.emulators.qemu/28295 The wacom tablet code sends coords scaled to INT16=5FMAX, which seemed wrong as per the Haiku driver. At the time I wasn't sure if the maximum used in the driver was model specific or just some arbitrary value detected on a single item. It seems the Linux driver also agree on the maximum figures used in the Haiku driver: http://lxr.linux.no/linux+v2.6.28.1/drivers/input/tablet/wacom=5Fwac.c#L722 This patch makes sure the coordinates get scaled correctly. It also changes button mapping a bit, from the copy of the mouse code which ends up sending unused bits. It maps the middle button to the eraser, and the rigth button to 0x40 which in the Linux driver ends up to BTN=5FSTYLUS, and right button in the Haiku driver. I don't know how it affects TSLib though, can anyone please test =3F The coords are also sent when no button is pressed, it shouldn't break drivers that work already as they probably cache the coords, and allows sensible mouse moves when no button is pressed instead of jumping to the next click. Also, most tablets are able to report position of the stylus even when it's not yet touching the surface, though the Penpartner model doesn't seem to be such a model. This at least makes Haiku usable as guest with vnc and should help too with other OSes, even though I noticed we had a vmmouse driver somewhere we could use to use vmport instead of wacom. Again, can anyone validate with tslib =3F I tried to boot an unbuntu live CD I had but it ended up not detecting the wacom device, swapping and eventually rebooting my box after 20 minutes, so if anyone can test Linux too... Fran=C3=A7ois. Signed-off-by: Fran=C3=A7ois Revol Index: hw/usb-wacom.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- hw/usb-wacom.c (r=C3=A9vision 6369) +++ hw/usb-wacom.c (copie de travail) @@ -132,8 +132,9 @@ { USBWacomState *s =3D opaque; - s->x =3D x; - s->y =3D y; + /* scale to Penpartner resolution */ + s->x =3D (x * 5040 / 0x7FFF); + s->y =3D (y * 3780 / 0x7FFF); s->dz +=3D dz; s->buttons=5Fstate =3D buttons=5Fstate; } @@ -199,26 +200,22 @@ if (s->buttons=5Fstate & MOUSE=5FEVENT=5FLBUTTON) b |=3D 0x01; if (s->buttons=5Fstate & MOUSE=5FEVENT=5FRBUTTON) - b |=3D 0x02; + b |=3D 0x40; if (s->buttons=5Fstate & MOUSE=5FEVENT=5FMBUTTON) - b |=3D 0x04; + b |=3D 0x20; /* eraser */ if (len < 7) return 0; buf[0] =3D s->mode; - buf[5] =3D 0x00; - if (b) { - buf[1] =3D s->x & 0xff; - buf[2] =3D s->x >> 8; - buf[3] =3D s->y & 0xff; - buf[4] =3D s->y >> 8; + buf[5] =3D 0x00 | (b & 0xf0); + buf[1] =3D s->x & 0xff; + buf[2] =3D s->x >> 8; + buf[3] =3D s->y & 0xff; + buf[4] =3D s->y >> 8; + if (b & 0x3f) { buf[6] =3D 0; } else { - buf[1] =3D 0; - buf[2] =3D 0; - buf[3] =3D 0; - buf[4] =3D 0; buf[6] =3D (unsigned char) -127; }