We get absinfo.maximum = 0 when the ABS_ is not set in the
kernel, which is invalid.

This issue was found when I work on the resolution. It applies to
other ABS_* as well.

Signed-off-by: Ping Cheng <[email protected]>
---
 src/wcmUSB.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 4aae452..9eea020 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -497,7 +497,8 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
 
        /* max finger strip X for tablets with Expresskeys
         * or physical X for touch devices in hundredths of a mm */
-       if (ioctl(pInfo->fd, EVIOCGABS(ABS_RX), &absinfo) == 0)
+       if (ISBITSET(abs, ABS_RX) && 
+                       !ioctl(pInfo->fd, EVIOCGABS(ABS_RX), &absinfo))
        {
                if (is_touch)
                        common->wcmTouchResolX =
@@ -509,7 +510,8 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
 
        /* max finger strip Y for tablets with Expresskeys
         * or physical Y for touch devices in hundredths of a mm */
-       if (ioctl(pInfo->fd, EVIOCGABS(ABS_RY), &absinfo) == 0)
+       if (ISBITSET(abs, ABS_RY) &&
+                       !ioctl(pInfo->fd, EVIOCGABS(ABS_RY), &absinfo))
        {
                if (is_touch)
                        common->wcmTouchResolY =
@@ -520,11 +522,13 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
        }
 
        /* max z cannot be configured */
-       if (ioctl(pInfo->fd, EVIOCGABS(ABS_PRESSURE), &absinfo) == 0)
+       if (ISBITSET(abs, ABS_PRESSURE) &&
+                       !ioctl(pInfo->fd, EVIOCGABS(ABS_PRESSURE), &absinfo))
                common->wcmMaxZ = absinfo.maximum;
 
        /* max distance */
-       if (ioctl(pInfo->fd, EVIOCGABS(ABS_DISTANCE), &absinfo) == 0)
+       if (ISBITSET(abs, ABS_DISTANCE) &&
+                       !ioctl(pInfo->fd, EVIOCGABS(ABS_DISTANCE), &absinfo))
                common->wcmMaxDist = absinfo.maximum;
 
        if (ISBITSET(abs, ABS_MT_SLOT))
-- 
1.7.4


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to