diff options
author | Ping Cheng <pingc@wacom.com> | 2009-12-10 19:44:03 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-11 16:17:04 +1000 |
commit | e99834b9229734823fbe3fbc3618769224db6f37 (patch) | |
tree | 96f4e7aa80ca8b51a62138b3e28e92a70494adb5 /src | |
parent | a1c22a8457ad1902f313969e1f7822af61591c8f (diff) | |
download | xf86-input-wacom-e99834b9229734823fbe3fbc3618769224db6f37.tar.gz |
retrieve usb device and tool type from the kernel
Touch device can be decided by checking if BTN_TOOL_DOUBLETAP
is defined in the kernel or not
TPCButton is on for all penabled TabletPCs
Signed-off-by: Ping Cheng <pinglinux@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/wcmUSB.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 39894a1..2ec80b3 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -503,7 +503,6 @@ static struct Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) { int i; - int is_bamboo_touch; struct input_id sID; unsigned long keys[NBITS(KEY_MAX)]; WacomDevicePtr priv = (WacomDevicePtr)local->private; @@ -516,6 +515,13 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) ioctl(local->fd, EVIOCGID, &sID); ioctl(local->fd, EVIOCGNAME(sizeof(id)), id); + /* retrieve tool type, device type and buttons from the kernel */ + if (ioctl(local->fd, EVIOCGBIT(EV_KEY,sizeof(keys)),keys) < 0) + { + xf86Msg(X_ERROR, "%s: unable to ioctl key bits.\n", local->name); + return FALSE; + } + /* vendor is wacom */ if (sID.vendor == WACOM_VENDOR_ID) { @@ -529,28 +535,20 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) common->wcmResolY = WacomModelDesc [i].yRes; } - is_bamboo_touch = (common->tablet_id == 0xD0) || - (common->tablet_id == 0xD1) || - (common->tablet_id == 0xD2) || - (common->tablet_id == 0xD3); - - if (!common->wcmModel) - xf86Msg(X_ERROR, "this model is not supported\n"); - else if (strstr(common->wcmModel->name, "TabletPC") || is_bamboo_touch) + /* a single touch device */ + if (ISBITSET (keys, BTN_TOOL_DOUBLETAP)) { - if (common->tablet_id != 0x90) /* TabletPC 0x90 */ - { - /* TouchDefault was off for all devices */ - /* except when touch is supported */ - common->wcmTouchDefault = 1; - - } - - if (!is_bamboo_touch) - { - /* Tablet PC button applied to the whole tablet. Not just one tool */ - common->wcmTPCButtonDefault = 1; /* Tablet PC buttons on by default */ - } + /* TouchDefault was off for all devices */ + /* except when touch is supported */ + common->wcmTouchDefault = 1; + } + else if (common->wcmModel && + strstr(common->wcmModel->name, "TabletPC")) + { + /* Tablet PC button applied to the whole tablet. + * Not just one tool. + * For penabled TabletPCs. TabletPC is on by default */ + common->wcmTPCButtonDefault = 1; } } @@ -564,17 +562,11 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) common->wcmTouch = xf86SetBoolOption(local->options, "Touch", common->wcmTouchDefault); + /* check if TPCButton was turned off in xorg.conf for pen */ if (priv->flags & STYLUS_ID) common->wcmTPCButton = xf86SetBoolOption(local->options, "TPCButton", common->wcmTPCButtonDefault); - /* Determine max number of buttons */ - if (ioctl(local->fd, EVIOCGBIT(EV_KEY,sizeof(keys)),keys) < 0) - { - xf86Msg(X_ERROR, "%s: unable to ioctl key bits.\n", local->name); - return FALSE; - } - /* Find out supported button codes - except mouse button codes * BTN_LEFT and BTN_RIGHT, which are always fixed. */ common->npadkeys = 0; |