Input is now handled in a separate thread in the server when a device is added through xf86AddEnabledDevice(). Previously that was in a sigio handler and we have a bunch of workarounds to avoid calling things from within the signal handler. With the new API these aren't needed, so split those callbacks and call them directly where needed.
Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- src/wcmXCommand.c | 50 ++++++++++++++++++++++++++++++++++++-------------- src/xf86Wacom.h | 4 ++++ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 346ff61..02278ba 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -612,36 +612,43 @@ void wcmUpdateRotationProperty(WacomDevicePtr priv) } } -static CARD32 -touchTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) +static void +wcmSetHWTouchProperty(InputInfoPtr pInfo) { - InputInfoPtr pInfo = arg; WacomDevicePtr priv = pInfo->private; WacomCommonPtr common = priv->common; XIPropertyValuePtr prop; CARD8 prop_value; - int sigstate; int rc; - sigstate = xf86BlockSIGIO(); - rc = XIGetDeviceProperty(pInfo->dev, prop_hardware_touch, &prop); if (rc != Success || prop->format != 8 || prop->size != 1) { xf86Msg(X_ERROR, "%s: Failed to update hardware touch state.\n", pInfo->name); - return 0; + return; } prop_value = common->wcmHWTouchSwitchState; XIChangeDeviceProperty(pInfo->dev, prop_hardware_touch, XA_INTEGER, prop->format, PropModeReplace, prop->size, &prop_value, TRUE); +} + +#if !HAVE_THREADED_INPUT +static CARD32 +touchTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) +{ + InputInfoPtr pInfo = arg; + int sigstate = xf86BlockSIGIO(); + + wcmSetHWTouchProperty(pInfo); xf86UnblockSIGIO(sigstate); return 0; } +#endif /** * Update HW touch property when its state is changed by touch switch @@ -656,10 +663,14 @@ wcmUpdateHWTouchProperty(WacomDevicePtr priv, int hw_touch) common->wcmHWTouchSwitchState = hw_touch; +#if HAVE_THREADED_INPUT + wcmSetHWTouchProperty(priv->pInfo); +#else /* This function is called during SIGIO. Schedule timer for property * event delivery outside of signal handler. */ priv->touch_timer = TimerSet(priv->touch_timer, 0 /* reltime */, 1, touchTimerFunc, priv->pInfo); +#endif } /** @@ -1014,24 +1025,20 @@ int wcmGetProperty (DeviceIntPtr dev, Atom property) return Success; } -static CARD32 -serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) +static void +wcmSetSerialProperty(InputInfoPtr pInfo) { - InputInfoPtr pInfo = arg; WacomDevicePtr priv = pInfo->private; XIPropertyValuePtr prop; CARD32 prop_value[5]; - int sigstate; int rc; - sigstate = xf86BlockSIGIO(); - rc = XIGetDeviceProperty(pInfo->dev, prop_serials, &prop); if (rc != Success || prop->format != 32 || prop->size != 5) { xf86Msg(X_ERROR, "%s: Failed to update serial number.\n", pInfo->name); - return 0; + return; } memcpy(prop_value, prop->data, sizeof(prop_value)); @@ -1041,11 +1048,22 @@ serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) XIChangeDeviceProperty(pInfo->dev, prop_serials, XA_INTEGER, prop->format, PropModeReplace, prop->size, prop_value, TRUE); +} + +#if !HAVE_THREADED_INPUT +static CARD32 +serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) +{ + InputInfoPtr pInfo = arg; + int sigstate = xf86BlockSIGIO(); + + wcmSetSerialProperty(pInfo); xf86UnblockSIGIO(sigstate); return 0; } +#endif void wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial, int id) @@ -1058,10 +1076,14 @@ wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial, int id) priv->cur_serial = serial; priv->cur_device_id = id; +#if HAVE_THREADED_INPUT + wcmSetSerialProperty(pInfo); +#else /* This function is called during SIGIO. Schedule timer for property * event delivery outside of signal handler. */ priv->serial_timer = TimerSet(priv->serial_timer, 0 /* reltime */, 1, serialTimerFunc, pInfo); +#endif } static void diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index 63a8623..afb4e9e 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -40,6 +40,10 @@ #define LogMessageVerbSigSafe xf86MsgVerb #endif +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23 +#define HAVE_THREADED_INPUT 1 +#endif + #ifndef SW_MUTE_DEVICE #define SW_MUTE_DEVICE 0x0e #endif -- 2.7.4 ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel