summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2009-02-12 17:52:43 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2009-02-13 13:16:55 +1000
commit2a6c1d7a605e11189e4539db84b1c4da5707dbc6 (patch)
tree8a81acc203a52047a421f21c2be3e88248e80fcc /src
parent0f0743e3cfc2f7d288dfec3fba9bc093cbedf537 (diff)
Add descriptive messages for device-has-changed errs
As can be seen in e.g. bugs 19819 & 20025, it can be unclear what exactly caused a given "Device has changed - disabled" error. This patch adds some more specific messages to give a better clue on what exactly was seen to have changed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/evdev.c b/src/evdev.c
index e8c1e2c..408dafc 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1226,54 +1226,66 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare)
goto error;
}
- if (compare && strcmp(pEvdev->name, name))
+ if (compare && strcmp(pEvdev->name, name)) {
+ xf86Msg(X_ERROR, "%s: device name changed: %s != %s\n", pInfo->name, pEvdev->name, name);
goto error;
+ }
if (ioctl(pInfo->fd,
EVIOCGBIT(0, sizeof(bitmask)), bitmask) < 0) {
- xf86Msg(X_ERROR, "ioctl EVIOCGBIT failed: %s\n", strerror(errno));
+ xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno));
goto error;
}
- if (compare && memcmp(pEvdev->bitmask, bitmask, sizeof(bitmask)))
+ if (compare && memcmp(pEvdev->bitmask, bitmask, sizeof(bitmask))) {
+ xf86Msg(X_ERROR, "%s: device bitmask has changed\n", pInfo->name);
goto error;
+ }
if (ioctl(pInfo->fd,
EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask) < 0) {
- xf86Msg(X_ERROR, "ioctl EVIOCGBIT failed: %s\n", strerror(errno));
+ xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno));
goto error;
}
- if (compare && memcmp(pEvdev->rel_bitmask, rel_bitmask, sizeof(rel_bitmask)))
+ if (compare && memcmp(pEvdev->rel_bitmask, rel_bitmask, sizeof(rel_bitmask))) {
+ xf86Msg(X_ERROR, "%s: device rel_bitmask has changed\n", pInfo->name);
goto error;
+ }
if (ioctl(pInfo->fd,
EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask) < 0) {
- xf86Msg(X_ERROR, "ioctl EVIOCGBIT failed: %s\n", strerror(errno));
+ xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno));
goto error;
}
- if (compare && memcmp(pEvdev->abs_bitmask, abs_bitmask, sizeof(abs_bitmask)))
+ if (compare && memcmp(pEvdev->abs_bitmask, abs_bitmask, sizeof(abs_bitmask))) {
+ xf86Msg(X_ERROR, "%s: device abs_bitmask has changed\n", pInfo->name);
goto error;
+ }
if (ioctl(pInfo->fd,
EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask) < 0) {
- xf86Msg(X_ERROR, "ioctl EVIOCGBIT failed: %s\n", strerror(errno));
+ xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno));
goto error;
}
- if (compare && memcmp(pEvdev->key_bitmask, key_bitmask, sizeof(key_bitmask)))
+ if (compare && memcmp(pEvdev->key_bitmask, key_bitmask, sizeof(key_bitmask))) {
+ xf86Msg(X_ERROR, "%s: device key_bitmask has changed\n", pInfo->name);
goto error;
+ }
if (ioctl(pInfo->fd,
EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask) < 0) {
- xf86Msg(X_ERROR, "ioctl EVIOCGBIT failed: %s\n", strerror(errno));
+ xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno));
goto error;
}
- if (compare && memcmp(pEvdev->led_bitmask, led_bitmask, sizeof(led_bitmask)))
+ if (compare && memcmp(pEvdev->led_bitmask, led_bitmask, sizeof(led_bitmask))) {
+ xf86Msg(X_ERROR, "%s: device led_bitmask has changed\n", pInfo->name);
goto error;
+ }
memset(absinfo, 0, sizeof(absinfo));
@@ -1282,7 +1294,7 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare)
if (TestBit(i, abs_bitmask))
{
if (ioctl(pInfo->fd, EVIOCGABS(i), &absinfo[i]) < 0) {
- xf86Msg(X_ERROR, "ioctl EVIOCGABS failed: %s\n", strerror(errno));
+ xf86Msg(X_ERROR, "%s: ioctl EVIOCGABS failed: %s\n", pInfo->name, strerror(errno));
goto error;
}
/* ignore current position (value) in comparison (bug #19819) */
@@ -1290,8 +1302,10 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare)
}
}
- if (compare && memcmp(pEvdev->absinfo, absinfo, sizeof(absinfo)))
- goto error;
+ if (compare && memcmp(pEvdev->absinfo, absinfo, sizeof(absinfo))) {
+ xf86Msg(X_ERROR, "%s: device absinfo has changed\n", pInfo->name);
+ goto error;
+ }
/* cache info */
if (!compare)