If the device is unplugged, the fd triggers in select/poll/... but comes back with ENODEV. This triggers a lot of error messages in the log until finally the udev code catches up with us and the device is removed properly.
Catch that case by removing the fd from the select() set so we don't get triggered to call read_input on it anymore. https://sourceforge.net/p/linuxwacom/bugs/337/ Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- src/xf86Wacom.c | 12 +++++++++--- src/xf86Wacom.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c index 738690f..1eb3f57 100644 --- a/src/xf86Wacom.c +++ b/src/xf86Wacom.c @@ -632,7 +632,8 @@ static void wcmDevReadInput(InputInfoPtr pInfo) if (!wcmReady(pInfo)) break; /* dispatch */ - wcmReadPacket(pInfo); + if (!wcmReadPacket(pInfo)) + break; } #ifdef DEBUG @@ -649,7 +650,7 @@ static void wcmDevReadInput(InputInfoPtr pInfo) #endif } -void wcmReadPacket(InputInfoPtr pInfo) +Bool wcmReadPacket(InputInfoPtr pInfo) { WacomDevicePtr priv = (WacomDevicePtr)pInfo->private; WacomCommonPtr common = priv->common; @@ -672,7 +673,10 @@ void wcmReadPacket(InputInfoPtr pInfo) if (errno != EAGAIN && errno != EINTR) LogMessageVerbSigSafe(X_ERROR, 0, "%s: Error reading wacom device : %s\n", pInfo->name, strerror(errno)); - return; + if (errno == ENODEV) + xf86RemoveEnabledDevice(pInfo); + + return FALSE; } /* account for new data */ @@ -704,6 +708,8 @@ void wcmReadPacket(InputInfoPtr pInfo) } common->bufpos = len; + + return TRUE; } int wcmDevChangeControl(InputInfoPtr pInfo, xDeviceCtl * control) diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index afb4e9e..ccc2d56 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -120,7 +120,7 @@ char *wcmEventAutoDevProbe (InputInfoPtr pInfo); int wcmInitTablet(InputInfoPtr pInfo, const char* id, float version); /* standard packet handler */ -void wcmReadPacket(InputInfoPtr pInfo); +Bool wcmReadPacket(InputInfoPtr pInfo); /* handles suppression, filtering, and dispatch. */ void wcmEvent(WacomCommonPtr common, unsigned int channel, const WacomDeviceState* ds); -- 2.13.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel