hal/hald/linux class_device.c, 1.26, 1.27 common.h, 1.8,
1.9 osspec.c, 1.34, 1.35
David Zeuthen
david at freedesktop.org
Wed Aug 25 13:55:15 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv31962/hald/linux
Modified Files:
class_device.c common.h osspec.c
Log Message:
2004-08-25 David Zeuthen <david at fubar.dk>
* configure.in: Add option for new callout hal-hotplug-map
* hald/device.[ch]: Add the "cancelled" signal and hal_device_cancel
method
* hald/hald.c (main): Avoid daemonization for now; will make hald
hang if anything fails up-until device probing (RH bug 130849)
* hald/linux/class_device.c (class_device_got_device_file):
Cancel the device if don't get the device file
* hald/linux/common.h: Increase timeout to 60 secs. Make note
about we really need the SEQNUM support in udev
* hald/linux/osspec.c:
(process_coldplug_list_device_cancelled): New function
(process_coldplug_list): Add support for cancelling
(reenable_hotplug_proc_on_device_cancel): New function
(hald_helper_hotplug): Add support for cancelling
(hotplug_sem_up): Add some helpful debug
(hotplug_sem_down): Add some helpful debug
(hald_helper_data): Add some helpful debug
* tools/Makefile.am: Also remove callout on uninstall
* tools/fstab-sync.c:
(fs_table_remove_volume): Only require device_file not complete Volume
object
(remove_udi): Don't require storage device to be present (fixes some
problems when unplugging unpartitioned media as we don't get hotplug
event and things are thus not serialised)
* tools/linux/Makefile.am: Build and, optionally, install
hal-hotplug-map callout
* tools/linux/hal_hotplug_map.c: New program; a tad Red Hat specific
wrt. file locations; patches are welcome. The single purpose of
this callout is to detect gphoto2 supported cameras and libsane
supported scanners using usermap files in /etc/hotplug.
Index: class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/class_device.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- class_device.c 22 Aug 2004 19:27:22 -0000 1.26
+++ class_device.c 25 Aug 2004 20:55:13 -0000 1.27
@@ -413,6 +413,7 @@
if (!prop_exists) {
HAL_WARNING (("Never got device file for class device at %s",
hal_device_property_get_string (d, ".udev.sysfs_path")));
+ hal_device_cancel (d);
hal_device_store_remove (hald_get_tdl (), d);
return;
}
Index: common.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/common.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- common.h 22 Aug 2004 19:27:22 -0000 1.8
+++ common.h 25 Aug 2004 20:55:13 -0000 1.9
@@ -84,13 +84,11 @@
* appear and the linux kernel gives us these add events out of
* order.
*
- * My old PIII 650Mhz, 128MB laptop with GNOME 2.4 is slow when
- * attaching a whole subtree of USB devices, so a value of 30 seconds
- * is actually reasonable. It's important to note that it's not
- * HAL that is taking the lions share of the resources; rather it's
- * the shell-scripts in linux-hotplug...
+ * This can be changed to WAIT_FOR_UDEV_TIMEOUT once udev support SEQNUM; 60
+ * secs isn't unreasonable with this setup; if you hotplug a hub full of
+ * devices and whatnot while hald is under load with h-d-m on a slow machine.
*/
-#define HAL_LINUX_HOTPLUG_TIMEOUT 30000
+#define HAL_LINUX_HOTPLUG_TIMEOUT 60000
dbus_bool_t got_parent (const char *sysfs_path);
Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- osspec.c 23 Aug 2004 19:57:06 -0000 1.34
+++ osspec.c 25 Aug 2004 20:55:13 -0000 1.35
@@ -715,6 +715,16 @@
}
static void
+process_coldplug_list_device_cancelled (HalDevice *device, gpointer user_data)
+{
+ GSList *coldplug_list = user_data;
+
+ g_signal_handlers_disconnect_by_func (device, process_coldplug_list_device_cancelled, user_data);
+
+ process_coldplug_list (coldplug_list);
+}
+
+static void
process_coldplug_list (GSList *coldplug_list)
{
gchar *path;
@@ -738,6 +748,8 @@
if (device != NULL && hal_device_store_find(hald_get_gdl (), device->udi) == NULL) {
g_signal_connect (device, "callouts_finished",
G_CALLBACK (process_coldplug_list_callouts_done_for_device), coldplug_list);
+ g_signal_connect (device, "cancelled",
+ G_CALLBACK (process_coldplug_list_device_cancelled), NULL);
} else {
process_coldplug_list (coldplug_list);
}
@@ -1065,6 +1077,13 @@
}
static void
+reenable_hotplug_proc_on_device_cancel (HalDevice *d, gpointer user_data)
+{
+ g_signal_handlers_disconnect_by_func (d, reenable_hotplug_proc_on_device_cancel, user_data);
+ hotplug_sem_down ();
+}
+
+static void
reenable_hotplug_proc (HalDevice *d, gpointer user_data)
{
g_signal_handlers_disconnect_by_func (d, reenable_hotplug_proc, user_data);
@@ -1095,6 +1114,9 @@
hotplug_sem_up ();
g_signal_connect (d, "callouts_finished",
G_CALLBACK (reenable_hotplug_proc), NULL);
+ /* device may also be cancelled if e.g. no device file is found */
+ g_signal_connect (d, "cancelled",
+ G_CALLBACK (reenable_hotplug_proc_on_device_cancel), NULL);
}
} else {
d = rem_device (sysfs_path_full, subsystem);
@@ -1187,6 +1209,9 @@
hotplug_sem_up (void)
{
++hotplug_counter;
+ HAL_INFO (("******************************************"));
+ HAL_INFO (("**** hotplug_counter is now %d", hotplug_counter));
+ HAL_INFO (("******************************************"));
}
/** Decrement the hotplug semaphore.
@@ -1197,6 +1222,10 @@
{
--hotplug_counter;
+ HAL_INFO (("=========================================="));
+ HAL_INFO (("==== hotplug_counter is now %d", hotplug_counter));
+ HAL_INFO (("=========================================="));
+
if (hotplug_counter < 0) {
HAL_ERROR (("****************************************"));
HAL_ERROR (("****************************************"));
@@ -1326,6 +1355,7 @@
}
/* Queue up this hotplug event and process the queue */
+ HAL_INFO (("Queing up seqnum=%d, sysfspath=%s, subsys=%s", msg.seqnum, msg.sysfs_path, msg.subsystem));
hotplug_queue = g_list_append (hotplug_queue, g_memdup (&msg, sizeof (struct hald_helper_msg)));
hald_helper_hotplug_process_queue ();
More information about the hal-commit
mailing list