Gregor Richards wrote:
> Attached is a patch that makes linuxwacom-0.7.7-6 work with MultiTouch 
> input.
>
> The main problem with supporting MultiTouch on the new X60 Tablets is 
> that the MultiTouch input is only 5 bytes long, as opposed to the 9 
> bytes of most ISDV4 messages.
>
> To make this work, I had to hack up wcmISDV4.c to allow 5 or 9 byte 
> messages, depending on the message header (first byte), and of course 
> add support for the new messages.
>
> Furthermore, it doesn't calibrate the new input automatically - I 
> calibrated it manually /in code/. This works for me, and will even 
> probably work on other X60 Tablets, but won't work in the future.
>
> A few issues:
> * The driver is desperate to drag instead of just click. I don't know 
> how to change that sensitivity.
> * I believe this could cause problem with more "pure" ISDV4 tablets, 
> but can't test that.
>
> Please don't import this patch yet - it's just a proof of concept :)
>
> - Gregor Richards
>
> ------------------------------------------------------------------------
>
> diff -ru linuxwacom-0.7.7-6/src/xdrv/wcmISDV4.c 
> linuxwacom-0.7.7-6-multitouch/src/xdrv/wcmISDV4.c
> --- linuxwacom-0.7.7-6/src/xdrv/wcmISDV4.c    2007-02-20 17:21:02.000000000 
> -0800
> +++ linuxwacom-0.7.7-6-multitouch/src/xdrv/wcmISDV4.c 2007-03-24 
> 01:01:48.000000000 -0700
> @@ -107,7 +107,9 @@
>    
>       /* set parameters */
>       common->wcmProtocolLevel = 4;
> -     common->wcmPktLength = 9;       /* length of a packet */
> +     common->wcmPktLength = 5;       /* length of a packet */
> +                                     /* most packets are 9 bytes long,
> +                                      * some are only 5 */
>       common->wcmResolX = 2540;       /* tablet X resolution in points/inch */
>       common->wcmResolY = 2540;       /* tablet Y resolution in points/inch */
>       common->wcmTPCButton = 1;       /* Tablet PC buttons on by default */
> @@ -209,9 +211,27 @@
>  {
>       WacomDeviceState* last = &common->wcmChannel[0].valid.state;
>       WacomDeviceState* ds;
> -     int n, cur_type;
> +     int n, cur_type, ismt;
> +     ismt = 0;
>  
> -     if ((n = xf86WcmSerialValidate(common,data)) > 0)
> +     /* determine the type of message */
> +     if (data[0] & 0x10)
> +     {
> +             ismt = 1;
> +     }
> +     else
> +     {
> +             common->wcmPktLength = 9;
> +             if (common->buffer + common->bufpos - data < 9)
> +             {
> +                     /* we can't handle this yet */
> +                     return 0;
> +             }
> +     }
> +
> +     n = xf86WcmSerialValidate(common,data);
> +     common->wcmPktLength = 5;
> +     if (n > 0)
>       {
>               return n;
>       }
> @@ -225,6 +245,21 @@
>       ds = &common->wcmChannel[0].work;
>       RESET_RELATIVE(*ds);
>  
> +     if (ismt)
> +     {
> +             /* MultiTouch input is comparably simple */
> +             ds->proximity = (data[0] & 0x20);
> +             ds->x = (((((int)data[1]) << 7) | ((int)data[2])) - 18) * 
> common->wcmMaxX / 926;
> +             ds->y = (((((int)data[3]) << 7) | ((int)data[4])) - 51) * 
> common->wcmMaxY / 934;
> +             ds->pressure = (data[0] & 0x01) * common->wcmMaxZ;
> +             ds->buttons = 1;
> +             ds->device_id = STYLUS_DEVICE_ID;
> +             DBG(8, ErrorF("isdv4Parse MultiTouch %x p=%d\n", data[0], 
> ds->pressure));
> +             xf86WcmEvent(common,0,ds);
> +             return 5;
> +     }
> +
> +
>       ds->proximity = (data[0] & 0x20);
>  
>       /* x and y in "normal" orientetion (wide length is X) */
>   
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> Linuxwacom-discuss mailing list
> Linuxwacom-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-discuss
>   
Oops - discovered another problem.

When using the pen, it will accept both the proper pen input and the 
pressure input that the pen creates incidentally. They conflict a bit. 
Whoops :)

 - Gregor Richards


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linuxwacom-discuss mailing list
Linuxwacom-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-discuss

Reply via email to