On Sun, Dec 13, 2009 at 9:38 PM, Peter Hutterer <[email protected]>wrote:
> On Fri, Dec 11, 2009 at 02:11:34PM -0800, Ping wrote: > > > need to look at the code but I noticed here we check for that option > twice, > > > once in wcmUSB.c, once in wcmValidateDevice. may be something to keep > an > > > eye > > > on? > > > > > > > The check is needed for both files. In wcmValidateDevice.c, it is to > > initialize the value for all devices that are defined in xorg.conf. > Later > > on in wcmUSB.c (and wcmISDV4.c as well), they are reassigned due the > > possible changes in device specific features. > > > > Let me know if this confuses you more. > > it does, a bit anyway. > the device-specific features are the enabling of touch, etc. based on the > device's capabilities, right? (like the hunk below). > > AIUI, these capabilities don't change during the runtime of a device. if > so, > usbWcmInit is the wrong place to put the checks, it's called every time the > device is opened and that seems a bit excessive. I see your point. We can easily move this to wcmValidateDevice.c for USB. But it would be a challenge for ISDV4 devices since the driver may not get the accurate feature until it talks to the device directly in Wacom mode. Anyway, I made a clean, I think :), patch. ISDV4 would need more work later. But this patch covers the ISDV4 devices that we see in the market now. > (also, it looks like this > is the cause for the touch property being overwritten when you resume from > suspend :) > Unfortunately, your "kill two birds with one stone" plan did not work :). The property resume issue stays even with the new patch. In fact, if you hardcode both wcmTouch and wcmTouchDefault to 1 without changing it anywhere else in the driver, wcmTouch got changed to 0 after the system resumes. I am running a 64 bit system. Maybe that makes a difference? Something fishy in InitWcmAtom. I think what we need here is something similar to the EvdevProbe() function > - a function that opens the device, checks the capabilities and sets the > required flags so that xf86WcmDevOpen and it's childs can be reduced to > little more than fd = open(device). > Let me know if my solution is acceptable or not. It is only called once now if that was your major concern. Ping
From 5df49f641cb331646f6cbfb0975a9661f23e7a4e Mon Sep 17 00:00:00 2001 From: Ping Cheng <[email protected]> Date: Mon, 14 Dec 2009 13:04:04 -0800 Subject: [PATCH] Set Touch and Gesture options during the configuration We moved the touch and gesture option check from usbWcmInit to wcmValidateDevice.c since usbWcmInit gets called every time the device is opened, which is unnecessary for option check in most cases. The Tablet PC Button option should also be dealt in the same way. But it requires extra defines to make it clean, which will affect more files in the driver. We'll do it in a separate patch later. Signed-off-by: Ping Cheng <[email protected]> --- src/wcmConfig.c | 37 ++++++++++++++++++++++++++++++++++++- src/wcmISDV4.c | 16 ---------------- src/wcmUSB.c | 25 +------------------------ src/wcmValidateDevice.c | 7 ------- 4 files changed, 37 insertions(+), 48 deletions(-) diff --git a/src/wcmConfig.c b/src/wcmConfig.c index 9a51596..cf7f2ab 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -37,6 +37,7 @@ extern void wcmHotplugOthers(LocalDevicePtr local, unsigned long* keys); extern int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys); static int xf86WcmAllocate(LocalDevicePtr local, char* name, int flag); +static void wcmDeviceSpecCommonOptions(LocalDevicePtr local, unsigned long* keys); /***************************************************************************** * xf86WcmAllocate -- @@ -312,6 +313,37 @@ static Bool xf86WcmMatchDevice(LocalDevicePtr pMatch, LocalDevicePtr pLocal) return 0; } +/* retrieve the specific options for the device */ +static void wcmDeviceSpecCommonOptions(LocalDevicePtr local, unsigned long* keys) +{ + WacomDevicePtr priv = (WacomDevicePtr)local->private; + WacomCommonPtr common = priv->common; + + /* a single touch device */ + if (ISBITSET (keys, BTN_TOOL_DOUBLETAP)) + { + /* TouchDefault was off for all devices + * except when touch is supported */ + common->wcmTouchDefault = 1; + } + + /* 2FG touch device */ + if (ISBITSET (keys, BTN_TOOL_TRIPLETAP)) + { + /* GestureDefault was off for all devices + * except when multi-touch is supported */ + common->wcmGestureDefault = 1; + } + + /* check if touch was turned off in xorg.conf */ + common->wcmTouch = xf86SetBoolOption(local->options, "Touch", + common->wcmTouchDefault); + + /* Touch gesture applies to the whole tablet */ + common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", + common->wcmGestureDefault); +} + /* xf86WcmInit - called for each input devices with the driver set to * "wacom" */ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) @@ -384,7 +416,10 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) } } - /* Process the common options. */ + /* update device specific common options */ + wcmDeviceSpecCommonOptions(local, keys); + + /* Process the general common options. */ xf86ProcessCommonOptions(local, local->options); if (!wcmParseOptions(local)) goto SetupProc_fail; diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c index 4c24f5f..963d6ef 100644 --- a/src/wcmISDV4.c +++ b/src/wcmISDV4.c @@ -362,23 +362,7 @@ static int isdv4GetRanges(LocalDevicePtr local) (int)(1 << data[1]); if (data[1]) - { common->wcmTouchResolX = common->wcmTouchResolY = 10; - common->wcmTouchDefault = 1; - } - else - common->wcmTouchDefault = 0; - - /* update touch info */ - common->wcmTouch = xf86SetBoolOption(local->options, "Touch", - common->wcmTouchDefault); - - if ((common->tablet_id == 0xE2) || - (common->tablet_id == 0xE3)) - common->wcmGestureDefault = 1; - - common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", - common->wcmGestureDefault); common->wcmVersion = ( data[10] | (data[9] << 7) ); ret = Success; diff --git a/src/wcmUSB.c b/src/wcmUSB.c index b5b69a3..ff5d875 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -535,28 +535,13 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) common->wcmResolY = WacomModelDesc [i].yRes; } - /* a single touch device */ - if (ISBITSET (keys, BTN_TOOL_DOUBLETAP)) - { - /* TouchDefault was off for all devices - * except when touch is supported */ - common->wcmTouchDefault = 1; - } - else if (common->wcmModel && + if (common->wcmModel && strstr(common->wcmModel->name, "TabletPC")) { /* For penabled Tablet PCs, Tablet PC Button * are on by default */ common->wcmTPCButtonDefault = 1; } - - /* 2FG touch device */ - if (ISBITSET (keys, BTN_TOOL_TRIPLETAP)) - { - /* GestureDefault was off for all devices - * except when multi-touch is supported */ - common->wcmGestureDefault = 1; - } } if (!common->wcmModel) @@ -565,14 +550,6 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) common->wcmResolX = common->wcmResolY = 1016; } - /* check if touch was turned off in xorg.conf */ - common->wcmTouch = xf86SetBoolOption(local->options, "Touch", - common->wcmTouchDefault); - - /* Touch gesture applies to the whole tablet */ - common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", - common->wcmGestureDefault); - /* check if TPCButton was turned off in xorg.conf for pen */ if (priv->flags & STYLUS_ID) common->wcmTPCButton = xf86SetBoolOption(local->options, diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 53d435f..52ce1f8 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -615,13 +615,6 @@ int wcmParseOptions(LocalDevicePtr local) "TPCButton", common->wcmTPCButtonDefault); - /* Touch applies to the whole tablet */ - common->wcmTouch = xf86SetBoolOption(local->options, "Touch", common->wcmTouchDefault); - - /* Touch gesture applies to the whole tablet */ - common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", - common->wcmGestureDefault); - /* Touch capacity applies to the whole tablet */ common->wcmCapacity = xf86SetBoolOption(local->options, "Capacity", common->wcmCapacityDefault); -- 1.6.5.2
------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev
_______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
