diff --git a/0001-Log-debug-messages-in-signal-safe-manner.patch b/0001-Log-debug-messages-in-signal-safe-manner.patch new file mode 100644 index 0000000..ea34c1b --- /dev/null +++ b/0001-Log-debug-messages-in-signal-safe-manner.patch @@ -0,0 +1,34 @@ +From e4c1af418fbfa615e7a34fdcf34a4a5083b41925 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 20 Aug 2012 12:14:28 +1000 +Subject: [PATCH] Log debug messages in signal-safe manner + +This is a rather broad brush, logging all messages in DBG() through the +signal-safe interface instead of just the ones that really need it. + +Signed-off-by: Peter Hutterer +Acked-by: Ping Cheng +(cherry picked from commit f4cf73dccf0bf9913c7fdd4e346f4dddefe493f0) +--- + src/xf86Wacom.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h +index 36be9d7..2475550 100644 +--- a/src/xf86Wacom.h ++++ b/src/xf86Wacom.h +@@ -61,9 +61,9 @@ + #define DBG(lvl, priv, ...) \ + do { \ + if ((lvl) <= priv->debugLevel) { \ +- xf86Msg(X_INFO, "%s (%d:%s): ", \ ++ LogMessageVerbSigSafe(X_INFO, -1, "%s (%d:%s): ", \ + ((WacomDeviceRec*)priv)->name, lvl, __func__); \ +- xf86Msg(X_NONE, __VA_ARGS__); \ ++ LogMessageVerbSigSafe(X_NONE, -1, __VA_ARGS__); \ + } \ + } while (0) + #else +-- +1.7.11.2 + diff --git a/0001-Pre-allocate-the-tap-timer.patch b/0001-Pre-allocate-the-tap-timer.patch new file mode 100644 index 0000000..744c394 --- /dev/null +++ b/0001-Pre-allocate-the-tap-timer.patch @@ -0,0 +1,64 @@ +From 56098aa711d5c043164d80aec13dd8c581ee51c1 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 23 Aug 2012 09:03:34 +1000 +Subject: [PATCH] Pre-allocate the tap timer + +wcmSingleFingerTap() is called during SIGIO, calling TimerSet(NULL, ...) +will malloc inside the signal handler and hang the box. + +Signed-off-by: Peter Hutterer +(cherry picked from commit a5864ce8884f98180773d4bb2effdb1097eb339d) +--- + src/wcmConfig.c | 2 ++ + src/wcmTouchFilter.c | 2 +- + src/xf86WacomDefs.h | 1 + + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/wcmConfig.c b/src/wcmConfig.c +index e7fea5b..42ae7e0 100644 +--- a/src/wcmConfig.c ++++ b/src/wcmConfig.c +@@ -102,6 +102,7 @@ static int wcmAllocate(InputInfoPtr pInfo) + + /* timers */ + priv->serial_timer = TimerSet(NULL, 0, 0, NULL, NULL); ++ priv->tap_timer = TimerSet(NULL, 0, 0, NULL, NULL); + + return 1; + +@@ -125,6 +126,7 @@ static void wcmFree(InputInfoPtr pInfo) + return; + + TimerFree(priv->serial_timer); ++ TimerFree(priv->tap_timer); + free(priv->tool); + wcmFreeCommon(&priv->common); + free(priv); +diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c +index d25608b..bf0ecec 100644 +--- a/src/wcmTouchFilter.c ++++ b/src/wcmTouchFilter.c +@@ -201,7 +201,7 @@ static void wcmSingleFingerTap(WacomDevicePtr priv) + common->wcmGestureMode = GESTURE_PREDRAG_MODE; + + /* Delay to detect possible drag operation */ +- TimerSet(NULL, 0, common->wcmGestureParameters.wcmTapTime, wcmSingleFingerTapTimer, priv); ++ TimerSet(priv->tap_timer, 0, common->wcmGestureParameters.wcmTapTime, wcmSingleFingerTapTimer, priv); + } + } + } +diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h +index 4ae6fe7..28047f0 100644 +--- a/src/xf86WacomDefs.h ++++ b/src/xf86WacomDefs.h +@@ -303,6 +303,7 @@ struct _WacomDeviceRec + Atom strip_actions[4]; + + OsTimerPtr serial_timer; /* timer used for serial number property update */ ++ OsTimerPtr tap_timer; /* timer used for tap timing */ + }; + + /****************************************************************************** +-- +1.7.11.2 + diff --git a/0001-Use-signal-safe-logging-patches-where-necessary.patch b/0001-Use-signal-safe-logging-patches-where-necessary.patch new file mode 100644 index 0000000..d4f1863 --- /dev/null +++ b/0001-Use-signal-safe-logging-patches-where-necessary.patch @@ -0,0 +1,221 @@ +From 8d5b61c37dbe30b80118c1f00df0a08de5c87b1c Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 May 2012 16:51:00 +1000 +Subject: [PATCH] Use signal-safe logging patches where necessary + +Signed-off-by: Peter Hutterer +Acked-by: Ping Cheng +(cherry picked from commit 7ac6e9b7f5441ff9fbe4902940209e9e2c2f1310) +--- + src/wcmCommon.c | 11 ++++++----- + src/wcmISDV4.c | 17 +++++++++-------- + src/wcmTouchFilter.c | 2 +- + src/wcmUSB.c | 24 ++++++++++++++---------- + src/xf86Wacom.c | 3 ++- + src/xf86Wacom.h | 5 +++++ + 6 files changed, 37 insertions(+), 25 deletions(-) + +diff --git a/src/wcmCommon.c b/src/wcmCommon.c +index c5b3d59..25378e8 100644 +--- a/src/wcmCommon.c ++++ b/src/wcmCommon.c +@@ -960,8 +960,8 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, + if (priv == NULL || !IsTouch(priv)) + { + priv = common->wcmDevices; +- xf86Msg(X_ERROR, "could not find touch device " +- "for device on %s.\n", common->device_path); ++ LogMessageVerbSigSafe(X_ERROR, 0, "could not find touch device " ++ "for device on %s.\n", common->device_path); + } + } + +@@ -1103,8 +1103,9 @@ normalizePressure(const WacomDevicePtr priv, const WacomDeviceState *ds) + + if (p < priv->minPressure) + { +- xf86Msg(X_ERROR, "%s: Pressure %d lower than expected minimum %d. This is a bug.\n", +- priv->pInfo->name, ds->pressure, priv->minPressure); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: Pressure %d lower than expected minimum %d. This is a bug.\n", ++ priv->pInfo->name, ds->pressure, priv->minPressure); + p = priv->minPressure; + } + +@@ -1190,7 +1191,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, + /* Tool on the tablet when driver starts. This sometime causes + * access errors to the device */ + if (!tool->enabled) { +- xf86Msg(X_ERROR, "tool not initialized yet. Skipping event. \n"); ++ LogMessageVerbSigSafe(X_ERROR, 0, "tool not initialized yet. Skipping event. \n"); + return; + } + +diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c +index 17f5326..37c8ee3 100644 +--- a/src/wcmISDV4.c ++++ b/src/wcmISDV4.c +@@ -110,12 +110,12 @@ static void memdump(InputInfoPtr pInfo, char *buffer, unsigned int len) + /* can't use DBG macro here, need to do it manually. */ + for (i = 0 ; i < len && common->debugLevel >= 10; i++) + { +- xf86Msg(X_NONE, "%#hhx ", buffer[i]); ++ LogMessageVerbSigSafe(X_NONE, 0, "%#hhx ", buffer[i]); + if (i % 8 == 7) +- xf86Msg(X_NONE, "\n"); ++ LogMessageVerbSigSafe(X_NONE, 0, "\n"); + } + +- xf86Msg(X_NONE, "\n"); ++ LogMessageVerbSigSafe(X_NONE, 0, "\n"); + #endif + } + +@@ -165,7 +165,7 @@ static int wcmSerialValidate(InputInfoPtr pInfo, const unsigned char* data) + if (!(data[0] & HEADER_BIT)) + { + n = wcmSkipInvalidBytes(data, common->wcmPktLength); +- xf86Msg(X_WARNING, ++ LogMessageVerbSigSafe(X_WARNING, 0, + "%s: missing header bit. skipping %d bytes.\n", + pInfo->name, n); + return n; +@@ -178,7 +178,7 @@ static int wcmSerialValidate(InputInfoPtr pInfo, const unsigned char* data) + n = wcmSkipInvalidBytes(&data[1], common->wcmPktLength - 1); + n += 1; /* the header byte we already checked */ + if (n != common->wcmPktLength) { +- xf86Msg(X_WARNING, "%s: bad data at %d v=%x l=%d\n", pInfo->name, ++ LogMessageVerbSigSafe(X_WARNING, 0, "%s: bad data at %d v=%x l=%d\n", pInfo->name, + n, data[n], common->wcmPktLength); + return n; + } +@@ -605,8 +605,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const unsigned char *data, + rc = isdv4ParseTouchData(data, len, common->wcmPktLength, &touchdata); + if (rc == -1) + { +- xf86Msg(X_ERROR, "%s: failed to parse touch data.\n", +- pInfo->name); ++ LogMessageVerbSigSafe(X_ERROR, 0, "%s: failed to parse touch data.\n", ++ pInfo->name); + return -1; + } + +@@ -676,7 +676,8 @@ static int isdv4ParsePenPacket(InputInfoPtr pInfo, const unsigned char *data, + + if (rc == -1) + { +- xf86Msg(X_ERROR, "%s: failed to parse coordinate data.\n", pInfo->name); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: failed to parse coordinate data.\n", pInfo->name); + return -1; + } + +diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c +index 0d1f950..d25608b 100644 +--- a/src/wcmTouchFilter.c ++++ b/src/wcmTouchFilter.c +@@ -248,7 +248,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel) + if (!IsTouch(priv)) + { + /* this should never happen */ +- xf86Msg(X_ERROR, "WACOM: No touch device found for %s \n", ++ LogMessageVerbSigSafe(X_ERROR, 0, "WACOM: No touch device found for %s \n", + common->device_path); + return; + } +diff --git a/src/wcmUSB.c b/src/wcmUSB.c +index 3ee5d8f..1a1951d 100644 +--- a/src/wcmUSB.c ++++ b/src/wcmUSB.c +@@ -802,8 +802,8 @@ static void usbParseEvent(InputInfoPtr pInfo, + /* space left? bail if not. */ + if (private->wcmEventCnt >= ARRAY_SIZE(private->wcmEvents)) + { +- xf86Msg(X_ERROR, "%s: usbParse: Exceeded event queue (%d) \n", +- pInfo->name, private->wcmEventCnt); ++ LogMessageVerbSigSafe(X_ERROR, 0, "%s: usbParse: Exceeded event queue (%d) \n", ++ pInfo->name, private->wcmEventCnt); + private->wcmEventCnt = 0; + return; + } +@@ -834,8 +834,9 @@ static void usbParseSynEvent(InputInfoPtr pInfo, + * but we never report a serial number with a value of 0 */ + if (event->value == 0) + { +- xf86Msg(X_ERROR, "%s: usbParse: Ignoring event from invalid serial 0\n", +- pInfo->name); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: usbParse: Ignoring event from invalid serial 0\n", ++ pInfo->name); + goto skipEvent; + } + +@@ -1097,8 +1098,9 @@ static int mod_buttons(int buttons, int btn, int state) + + if (btn >= sizeof(int) * 8) + { +- xf86Msg(X_ERROR, "%s: Invalid button number %d. Insufficient " +- "storage\n", __func__, btn); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: Invalid button number %d. Insufficient storage\n", ++ __func__, btn); + return buttons; + } + +@@ -1556,8 +1558,9 @@ static void usbDispatchEvents(InputInfoPtr pInfo) + channel_change |= 1; + } + else +- xf86Msg(X_ERROR, "%s: rel event recv'd (%d)!\n", +- pInfo->name, event->code); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: rel event recv'd (%d)!\n", ++ pInfo->name, event->code); + } + else if (event->type == EV_KEY) + { +@@ -1580,8 +1583,9 @@ static void usbDispatchEvents(InputInfoPtr pInfo) + rc = ioctl(common->fd, EVIOCGKEY(sizeof(keys)), keys); + if (rc == -1) + { +- xf86Msg(X_ERROR, "%s: failed to retrieve key bits\n", +- pInfo->name); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: failed to retrieve key bits\n", ++ pInfo->name); + return; + } + +diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c +index ba3753a..6581ab5 100644 +--- a/src/xf86Wacom.c ++++ b/src/xf86Wacom.c +@@ -652,7 +652,8 @@ void wcmReadPacket(InputInfoPtr pInfo) + /* for all other errors, hope that the hotplugging code will + * remove the device */ + if (errno != EAGAIN && errno != EINTR) +- xf86Msg(X_ERROR, "%s: Error reading wacom device : %s\n", pInfo->name, strerror(errno)); ++ LogMessageVerbSigSafe(X_ERROR, 0, ++ "%s: Error reading wacom device : %s\n", pInfo->name, strerror(errno)); + return; + } + +diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h +index 2e546eb..36be9d7 100644 +--- a/src/xf86Wacom.h ++++ b/src/xf86Wacom.h +@@ -37,6 +37,11 @@ + #include + #include + #include ++ ++#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18 ++#define LogMessageVerbSigSafe xf86MsgVerb ++#endif ++ + /***************************************************************************** + * Unit test hack + ****************************************************************************/ +-- +1.7.11.2 + diff --git a/xorg-x11-drv-wacom.spec b/xorg-x11-drv-wacom.spec index 7c0f023..15d76bd 100644 --- a/xorg-x11-drv-wacom.spec +++ b/xorg-x11-drv-wacom.spec @@ -9,7 +9,7 @@ Summary: Xorg X11 wacom input driver Name: xorg-x11-drv-wacom Version: 0.16.0 -Release: 5%{?gitdate:.%{gitdate}git%{gitversion}}%{dist} +Release: 6%{?gitdate:.%{gitdate}git%{gitversion}}%{dist} URL: http://www.x.org License: GPLv2+ Group: User Interface/X Hardware Support @@ -24,6 +24,9 @@ Source0: http://prdownloads.sourceforge.net/linuxwacom/xf86-input-wacom-%{versio Source3: 70-wacom.rules Patch01: 0001-Add-Cintiq-22HD.patch +Patch02: 0001-Use-signal-safe-logging-patches-where-necessary.patch +Patch03: 0001-Log-debug-messages-in-signal-safe-manner.patch +Patch04: 0001-Pre-allocate-the-tap-timer.patch ExcludeArch: s390 s390x %{?rhel:ppc ppc64} @@ -45,6 +48,9 @@ X.Org X11 wacom input driver for Wacom tablets. %prep %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}} %patch01 -p1 +%patch02 -p1 +%patch03 -p1 +%patch04 -p1 %build autoreconf --force -v --install || exit 1 @@ -101,6 +107,10 @@ X.Org X11 wacom input driver development files. %{_bindir}/isdv4-serial-debugger %changelog +* Thu Aug 23 2012 Peter Hutterer 0.16.0-6 +- Pre-allocate the tap timer to avoid malloc locks in SIGIO handler +- Log in signal-safe manner + * Sun Aug 05 2012 Peter Hutterer 0.16.0-5 - Align git snapshot building with other drivers - Add autotools/libtool to BuildRequires, we need those when building git