hal/hald/linux block_class_device.c, 1.33, 1.34 bus_device.c, 1.11,
1.12 bus_device.h, 1.6, 1.7 class_device.c, 1.16,
1.17 class_device.h, 1.8, 1.9 ide_bus_device.c, 1.5,
1.6 ide_host_bus_device.c, 1.6, 1.7 ieee1394_class_device.c,
1.1, 1.2 ieee1394_host_class_device.c, 1.1,
1.2 ieee1394_node_class_device.c, 1.1,
1.2 input_class_device.c, 1.8, 1.9 macio_bus_device.c, 1.2,
1.3 net_class_device.c, 1.12, 1.13 pci_bus_device.c, 1.6,
1.7 pcmcia_socket_class_device.c, 1.2,
1.3 platform_bus_device.c, 1.1, 1.2 printer_class_device.c,
1.8, 1.9 scsi_device_class_device.c, 1.7,
1.8 scsi_generic_class_device.c, 1.2,
1.3 scsi_host_class_device.c, 1.7, 1.8 usb_bus_device.c, 1.10,
1.11 usbif_bus_device.c, 1.7, 1.8
David Zeuthen
david at pdx.freedesktop.org
Mon Jul 5 11:21:09 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv6832/hald/linux
Modified Files:
block_class_device.c bus_device.c bus_device.h class_device.c
class_device.h ide_bus_device.c ide_host_bus_device.c
ieee1394_class_device.c ieee1394_host_class_device.c
ieee1394_node_class_device.c input_class_device.c
macio_bus_device.c net_class_device.c pci_bus_device.c
pcmcia_socket_class_device.c platform_bus_device.c
printer_class_device.c scsi_device_class_device.c
scsi_generic_class_device.c scsi_host_class_device.c
usb_bus_device.c usbif_bus_device.c
Log Message:
2004-07-05 David Zeuthen <david at fubar.dk>
* hald/linux/ieee1394_host_class_device.c: Add class_device_in_gdl
method
* hald/linux/ieee1394_node_class_device.c: Add class_device_in_gdl
method
* hald/linux/ieee1394_class_device.c: Add class_device_in_gdl method
* hald/linux/pcmcia_socket_class_device.c: Add class_device_in_gdl
method
* hald/linux/block_class_device.c: Add class_device_in_gdl method
* hald/linux/scsi_device_class_device.c: Add class_device_in_gdl method
* hald/linux/scsi_host_class_device.c: Add class_device_in_gdl method
* hald/linux/scsi_generic_class_device.c: Add class_device_in_gdl
method
* hald/linux/printer_class_device.c: Add class_device_in_gdl method
* hald/linux/net_class_device.c: Add class_device_in_gdl method
* hald/linux/input_class_device.c: Add class_device_in_gdl method
* hald/linux/class_device.c (class_device_in_gdl): New function
(class_device_move_from_tdl_to_gdl): New function, specialised version
of device_move_from_tdl_to_gdl that calls in_gdl method
(class_device_final): Call class_device_move_from_tdl_to_gdl instead
and create a ClassAsyncData variable to carry data around
* hald/linux/class_device.h: Add in_gdl method to ClassDeviceHandler
and prototype for default method class_device_in_gdl ().
* hald/linux/pci_bus_device.c: Add bus_device_in_gdl method
* hald/linux/usb_bus_device.c: Add bus_device_in_gdl method
* hald/linux/usbif_bus_device.c: Add bus_device_in_gdl method
* hald/linux/ide_host_bus_device.c: Add bus_device_in_gdl method
* hald/linux/ide_bus_device.c: Add bus_device_in_gdl method
* hald/linux/macio_bus_device.c: Add bus_device_in_gdl method
* hald/linux/platform_bus_device.c: Add bus_device_in_gdl method
* hald/linux/bus_device.c (bus_device_in_gdl): New function
(bus_device_move_from_tdl_to_gdl): New function, specialised version
of device_move_from_tdl_to_gdl that calls in_gdl method
(bus_device_got_parent): Call bus_device_move_from_tdl_to_gdl instead
and carry on the BusAsyncData bad variable; conditionally free it
on failure though.
* hald/linux/bus_device.h: Add in_gdl method to BusDeviceHandler
and prototype for default method bus_device_in_gdl ().
Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- block_class_device.c 24 Jun 2004 21:47:49 -0000 1.33
+++ block_class_device.c 5 Jul 2004 18:21:07 -0000 1.34
@@ -2035,6 +2035,7 @@
class_device_post_merge, /**< post merge function */
block_class_got_udi, /**< got UDI */
block_class_compute_udi, /**< UDI computation */
+ class_device_in_gdl, /**< in GDL */
"block", /**< sysfs class name */
"block", /**< hal class name */
TRUE, /**< require device file */
Index: bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/bus_device.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- bus_device.c 9 Jun 2004 18:11:59 -0000 1.11
+++ bus_device.c 5 Jul 2004 18:21:07 -0000 1.12
@@ -132,6 +132,32 @@
free (parent_sysfs_path);
}
+
+/** Removes the device from the TDL and adds it to the GDL when all
+ * all of the device's callouts have finished. This is a gobject
+ * signal callback.
+ *
+ * @param device The device being moved
+ * @param user_data User data provided when connecting the signal
+ *
+ */
+static void
+bus_device_move_from_tdl_to_gdl (HalDevice *device, gpointer user_data)
+{
+ BusAsyncData *bad = (BusAsyncData*) user_data;
+
+ g_object_ref (device);
+ hal_device_store_remove (hald_get_tdl (), device);
+ hal_device_store_add (hald_get_gdl (), device);
+ g_signal_handlers_disconnect_by_func (device,
+ device_move_from_tdl_to_gdl,
+ user_data);
+ g_object_unref (device);
+
+ ((bad->handler)->in_gdl) (bad->handler, device, device->udi);
+}
+
+
/** Callback when the parent is found or if there is no parent.. This is
* where we get added to the GDL..
*
@@ -151,8 +177,6 @@
BusDeviceHandler *self = (BusDeviceHandler *) bad->handler;
struct sysfs_device *device;
- g_free (bad);
-
/* set parent, if any */
if (parent != NULL) {
hal_device_property_set_string (d, "info.parent", parent->udi);
@@ -182,14 +206,17 @@
self->got_udi (self, device_to_add, new_udi);
+ /* bad is freeded in callback */
g_signal_connect (device_to_add,
"callouts_finished",
- G_CALLBACK (device_move_from_tdl_to_gdl),
- NULL);
+ G_CALLBACK (bus_device_move_from_tdl_to_gdl),
+ bad);
hal_callout_device (device_to_add, TRUE);
} else {
hal_device_store_remove (hald_get_tdl (), d);
+ /* free bad now */
+ g_free (bad);
}
}
@@ -263,5 +290,12 @@
{
}
+void
+bus_device_in_gdl (BusDeviceHandler *self,
+ HalDevice *d,
+ const char *udi)
+{
+}
+
/** @} */
Index: bus_device.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/bus_device.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- bus_device.h 25 May 2004 20:09:29 -0000 1.6
+++ bus_device.h 5 Jul 2004 18:21:07 -0000 1.7
@@ -141,6 +141,17 @@
HalDevice *d,
const char *udi);
+ /** Called when the device is in the GDL and all callouts have
+ * run
+ *
+ * @param self Pointer to class members
+ * @param d The HalDevice object
+ * @param udi UDI of device
+ */
+ void (*in_gdl) (BusDeviceHandler *self,
+ HalDevice *d,
+ const char *udi);
+
/** name of bus the instance handles (name mentioned in /sys/bus) */
const char *sysfs_bus_name;
@@ -174,6 +185,10 @@
HalDevice *d,
const char *udi);
+void bus_device_in_gdl (BusDeviceHandler *self,
+ HalDevice *d,
+ const char *udi);
+
/* Convenience structure for passing around multiple pieces of data to
the got_parent_device() functions */
typedef struct {
Index: class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/class_device.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- class_device.c 9 Jun 2004 18:11:59 -0000 1.16
+++ class_device.c 5 Jul 2004 18:21:07 -0000 1.17
@@ -391,6 +391,33 @@
class_device_final (self, d, merge_or_add);
}
+
+
+/** Removes the device from the TDL and adds it to the GDL when all
+ * all of the device's callouts have finished. This is a gobject
+ * signal callback.
+ *
+ * @param device The device being moved
+ * @param user_data User data provided when connecting the signal
+ *
+ */
+static void
+class_device_move_from_tdl_to_gdl (HalDevice *device, gpointer user_data)
+{
+ ClassAsyncData *cad = (ClassAsyncData*) user_data;
+
+ g_object_ref (device);
+ hal_device_store_remove (hald_get_tdl (), device);
+ hal_device_store_add (hald_get_gdl (), device);
+ g_signal_handlers_disconnect_by_func (device,
+ device_move_from_tdl_to_gdl,
+ user_data);
+ g_object_unref (device);
+
+ ((cad->handler)->in_gdl) (cad->handler, device, device->udi);
+}
+
+
static void
class_device_final (ClassDeviceHandler* self, HalDevice *d,
gboolean merge_or_add)
@@ -454,6 +481,7 @@
new_udi = rename_and_merge (d, self->compute_udi, self->hal_class_name);
if (new_udi != NULL) {
HalDevice *device_to_add;
+ ClassAsyncData *cad = g_new0 (ClassAsyncData, 1);
new_d = hal_device_store_find (hald_get_gdl (),
new_udi);
@@ -462,10 +490,15 @@
self->got_udi (self, device_to_add, new_udi);
+ cad->device = d;
+ cad->handler = self;
+ cad->merge_or_add = merge_or_add;
+
+
g_signal_connect (device_to_add,
"callouts_finished",
- G_CALLBACK (device_move_from_tdl_to_gdl),
- NULL);
+ G_CALLBACK (class_device_move_from_tdl_to_gdl),
+ cad);
hal_callout_device (device_to_add, TRUE);
} else {
@@ -573,4 +606,11 @@
{
}
+void
+class_device_in_gdl (ClassDeviceHandler *self,
+ HalDevice *d,
+ const char *udi)
+{
+}
+
/** @} */
Index: class_device.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/class_device.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- class_device.h 25 May 2004 20:09:29 -0000 1.8
+++ class_device.h 5 Jul 2004 18:21:07 -0000 1.9
@@ -201,6 +201,18 @@
*/
char* (*compute_udi) (HalDevice *d, int append_num);
+ /** Called when the information from the device is in the GDL
+ * and all callouts have run. Only applicable if merge_or_add is
+ * FALSE
+ *
+ * @param self Pointer to class members
+ * @param d The HalDevice object that the information
+ * ended up at
+ * @param udi UDI of device
+ */
+ void (*in_gdl) (ClassDeviceHandler *self,
+ HalDevice *d,
+ const char *udi);
/** name of device class the instance handles (name mentioned
* in /sys/class */
@@ -275,6 +287,10 @@
HalDevice *parent,
gpointer user_data);
+void class_device_in_gdl (ClassDeviceHandler *self,
+ HalDevice *d,
+ const char *udi);
+
/* Convenience structure for passing around multiple pieces of data
to the got_parent_device() functions */
Index: ide_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ide_bus_device.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ide_bus_device.c 30 Apr 2004 20:59:08 -0000 1.5
+++ ide_bus_device.c 5 Jul 2004 18:21:07 -0000 1.6
@@ -102,6 +102,7 @@
ide_device_compute_udi, /**< UDI computing function */
ide_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"ide", /**< sysfs bus name */
"ide" /**< namespace */
};
Index: ide_host_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ide_host_bus_device.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ide_host_bus_device.c 30 Apr 2004 20:59:08 -0000 1.6
+++ ide_host_bus_device.c 5 Jul 2004 18:21:07 -0000 1.7
@@ -108,6 +108,7 @@
ide_host_device_compute_udi, /**< UDI computing function */
ide_host_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"ide_host", /**< sysfs bus name */
"ide_host" /**< namespace */
};
Index: ieee1394_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ieee1394_class_device.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ieee1394_class_device.c 25 May 2004 20:09:29 -0000 1.1
+++ ieee1394_class_device.c 5 Jul 2004 18:21:07 -0000 1.2
@@ -121,6 +121,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
ieee1394_class_compute_udi, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"ieee1394", /**< sysfs class name */
"ieee1394", /**< hal class name */
FALSE, /**< don't require device file */
Index: ieee1394_host_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ieee1394_host_class_device.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ieee1394_host_class_device.c 25 May 2004 20:09:29 -0000 1.1
+++ ieee1394_host_class_device.c 5 Jul 2004 18:21:07 -0000 1.2
@@ -120,6 +120,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
ieee1394_host_class_compute_udi, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"ieee1394_host", /**< sysfs class name */
"ieee1394_host", /**< hal class name */
FALSE, /**< don't require device file */
Index: ieee1394_node_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ieee1394_node_class_device.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ieee1394_node_class_device.c 25 May 2004 20:09:29 -0000 1.1
+++ ieee1394_node_class_device.c 5 Jul 2004 18:21:07 -0000 1.2
@@ -134,6 +134,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
ieee1394_node_class_compute_udi, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"ieee1394_node", /**< sysfs class name */
"ieee1394_node", /**< hal class name */
FALSE, /**< don't require device file */
Index: input_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/input_class_device.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- input_class_device.c 4 Jun 2004 19:26:13 -0000 1.8
+++ input_class_device.c 5 Jul 2004 18:21:07 -0000 1.9
@@ -225,6 +225,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
input_class_compute_udi, /**< UDI computation */
+ class_device_in_gdl, /**< in GDL */
"input", /**< sysfs class name */
"input", /**< hal class name */
TRUE, /**< require device file */
Index: macio_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/macio_bus_device.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- macio_bus_device.c 30 Apr 2004 20:59:08 -0000 1.2
+++ macio_bus_device.c 5 Jul 2004 18:21:07 -0000 1.3
@@ -87,6 +87,7 @@
macio_device_compute_udi, /**< UDI computing function */
macio_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"macio", /**< sysfs bus name */
"macio" /**< namespace */
};
Index: net_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/net_class_device.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- net_class_device.c 4 Jul 2004 16:48:31 -0000 1.12
+++ net_class_device.c 5 Jul 2004 18:21:07 -0000 1.13
@@ -611,6 +611,7 @@
net_class_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
net_class_compute_udi, /**< compute UDI */
+ class_device_in_gdl, /**< in GDL */
"net", /**< sysfs class name */
"net", /**< hal class name */
FALSE, /**< require device file */
Index: pci_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/pci_bus_device.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pci_bus_device.c 30 Apr 2004 20:59:08 -0000 1.6
+++ pci_bus_device.c 5 Jul 2004 18:21:07 -0000 1.7
@@ -490,6 +490,7 @@
pci_device_compute_udi, /**< UDI computing function */
pci_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"pci", /**< sysfs bus name */
"pci" /**< namespace */
};
Index: pcmcia_socket_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/pcmcia_socket_class_device.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pcmcia_socket_class_device.c 30 Apr 2004 20:59:08 -0000 1.2
+++ pcmcia_socket_class_device.c 5 Jul 2004 18:21:07 -0000 1.3
@@ -90,6 +90,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
NULL, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"pcmcia_socket", /**< sysfs class name */
"pcmcia_socket", /**< hal class name */
FALSE, /**< require device file */
Index: platform_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/platform_bus_device.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- platform_bus_device.c 24 Jun 2004 21:47:49 -0000 1.1
+++ platform_bus_device.c 5 Jul 2004 18:21:07 -0000 1.2
@@ -154,6 +154,7 @@
platform_device_compute_udi, /**< UDI computing function */
platform_device_pre_process, /**< add more properties */
platform_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"platform", /**< sysfs bus name */
"platform" /**< namespace */
};
Index: printer_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/printer_class_device.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- printer_class_device.c 3 Jun 2004 21:56:36 -0000 1.8
+++ printer_class_device.c 5 Jul 2004 18:21:07 -0000 1.9
@@ -178,6 +178,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
NULL, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"usb", /**< sysfs class name */
"printer", /**< hal class name */
TRUE, /**< require device file */
Index: scsi_device_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_device_class_device.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- scsi_device_class_device.c 30 Apr 2004 20:59:08 -0000 1.7
+++ scsi_device_class_device.c 5 Jul 2004 18:21:07 -0000 1.8
@@ -114,6 +114,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
scsi_device_class_compute_udi, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"scsi_device", /**< sysfs class name */
"scsi_device", /**< hal class name */
FALSE, /**< don't require device file */
Index: scsi_generic_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_generic_class_device.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scsi_generic_class_device.c 30 Apr 2004 20:59:08 -0000 1.2
+++ scsi_generic_class_device.c 5 Jul 2004 18:21:07 -0000 1.3
@@ -90,6 +90,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
NULL, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"scsi_generic", /**< sysfs class name */
"scsi_generic", /**< hal class name */
TRUE, /**< require device file */
Index: scsi_host_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_host_class_device.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- scsi_host_class_device.c 30 Apr 2004 20:59:08 -0000 1.7
+++ scsi_host_class_device.c 5 Jul 2004 18:21:07 -0000 1.8
@@ -103,6 +103,7 @@
class_device_post_merge, /**< post merge function */
class_device_got_udi, /**< got UDI */
scsi_host_class_compute_udi, /**< No UDI computation */
+ class_device_in_gdl, /**< in GDL */
"scsi_host", /**< sysfs class name */
"scsi_host", /**< hal class name */
FALSE, /**< don't require device file */
Index: usb_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usb_bus_device.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- usb_bus_device.c 30 Apr 2004 20:59:08 -0000 1.10
+++ usb_bus_device.c 5 Jul 2004 18:21:07 -0000 1.11
@@ -948,6 +948,7 @@
usb_device_compute_udi, /**< UDI computing function */
usb_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"usb", /**< sysfs bus name */
"usb" /**< namespace */
};
Index: usbif_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usbif_bus_device.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- usbif_bus_device.c 30 Apr 2004 20:59:08 -0000 1.7
+++ usbif_bus_device.c 5 Jul 2004 18:21:07 -0000 1.8
@@ -157,6 +157,7 @@
usbif_device_compute_udi, /**< UDI computing function */
usbif_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
+ bus_device_in_gdl, /**< in GDL */
"usb", /**< sysfs bus name */
"usbif" /**< namespace */
};
More information about the hal-commit
mailing list