OK, found my issue with staying in absolute mode and its same issue
Jason/Ping already saw. I hadn't ported one patch related to case
when the Touch device happens to be first one processed by X driver.
The main issue is that USB devices are not opened until after return
from xf86WcmInit(). common->tablet_id is set only when you open USB
device and so you can not rely on its value inside xf86WcmInit().
There is work around code in linuxwacom's xf86WcmRegisterX11Devices()
that basically duplicates logic that exists in xf86WcmInit(). Instead
of duplicating logic, I'd prefer to get tablet_id set correctly at
this early phase.
Below is idea of my patch. If its approved, I'll resubmit as git
patch. Also, it would lay the path to centralize all the default
value inits in xf86WcmAllocate() instead of needing to have HW
specific values *after* that function call since it took so long to
get value of tablet_id.
Peter, there was one mention on list of you redo'ing/cleaning up logic
related to tablet_id. Does this patch conflict with your future
ideas?
Chris
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index df4529d..ac8fbaf 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -34,7 +34,8 @@ extern int wcmNeedAutoHotplug(LocalDevicePtr local,
extern int wcmAutoProbeDevice(LocalDevicePtr local);
extern int wcmParseOptions(LocalDevicePtr local, unsigned long* keys);
extern void wcmHotplugOthers(LocalDevicePtr local, unsigned long* keys);
-extern int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys);
+extern int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys,
+ int* tablet_id);
static int xf86WcmAllocate(LocalDevicePtr local, char* name, int flag);
@@ -328,6 +329,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr
drv, IDevPtr dev, int flags)
static int numberWacom = 0;
int need_hotplug = 0;
unsigned long keys[NBITS(KEY_MAX)];
+ int tablet_id;
gWacomModule.wcmDrv = drv;
@@ -343,7 +345,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr
drv, IDevPtr dev, int flags)
xf86CollectInputOptions(local, default_options, NULL);
/* initialize supported keys */
- wcmDeviceTypeKeys(local, keys);
+ wcmDeviceTypeKeys(local, keys, &tablet_id);
device = xf86SetStrOption(local->options, "Device", NULL);
type = xf86FindOptionValue(local->options, "Type");
@@ -370,6 +372,10 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr
drv, IDevPtr dev, int flags)
common->wcmDevice = device;
+ /* Hardware specific initialization relies on tablet_id. */
+ if (!common->tablet_id)
+ common->tablet_id = tablet_id;
+
/* Auto-probe the device if required, otherwise just noop. */
if (numberWacom)
if (!wcmAutoProbeDevice(local))
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 18d2a66..cb9a8a6 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -36,7 +36,8 @@ void wcmHotplugOthers(LocalDevicePtr local, unsigned
long* keys);
int wcmAutoProbeDevice(LocalDevicePtr local);
int wcmParseOptions(LocalDevicePtr local, unsigned long* keys);
int wcmIsDuplicate(char* device, LocalDevicePtr local);
-int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys);
+int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys,
+ int* tablet_id);
/* xf86WcmCheckSource - Check if there is another source defined this device
* before or not: don't add the tool by hal/udev if user has defined at least
@@ -179,13 +180,15 @@ Bool wcmIsAValidType(const char* type, unsigned
long* keys)
}
/* Choose valid types according to device ID */
-int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys)
+int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys,
+ int* tablet_id)
{
int ret = 1, i;
int fd = -1, id = 0;
char* device, *stopstring;
char* str = strstr(local->name, "WACf");
struct serial_struct tmp;
+ struct input_id wacom_id;
device = xf86SetStrOption(local->options, "Device", NULL);
@@ -260,7 +263,16 @@ int wcmDeviceTypeKeys(LocalDevicePtr local,
unsigned long* keys)
"ioctl USB key bits.\n", local->name);
ret = 0;
}
+ if (ioctl(fd, EVIOCGID, &wacom_id) < 0)
+ {
+ xf86Msg(X_ERROR, "%s: wcmDeviceTypeKeys unable to "
+ "ioctl Device ID.\n", local->name);
+ ret = 0;
+ }
+ else
+ *tablet_id = wacom_id.product;
}
+
close(fd);
return ret;
}
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel