Don't grab until the device is being enabled. This is a preparation work for the DEVICE_INIT, DEVICE_ON split.
Signed-off-by: Peter Hutterer <[email protected]> --- src/wcmUSB.c | 62 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index f8836fb..62a1d38 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -41,7 +41,7 @@ typedef struct { static Bool usbDetect(LocalDevicePtr); static Bool usbWcmInit(LocalDevicePtr pDev, char* id, float *version); - +static int usbStart(LocalDevicePtr local); static void usbInitProtocol5(WacomCommonPtr common, const char* id, float version); static void usbInitProtocol4(WacomCommonPtr common, const char* id, @@ -66,7 +66,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol5, /* assume the best */ NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, NULL, /* input filtering not needed */ usbDetectConfig, /* detect hardware buttons etc */ @@ -78,7 +78,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -90,7 +90,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -102,7 +102,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -114,7 +114,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -126,7 +126,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -138,7 +138,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -150,7 +150,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -162,7 +162,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -174,7 +174,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, NULL, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -186,7 +186,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, NULL, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -198,7 +198,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol5, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterIntuos, /* input filtering recommended */ usbDetectConfig, /* detect hardware buttons etc */ @@ -210,7 +210,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol5, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterIntuos, /* input filtering recommended */ usbDetectConfig, /* detect hardware buttons etc */ @@ -222,7 +222,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol5, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterIntuos, /* input filtering recommended */ usbDetectConfig, /* detect hardware buttons etc */ @@ -234,7 +234,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol5, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterIntuos, /* input filtering recommended */ usbDetectConfig, /* detect hardware buttons etc */ @@ -246,7 +246,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -258,7 +258,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterCoord, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -270,7 +270,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol5, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, wcmFilterIntuos, /* input filtering recommended */ usbDetectConfig, /* detect hardware buttons etc */ @@ -282,7 +282,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial); usbInitProtocol4, NULL, /* resolution not queried */ usbWcmGetRanges, - NULL, /* start not supported */ + usbStart, usbParse, NULL, /* input filtering */ usbDetectConfig, /* detect hardware buttons etc */ @@ -310,15 +310,29 @@ static Bool usbDetect(LocalDevicePtr local) xf86Msg(X_ERROR, "%s: usbDetect: can not ioctl version\n", local->name); return 0; } + + return 1; +} + +/***************************************************************************** + * usbStart -- + ****************************************************************************/ +static int +usbStart(LocalDevicePtr local) +{ + int err; + #ifdef EVIOCGRAB /* Try to grab the event device so that data don't leak to /dev/input/mice */ SYSCALL(err = ioctl(local->fd, EVIOCGRAB, (pointer)1)); - if (err < 0) - xf86Msg(X_ERROR, "%s: Wacom X driver can't grab event device, errno=%d\n", - local->name, errno); + /* this is called for all tools, so all but the first one fails with + * EBUSY */ + if (err < 0 && errno != EBUSY) + xf86Msg(X_ERROR, "%s: Wacom X driver can't grab event device (%s)\n", + local->name, strerror(errno)); #endif - return 1; + return Success; } /***************************************************************************** -- 1.7.0.1 ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
