inputd vs. hal (take 2)

Johannes Berg johannes at sipsolutions.net
Thu Aug 24 00:18:38 PDT 2006


I previously mentioned that the new inputd has trouble with hal (or
rather the other way around) because virtual uinput devices have no
physical device attached to them in sysfs and hence hal ignores them.

Now, there's a question of what to do. All uinput devices will have this
problem, and the only generic solution we came up with is modifying the
kernel as below.

Would this be appropriate from a hal point of view?

johannes

-------- Forwarded Message --------
From: Michael Hanselmann <linux-kernel at hansmi.ch>
To: Johannes Berg <johannes at sipsolutions.net>
Cc: hal at lists.freedesktop.org, linux-input at atrey.karlin.mff.cuni.cz
Subject: Re: inputd vs. hal
Date: Mon, 14 Aug 2006 20:14:52 +0200

On Mon, Aug 14, 2006 at 09:09:20AM +0200, Johannes Berg wrote:
> Yeah, up to hal I guess? It's the main consumer of these things I take 
> it. OTOH, virtual devices are hotpluggable by their very nature since 
> they are never real devices, hence hal should be fine with BUS_VIRTUAL 
> as well I think.

Below you find a patch proposal. Any comments?

This patch adds BUS_VIRTUAL to input.h and forces all uinput devices to
use it.

Signed-off-by: Michael Hanselmann <linux-kernel at hansmi.ch>

---
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc4.orig/drivers/input/misc/uinput.c linux-2.6.18-rc4/drivers/input/misc/uinput.c
--- linux-2.6.18-rc4.orig/drivers/input/misc/uinput.c	2006-08-14 18:52:10.000000000 +0200
+++ linux-2.6.18-rc4/drivers/input/misc/uinput.c	2006-08-14 18:53:55.000000000 +0200
@@ -292,7 +292,8 @@ static int uinput_setup_device(struct ui
 	}
 	strlcpy(name, user_dev->name, size);
 
-	dev->id.bustype	= user_dev->id.bustype;
+	/* We force the virtual bus type on all uinput devices */
+	dev->id.bustype	= BUS_VIRTUAL;
 	dev->id.vendor	= user_dev->id.vendor;
 	dev->id.product	= user_dev->id.product;
 	dev->id.version	= user_dev->id.version;
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc4.orig/include/linux/input.h linux-2.6.18-rc4/include/linux/input.h
--- linux-2.6.18-rc4.orig/include/linux/input.h	2006-08-14 18:52:13.000000000 +0200
+++ linux-2.6.18-rc4/include/linux/input.h	2006-08-14 18:52:56.000000000 +0200
@@ -645,6 +645,7 @@ struct input_absinfo {
 #define BUS_USB			0x03
 #define BUS_HIL			0x04
 #define BUS_BLUETOOTH		0x05
+#define BUS_VIRTUAL		0x06
 
 #define BUS_ISA			0x10
 #define BUS_I8042		0x11



More information about the hal mailing list