common->fd is intended to share the fd between different InputInfo structs,
and that is the only thing it should be used for. With server managed fds,
the fd management will all be done by the server and common->fd will never
get set, so nothing outside of wcmDevOpen / wcmDevClose should use it.

Signed-off-by: Hans de Goede <hdego...@redhat.com>
---
 src/wcmUSB.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index e22cd5e..002c986 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1531,11 +1531,11 @@ static int toolTypeToDeviceType(WacomCommonPtr common, 
int type, int code)
  * @param[in] common
  * @return            A tool type (e.g. STYLUS_ID) associated with the in-prox 
tool
  */
-static int refreshDeviceType(WacomCommonPtr common)
+static int refreshDeviceType(WacomCommonPtr common, int fd)
 {
        int device_type = 0;
        unsigned long keys[NBITS(KEY_MAX)] = { 0 };
-       int rc = ioctl(common->fd, EVIOCGKEY(sizeof(keys)), keys);
+       int rc = ioctl(fd, EVIOCGKEY(sizeof(keys)), keys);
        int i;
 
        if (rc == -1) {
@@ -1569,7 +1569,8 @@ static int refreshDeviceType(WacomCommonPtr common)
  *         if last_device_type is not a tool. If all else fails, '0'
  *         is returned.
  */
-static int usbInitToolType(WacomCommonPtr common, const struct input_event 
*event_ptr,
+static int usbInitToolType(WacomCommonPtr common, int fd,
+                           const struct input_event *event_ptr,
                            int nevents, int last_device_type)
 {
        int i, device_type = 0;
@@ -1583,7 +1584,7 @@ static int usbInitToolType(WacomCommonPtr common, const 
struct input_event *even
                device_type = last_device_type;
 
        if (!device_type)
-               device_type = refreshDeviceType(common);
+               device_type = refreshDeviceType(common, fd);
 
        return device_type;
 }
@@ -1617,7 +1618,7 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
 
        DBG(6, common, "%d events received\n", private->wcmEventCnt);
 
-       private->wcmDeviceType = usbInitToolType(common,
+       private->wcmDeviceType = usbInitToolType(common, pInfo->fd,
                                                 private->wcmEvents,
                                                 private->wcmEventCnt,
                                                 dslast.device_type);
-- 
1.9.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to