[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

udev: main: action, subsystem or devpath missing



This is simultaneously caused by the kernel input subsystem not using
the new driver core, and the changes to udev to obsolete the /etc/dev.d
and /etc/hotplug.d directories.


With the new driver core the driver has an opportunity to add
environment to the uevent[0] generated along with the sysfs information
before the event is sent to userspace via the netlink socket and, for
backwards compatibility, the /proc/sys/kernel/hotplug interface.

However the input subsystem isn't yet doing this, so the sysfs-generated
event doesn't carry any of the PRODUCT, EV, KEY, etc. environment
variables describing the input device.

Instead the input subsystem has its own function to generate the
environment for a call to the /proc/sys/kernel/hotplug helper.  This is
done in drivers/input.c input_call_hotplug().

Because this isn't related to the sysfs event, there's no way for it to
include the DEVPATH variable that points to the path in the sysfs
filesystem.

There are patches starting to float around now to update the kernel to
use the new driver core; at this point udev will be able to
drop /proc/sys/kernel/hotplug compatibility completely as all events
will come from the netlink socket and be well-formed.


udev *used* to handle this; when it received an event without the
required variables it would skip any udev.rules processing and just run
the old /etc/hotplug.d/ scripts.

udev-0.059 dropped direct support for these scripts, and instead
included a "udev_run_hotplugd" helper that distributions could chose to
ship alongside and add a udev.rules entry to run it.

This also meant that support for the "malformed" uevents was dropped at
the same time, as there's no way to perform udev.rules checking with
them.


The right solution, long-term, is for the kernel to use the new driver
core for the input subsystem.  This will mean all sorts of hacks will go
away, and bring us one step closer to world peace and stuff.

The short term solution we've adopted in Ubuntu is the attached patch
that handles input subsystem events that are missing a devpath by
directly execing udev_run_hotplugd and letting that deal with it.

Scott

[0] the new name for what used to be hotplug events.
-- 
Scott James Remnant
scott@ubuntu.com
diff -ruNp udev-060.orig/udev.c udev-060/udev.c
--- udev-060.orig/udev.c	2005-09-23 23:08:25.374883000 +0100
+++ udev-060/udev.c	2005-09-23 23:22:45.034195864 +0100
@@ -114,11 +114,25 @@ int main(int argc, char *argv[], char *e
 	if (!subsystem && argc == 2)
 		subsystem = argv[1];
 
-	if (!action || !subsystem || !devpath) {
-		err("action, subsystem or devpath missing");
+	if (!action || !subsystem) {
+		err("action or subsystem missing");
 		goto exit;
 	}
 
+	if (!devpath) {
+		if (!strcmp(subsystem, "input")) {
+			dbg("input event without devpath");
+			logging_close();
+
+			execv("/sbin/udev_run_hotplugd", argv);
+			err("exec of child failed");
+			_exit(1);
+		} else {
+			err("devpath missing");
+			goto exit;
+		}
+	}
+
 	/* export log_priority , as called programs may want to do the same as udev */
 	if (udev_log_priority) {
 		char priority[32];

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: