From 7f1e8146d4b13929a86a4b80f783a720c1b5573a Mon Sep 17 00:00:00 2001 From: Sascha Hlusiak Date: Wed, 20 Feb 2008 20:41:08 +0100 Subject: 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. --- src/evdev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/evdev.c') 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); -- cgit v1.2.3