summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hlusiak <saschahlusiak@arcor.de>2008-02-20 20:41:08 +0100
committerSascha Hlusiak <saschahlusiak@arcor.de>2008-02-20 20:41:08 +0100
commit7f1e8146d4b13929a86a4b80f783a720c1b5573a (patch)
treeb8076ea340569b689e37cc240f07039346cba942
parent8ae4d17ca3fb9ec06b16df5c737cd9021453a020 (diff)
More accurate error messages on device open fail.
The message "cannot open input pEvdev" resulted in a lot of bug reports of confused users that did not supply a device path. Now we tell them when it is missing or print out a reason when device open fails.
-rw-r--r--src/evdev.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/evdev.c b/src/evdev.c
index dc801d0..38f80ef 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -401,13 +401,21 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pEvdev->device = xf86CheckStrOption(dev->commonOptions, "path", NULL);
if (!pEvdev->device)
pEvdev->device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
+ if (!pEvdev->device) {
+ xf86Msg(X_ERROR, "%s: No Device specified.\n", pInfo->name);
+ pInfo->private = NULL;
+ xfree(pEvdev);
+ xf86DeleteInput (pInfo, 0);
+ return NULL;
+ }
xf86CollectInputOptions(pInfo, NULL, NULL);
xf86ProcessCommonOptions(pInfo, pInfo->options);
SYSCALL(pInfo->fd = open (pEvdev->device, O_RDWR | O_NONBLOCK));
if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open input pEvdev\n", pInfo->name);
+ xf86Msg(X_ERROR, "%s: cannot open device '%s': %s\n",
+ pInfo->name, pEvdev->device, strerror(errno));
pInfo->private = NULL;
xfree(pEvdev);
xf86DeleteInput (pInfo, 0);