Only send one SAMPLING command to the tablet for the last device. If
sampling is started before the last device was enabled, that device may not
work.

This is a quickfix, there is bound to be a better way to solve this but
meanwhile we might as well try to make the tablet work again.

Signed-off-by: Peter Hutterer <[email protected]>
---
With this and the calloc patch, my serial device works like a charm again.

 src/wcmISDV4.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index be10dff..44ab69c 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -35,7 +35,10 @@
 #define RESET_RELATIVE(ds) do { (ds).relwheel = 0; } while (0)
 
 typedef struct {
-       int initialized; /* QUERY can only be run once */
+       /* Counter for dependent devices. We can only send one QUERY command to
+          the tablet and we must not send the SAMPLING command until the last
+          device is enabled.  */
+       int initialized;
        int baudrate;
 } wcmISDV4Data;
 
@@ -326,7 +329,7 @@ static int isdv4GetRanges(LocalDevicePtr local)
 
        DBG(2, priv, "getting ISDV4 Ranges\n");
 
-       if (isdv4data->initialized)
+       if (isdv4data->initialized++)
                return ret;
 
        /* Send query command to the tablet */
@@ -465,13 +468,19 @@ static int isdv4GetRanges(LocalDevicePtr local)
 
        xf86Msg(X_INFO, "%s: serial tablet id 0x%X.\n", local->name, 
common->tablet_id);
 
-       isdv4data->initialized = 1;
-
        return ret;
 }
 
 static int isdv4StartTablet(LocalDevicePtr local)
 {
+       WacomDevicePtr priv = (WacomDevicePtr)local->private;
+       WacomCommonPtr common = priv->common;
+       wcmISDV4Data *isdv4data = common->private;
+
+
+       if (--isdv4data->initialized)
+               return Success;
+
        /* Tell the tablet to start sending coordinates */
        if (!wcmWriteWait(local, ISDV4_SAMPLING))
                return !Success;
@@ -481,6 +490,8 @@ static int isdv4StartTablet(LocalDevicePtr local)
 
 static int isdv4StopTablet(LocalDevicePtr local)
 {
+       WacomDevicePtr priv = (WacomDevicePtr)local->private;
+
        /* Send stop command to the tablet */
        if (!wcmWriteWait(local, ISDV4_STOP))
                return !Success;
-- 
1.7.1

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to