[PATCH] HAL 0.5 - don't add a device if we already have it
Kay Sievers
kay.sievers at vrfy.org
Mon Mar 14 10:04:22 PST 2005
While playing around with hotplug event replay from initramfs, it happens,
that events are generated for devices HAL already knows from its coldplug
run. This leads to a lot of funny double entries in the device store. :)
We should prevent the device addition by hotplug events if we already
have one with the same sysfs-devpath.
Thanks,
Kay
-------------- next part --------------
--- hald/linux2/hotplug.c 28 Feb 2005 04:53:15 -0000 1.14
+++ hald/linux2/hotplug.c 14 Mar 2005 17:45:10 -0000
@@ -146,6 +146,13 @@ hotplug_event_begin_sysfs (HotplugEvent
sys_block_path_len = g_snprintf (sys_block_path, HAL_PATH_MAX, "%s/block", get_hal_sysfs_path ());
}
+ if (hotplug_event->is_add && hal_device_store_match_key_value_string (hald_get_gdl (),
+ "linux.sysfs_path",
+ hotplug_event->sysfs.sysfs_path)) {
+ HAL_ERROR (("devpath %s already present in the store, ignore event", hotplug_event->sysfs.sysfs_path));
+ hotplug_event_end ((void *) hotplug_event);
+ return;
+ }
if (strncmp (hotplug_event->sysfs.sysfs_path, sys_devices_path, sys_devices_path_len) == 0) {
if (hotplug_event->is_add) {
-------------- next part --------------
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list