Blob Blame History Raw
From 8d5b61c37dbe30b80118c1f00df0a08de5c87b1c Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 29 May 2012 16:51:00 +1000
Subject: [PATCH] Use signal-safe logging patches where necessary

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <pinglinux@gmail.com>
(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 <xf86Xinput.h>
 #include <mipointer.h>
 #include <X11/Xatom.h>
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
+#define LogMessageVerbSigSafe xf86MsgVerb
+#endif
+
 /*****************************************************************************
  * Unit test hack
  ****************************************************************************/
-- 
1.7.11.2