[PATCH] Fail if the device cannot be grabbed during the probe.
Peter Clifton
pcjc2 at cam.ac.uk
Wed May 21 01:42:19 PDT 2008
Minor typo noted:
- /* keyboards are unsafe in 2.4 */
+ /* keyboards are unsave in 2.4 */
Also (and sorry to nit-pick), a mix of:
if () {
and
if ()
{
between the patch and the surrounding code.
On Wed, 2008-05-21 at 17:25 +0930, Peter Hutterer wrote:
> If the grab fails, this is most likely a sign that the device has been grabbed
> already (probably by a device specified in xorg.conf). So let's not add the
> device to the server's input device list, since it won't generate events
> anyway.
>
> Exception: keyboards and kernel 2.4 are not affected.
> ---
> src/evdev.c | 13 ++++++++++---
> 1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 3e4a48c..9c59323 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -901,9 +901,16 @@ EvdevProbe(InputInfoPtr pInfo)
> int i, has_axes, has_buttons, has_keys;
> EvdevPtr pEvdev = pInfo->private;
>
> - if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1) && errno == EINVAL) {
> - /* keyboards are unsafe in 2.4 */
> - pEvdev->kernel24 = 1;
> + if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1))
> + {
> + if (errno == EINVAL)
> + /* keyboards are unsave in 2.4 */
> + pEvdev->kernel24 = 1;
> + else
> + {
> + xf86Msg(X_ERROR, "Grab failed. Device already configured?\n");
> + return 1;
> + }
> } else {
> ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
> }
--
Peter Clifton
Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA
Tel: +44 (0)7729 980173 - (No signal in the lab!)
More information about the xorg
mailing list