mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
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>
This commit is contained in:
committed by
Peter Hutterer
parent
0f0743e3cf
commit
2a6c1d7a60
50
src/evdev.c
50
src/evdev.c
@@ -1226,54 +1226,66 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (compare && strcmp(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));
|
||||
if (compare && strcmp(pEvdev->name, name)) {
|
||||
xf86Msg(X_ERROR, "%s: device name changed: %s != %s\n", pInfo->name, pEvdev->name, name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (compare && memcmp(pEvdev->bitmask, bitmask, sizeof(bitmask)))
|
||||
if (ioctl(pInfo->fd,
|
||||
EVIOCGBIT(0, sizeof(bitmask)), bitmask) < 0) {
|
||||
xf86Msg(X_ERROR, "%s: ioctl EVIOCGBIT failed: %s\n", pInfo->name, strerror(errno));
|
||||
goto error;
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user