hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Fri Oct 17 05:53:43 PDT 2008


 hald/linux/device.c | 4873 ++++++++++++++++++++++++++--------------------------
 1 file changed, 2438 insertions(+), 2435 deletions(-)

New commits:
commit 96ef6b6b45a8e5b4d68afd00ee186dc6e29e1bdf
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Fri Oct 17 14:51:56 2008 +0200

    keep subsystem/devhandler in alphabetical order
    
    This commit changes no code, it orders the subsystem/devhandler
    only alphabetical. This is much easier to handle and to read
    than the former mess.

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 26f6c1b..ec0f50a 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -70,8 +70,6 @@
 
 #include "device.h"
 
-/*--------------------------------------------------------------------------------------------------------------*/
-
 /* this is kinda messy... but acpi.c + friends use this */
 gboolean _have_sysfs_lid_button = FALSE;
 gboolean _have_sysfs_power_button = FALSE;
@@ -90,6 +88,791 @@ static gboolean battery_poll_running = FALSE;
 #define LONG(x) ((x)/BITS_PER_LONG)
 #define test_bit(bit, array)    ((array[LONG(bit)] >> OFF(bit)) & 1)
 
+/*--------------------------------------------------------------------------------------------------------------*/
+/* 		 	PLEASE KEEP THE SUBSYSTEMS IN ALPHABETICAL ORDER !!!					*/
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+backlight_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev,
+	       const gchar *sysfs_path_in_devices)
+{
+	HalDevice *d;
+	int max_brightness;
+
+	d = hal_device_new ();
+	hal_device_add_capability (d, "laptop_panel");
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	hal_device_property_set_string (d, "info.category", "laptop_panel");
+	hal_device_property_set_string (d, "info.product", "Generic Backlight Device");
+	hal_device_property_set_string (d, "laptop_panel.access_method", "general");
+
+	hal_util_get_int_from_file (sysfs_path, "max_brightness", &max_brightness, 10);
+	hal_device_property_set_int (d, "laptop_panel.num_levels", max_brightness + 1);
+	return d;
+}
+
+static gboolean
+backlight_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_backlight",
+			  hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+bluetooth_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, 
+	       const gchar *parent_path)
+{
+	HalDevice *d;
+	const char *type_entry;
+	const char *addr_entry;
+        unsigned int a5, a4, a3, a2, a1, a0;
+        dbus_uint64_t address;
+
+	d = NULL;
+
+	if (parent_dev == NULL) {
+		goto out;
+	}
+
+	addr_entry = hal_util_get_string_from_file (sysfs_path, "address");
+        if (addr_entry == NULL)
+                goto out;
+
+        if (sscanf (addr_entry, "%x:%x:%x:%x:%x:%x", &a5, &a4, &a3, &a2, &a1, &a0) != 6) {
+                goto out;
+        }
+        address = ((dbus_uint64_t)a5<<40) |
+                ((dbus_uint64_t)a4<<32) | 
+                ((dbus_uint64_t)a3<<24) | 
+                ((dbus_uint64_t)a2<<16) | 
+                ((dbus_uint64_t)a1<< 8) | 
+                ((dbus_uint64_t)a0<< 0);
+
+	type_entry = hal_util_get_string_from_file (sysfs_path, "type");
+        if (type_entry == NULL)
+                goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+
+	if (strcmp (type_entry, "ACL") == 0) {
+		hal_device_property_set_string (d, "info.category", "bluetooth_acl");
+		hal_device_add_capability (d, "bluetooth_acl");
+                hal_device_property_set_uint64 (d, "bluetooth_acl.address", address);
+		hal_device_property_set_string (d, "info.product", "Bluetooth Asynchronous Connection-oriented Link");
+		hal_device_property_set_string (d, "bluetooth_acl.originating_device", hal_device_get_udi (parent_dev));
+
+	} else if (strcmp (type_entry, "SCO") == 0) {
+		hal_device_property_set_string (d, "info.category", "bluetooth_sco");
+		hal_device_add_capability (d, "bluetooth_sco");
+                hal_device_property_set_uint64 (d, "bluetooth_sco.address", address);
+		hal_device_property_set_string (d, "info.product", "Bluetooth Synchronous Connection-oriented Link");
+		hal_device_property_set_string (d, "bluetooth_sco.originating_device", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.category", "bluetooth_hci");
+		hal_device_add_capability (d, "bluetooth_hci");
+		hal_device_property_set_string (d, "info.product", "Bluetooth Host Controller Interface");
+		hal_device_property_set_string (d, "bluetooth_hci.originating_device", hal_device_get_udi (parent_dev));
+                hal_device_property_set_uint64 (d, "bluetooth_hci.address", address);
+	}
+
+out:
+	return d;
+}
+
+static gboolean
+bluetooth_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	if (hal_device_has_capability (d, "bluetooth_acl")) {
+		hald_compute_udi (udi, sizeof (udi),
+                                  "/org/freedesktop/Hal/devices/bluetooth_acl_%0llx",
+                                  hal_device_property_get_uint64 (d, "bluetooth_acl.address"));
+	} else if (hal_device_has_capability (d, "bluetooth_sco")) {
+		hald_compute_udi (udi, sizeof (udi),
+                                  "/org/freedesktop/Hal/devices/bluetooth_acl_%0llx",
+                                  hal_device_property_get_uint64 (d, "bluetooth_acl.address"));
+	} else {
+		hald_compute_udi (udi, sizeof (udi),
+                                  "%s_bluetooth_hci_%0llx",
+                                  hal_device_property_get_string (d, "info.parent"),
+                                  hal_device_property_get_uint64 (d, "bluetooth_hci.address"));
+	}
+	hal_device_set_udi (d, udi);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static inline void
+ccw_add_dasd_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	const gchar *disc;
+	
+	hal_util_set_int_from_file (d, "ccw.dasd.use_diag", sysfs_path,
+				    "use_diag", 2);
+	hal_util_set_int_from_file (d, "ccw.dasd.readonly", sysfs_path,
+				    "readonly", 2);
+	disc = hal_util_get_string_from_file (sysfs_path, "discipline");
+	if (disc)
+		hal_device_property_set_string(d, "ccw.dasd.discipline", disc);
+}
+
+static inline void
+ccw_add_zfcp_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	int online;
+
+	/* zfcp adapter properties are only valid for online devices. */
+	if (!hal_util_get_int_from_file (sysfs_path, "online", &online, 2))
+		return;
+	if (!online)
+		return;
+
+	hal_util_set_int_from_file (d, "ccw.zfcp.in_recovery", sysfs_path,
+				    "in_recovery", 2);
+	hal_util_set_int_from_file (d, "ccw.zfcp.failed", sysfs_path,
+				    "failed", 2);
+}
+
+static inline void
+ccw_add_tape_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	int medium_state, online;
+
+	const gchar *state_text[3] = {"unknown", "loaded", "no medium"};
+
+	hal_util_set_string_from_file (d, "ccw.tape.state", sysfs_path, "state");
+    	hal_util_set_string_from_file (d, "ccw.tape.operation", sysfs_path,
+				       "operation");
+	/* The following properties are only valid for online devices. */
+	if (!hal_util_get_int_from_file (sysfs_path, "online", &online, 2))
+		return;
+	if (!online)
+		return;
+	hal_util_set_int_from_file (d, "ccw.tape.blocksize", sysfs_path,
+				    "blocksize", 10);
+	if (!hal_util_get_int_from_file (sysfs_path, "medium_state",
+					&medium_state, 10))
+		return;
+	hal_device_property_set_string (d, "ccw.tape.medium_state",
+					state_text[medium_state]);
+}
+
+static inline void
+ccw_add_3270_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	hal_util_set_int_from_file (d, "ccw.3270.model", sysfs_path,
+				    "model", 10);
+	hal_util_set_int_from_file (d, "ccw.3270.rows", sysfs_path, "rows", 10);
+	hal_util_set_int_from_file (d, "ccw.3270.columns", sysfs_path,
+				    "columns", 10);
+}
+
+static HalDevice *
+ccw_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+	const gchar *pimpampom;
+	int pim, pam, pom;
+	const gchar *chpids;
+	int chpid[8];
+	gchar attr[25];
+	int i;
+	gchar driver_name[256];
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL)
+                hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+        else
+                hal_device_property_set_string
+		  (d, "info.parent",
+		   "/org/freedesktop/Hal/devices/computer");
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_device_property_set_string (d, "ccw.bus_id", bus_id);
+	hal_util_set_int_from_file (d, "ccw.online", sysfs_path, "online", 2);
+	hal_util_set_string_from_file (d, "ccw.availablity", sysfs_path,
+				       "availability");
+	hal_util_set_int_from_file (d, "ccw.cmb_enable", sysfs_path,
+				    "cmb_enable", 2);
+	hal_util_set_string_from_file (d, "ccw.cutype", sysfs_path, "cutype");
+	hal_util_set_string_from_file (d, "ccw.devtype", sysfs_path, "devtype");
+
+	/* Get some values from the higher level subchannel structure.*/
+	pimpampom = hal_util_get_string_from_file (sysfs_path, "../pimpampom");
+	if (pimpampom) {
+		sscanf (pimpampom, "%x %x %x", &pim, &pam, &pom);
+		hal_device_property_set_int (d, "ccw.subchannel.pim", pim);
+		hal_device_property_set_int (d, "ccw.subchannel.pam", pam);
+		hal_device_property_set_int (d, "ccw.subchannel.pom", pom);
+	}
+
+	chpids = hal_util_get_string_from_file (sysfs_path, "../chpids");
+	if (chpids) {
+		sscanf (chpids, "%x %x %x %x %x %x %x %x", &chpid[0], &chpid[1],
+			&chpid[2], &chpid[3], &chpid[4], &chpid[5], &chpid[6],
+			&chpid[7]);
+		for (i=0; i<8 && (chpid[i] != 0); i++) {
+			g_snprintf (attr, sizeof (attr),
+				    "ccw.subchannel.chpid%x", i);
+			hal_device_property_set_int (d, attr, chpid[i]);
+		}
+	}
+
+	/* Add some special properties. */
+	if (hal_util_get_driver_name (sysfs_path, driver_name)) {
+		if (!strncmp (driver_name, "dasd", 4))
+			/* Same attributes for dasd_eckd and dasd_fba. */
+			ccw_add_dasd_properties (d, sysfs_path);
+		if (!strncmp (driver_name, "zfcp", 4))
+			ccw_add_zfcp_properties (d, sysfs_path);
+		if (!strncmp (driver_name, "tape_3", 6))
+			/* For all channel attached tapes. */
+			ccw_add_tape_properties (d, sysfs_path);
+		if (!strncmp (driver_name, "3270", 4))
+			ccw_add_3270_properties (d, sysfs_path);
+	}
+	return d;
+}
+
+static gboolean
+ccw_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/ccw_%s",
+			  hal_device_property_get_string
+			  (d, "ccw.bus_id"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static inline void
+ccwgroup_add_qeth_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	int is_layer2;
+
+	/* Some attributes are not applicable for devices in layer2 mode. */
+	hal_util_get_int_from_file (sysfs_path, "layer2", &is_layer2, 2);
+
+	hal_util_set_string_from_file (d, "ccwgroup.qeth.large_send",
+				       sysfs_path, "large_send");
+	hal_util_set_string_from_file (d, "ccwgroup.qeth.card_type", sysfs_path,
+				       "card_type");
+	hal_util_set_string_from_file (d, "ccwgroup.qeth.checksumming",
+				       sysfs_path, "checksumming");
+	if (!is_layer2) {
+		/* CH: the next two are only valid for token ring devices */
+		hal_util_set_int_from_file (d,
+					    "ccwgroup.qeth.canonical_macaddr",
+					    sysfs_path, "canonical_macaddr", 2);
+		hal_util_set_string_from_file (d,
+					       "ccwgroup.qeth.broadcast_mode",
+					       sysfs_path, "broadcast_mode");
+		hal_util_set_int_from_file (d, "ccwgroup.qeth.fake_broadcast",
+					    sysfs_path, "fake_broadcast", 2);
+		hal_util_set_int_from_file (d, "ccwgroup.qeth.fake_ll",
+					    sysfs_path, "fake_ll", 2);
+	}
+	hal_device_property_set_int (d, "ccwgroup.qeth.layer2", is_layer2);
+	hal_util_set_string_from_file (d, "ccwgroup.qeth.portname", sysfs_path,
+				       "portname");
+	hal_util_set_int_from_file (d, "ccwgroup.qeth.portno", sysfs_path,
+				    "portno", 10);
+	hal_util_set_int_from_file (d, "ccwgroup.qeth.buffer_count", sysfs_path,
+				    "buffer_count", 10);
+	hal_util_set_int_from_file (d, "ccwgroup.qeth.add_hhlen", sysfs_path,
+				    "add_hhlen", 10);
+	hal_util_set_string_from_file (d, "ccwgroup.qeth.priority_queueing",
+				       sysfs_path, "priority_queueing");
+	if (!is_layer2) {
+		hal_util_set_string_from_file (d, "ccwgroup.qeth.route4",
+					       sysfs_path, "route4");
+		hal_util_set_string_from_file (d, "ccwgroup.qeth.route6",
+					       sysfs_path, "route6");
+	}
+	hal_util_set_string_from_file (d, "ccwgroup.qeth.state", sysfs_path,
+				       "state");
+}
+
+static inline void
+ccwgroup_add_ctc_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	/* CH: use protocol descriptions? */
+	hal_util_set_int_from_file (d, "ccwgroup.ctc.protocol", sysfs_path,
+				    "protocol", 2);
+	hal_util_set_string_from_file (d, "ccwgroup.ctc.type", sysfs_path,
+				       "type");
+	hal_util_set_int_from_file (d, "ccwgroup.ctc.buffer", sysfs_path,
+				    "buffer", 10);
+}
+
+static inline void
+ccwgroup_add_lcs_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	hal_util_set_int_from_file (d, "ccwgroup.lcs.portnumber", sysfs_path,
+				    "portno", 10);
+	hal_util_set_string_from_file (d, "ccwgroup.lcs.type", sysfs_path,
+				       "type");
+	hal_util_set_int_from_file (d, "ccwgroup.lcs.lancmd_timeout",
+				    sysfs_path, "lancmd_timeout", 10);
+}
+
+static inline void
+ccwgroup_add_claw_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	hal_util_set_string_from_file (d, "ccwgroup.claw.api_type", sysfs_path,
+				       "api_type");
+	hal_util_set_string_from_file (d, "ccwgroup.claw.adapter_name",
+				       sysfs_path, "adapter_name");
+	hal_util_set_string_from_file (d, "ccwgroup.claw.host_name", sysfs_path,
+				       "host_name");
+	hal_util_set_int_from_file (d, "ccwgroup.claw.read_buffer", sysfs_path,
+				    "read_buffer", 10);
+	hal_util_set_int_from_file (d, "ccwgroup.claw.write_buffer", sysfs_path,
+				    "write_buffer", 10);
+}
+
+static HalDevice *
+ccwgroup_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+	gchar driver_name[256];
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL)
+                hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+        else
+                hal_device_property_set_string
+		  (d, "info.parent",
+		   "/org/freedesktop/Hal/devices/computer");
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_device_property_set_string (d, "ccwgroup.bus_id", bus_id);
+	hal_util_set_int_from_file (d, "ccwgroup.online", sysfs_path,
+				    "online", 2);
+
+	/* Some devices have extra properties. */
+	if (hal_util_get_driver_name (sysfs_path, driver_name)) {
+		if (!strncmp (driver_name, "qeth", 4))
+			ccwgroup_add_qeth_properties (d, sysfs_path);
+		if (!strncmp (driver_name, "ctc", 3))
+			ccwgroup_add_ctc_properties (d, sysfs_path);
+		if (!strncmp (driver_name, "lcs", 3))
+			ccwgroup_add_lcs_properties (d, sysfs_path);
+		if (!strncmp (driver_name, "claw", 4))
+			ccwgroup_add_claw_properties (d, sysfs_path);
+	}
+	return d;
+}
+
+static gboolean
+ccwgroup_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/ccwgroup_%s",
+			  hal_device_property_get_string
+			  (d, "ccwgroup.bus_id"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+drm_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d = NULL;
+
+	d = hal_device_new ();
+
+	hal_device_add_capability (d, "drm");
+
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+		hal_device_copy_property( parent_dev, "info.vendor", d, "info.vendor");
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_device_property_set_string (d, "info.product", "Direct Rendering Manager Device");
+	hal_device_property_set_string (d, "info.category", "drm");
+	hal_device_property_set_string (d, "linux.device_file", device_file);
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path); /* not sure if this is needed/set */
+	hal_util_set_string_from_file (d, "drm.dri_library", sysfs_path, "dri_library_name");
+	hal_util_set_string_from_file (d, "drm.version", sysfs_path, "../version");
+	
+	return d;
+}
+
+static gboolean
+drm_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+	const char *dir;
+	const char *name;
+
+	dir = hal_device_property_get_string (d, "linux.sysfs_path");
+
+	name = hal_util_get_last_element(dir);
+
+	/* generate e.g.: /org/freedesktop/Hal/devices/pci_8086_2a02_drm_i915_card0 */
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_drm_%s_%s",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_string (d, "drm.dri_library"),
+			  name);
+
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+dvb_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+
+	d = NULL;
+
+	if (parent_dev == NULL || parent_path == NULL)
+		goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	hal_device_property_set_string (d, "info.category", "dvb");
+	hal_device_add_capability (d, "dvb");
+	hal_device_property_set_string (d, "info.product", "DVB Device");
+	hal_device_property_set_string (d, "dvb.device", device_file);
+
+out:
+	return d;
+}
+
+static gboolean
+dvb_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi), "%s_dvb",
+			  hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+firewire_add_device (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev)
+{
+	HalDevice *d = NULL;
+	gchar buf[64];
+
+	if (device_file == NULL || device_file[0] == '\0')
+		goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.subsystem", "ieee1394");
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	hal_device_add_capability (d, "ieee1394");
+	hal_device_property_set_string (d, "ieee1394.device", device_file);
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_util_set_uint64_from_file (d, "ieee1394.guid", sysfs_path, "guid", 16);	
+	hal_util_set_int_from_file  (d, "ieee1394.vendor_id", sysfs_path, "vendor", 16);
+	hal_util_set_int_from_file  (d, "ieee1394.product_id", sysfs_path, "model", 16);
+	hal_util_set_int_from_file  (d, "ieee1394.harware_version", sysfs_path, "harware_version", 16);
+
+	if (!hal_util_set_string_from_file (d, "ieee1394.vendor", sysfs_path, "vendor_name")) {
+		/* FIXME: We should do a OUI lookup here, see
+		 * http://standards.ieee.org/regauth/oui/oui.txt */
+
+		g_snprintf (buf, sizeof (buf), "Unknown (0x%06x)", 
+			    hal_device_property_get_int (d, "ieee1394.vendor_id"));
+		hal_device_property_set_string (d, "ieee1394.vendor", buf);
+	}
+
+	hal_util_set_string_from_file (d, "ieee1394.product", sysfs_path, "model_name");
+
+ out:
+	return d;
+}
+
+static HalDevice *
+firewire_add_unit (const gchar *sysfs_path, int unit_id, HalDevice *parent_dev)
+{
+	int specifier_id;
+	int version;
+	HalDevice *d;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.subsystem", "ieee1394_unit");
+	hal_device_property_set_string (d, "info.parent",
+					hal_device_get_udi (parent_dev));
+	hal_device_property_set_string (d, "ieee1394_unit.originating_device", 
+					hal_device_get_udi (parent_dev));
+	hal_device_property_set_int (d, "ieee1394_unit.unit_index", unit_id);
+	hal_device_add_capability (d, "ieee1394_unit");
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_util_set_int_from_file  (d, "ieee1394.vendor_id", sysfs_path, "../vendor_id", 16);
+	hal_util_get_int_from_file  (sysfs_path, "specifier_id", &specifier_id, 16);
+	hal_device_property_set_int (d, "ieee1394_unit.specifier_id", specifier_id);
+	hal_util_get_int_from_file  (sysfs_path, "version", &version, 16);
+	hal_device_property_set_int (d, "ieee1394_unit.version", version);
+
+	if (specifier_id == 0x00609e && version == 0x010483) {
+		hal_device_add_capability (d, "ieee1394_unit.sbp2");
+	} else if (specifier_id == 0x00a02d) {
+		if ((version & 0xffff00) == 0x000100)
+			hal_device_add_capability (d, "ieee1394_unit.iidc");
+		if ((version & 0xff0001) == 0x010001)
+			hal_device_add_capability (d, "ieee1394_unit.avc");
+		if ((version & 0xff0002) == 0x010002)
+			hal_device_add_capability (d, "ieee1394_unit.cal");
+		if ((version & 0xff0004) == 0x010004)
+			hal_device_add_capability (d, "ieee1394_unit.ehs");
+		if ((version & 0xff0004) == 0x010008)
+			hal_device_add_capability (d, "ieee1394_unit.havi");
+	} else if (specifier_id == 0x000b09d && version == 0x800002) {
+		/* Workaround for pointgrey cameras taken from libdc1394 */
+		hal_device_add_capability (d, "ieee1394_unit.iidc");
+	}
+
+	return d;
+}
+
+static HalDevice *
+firewire_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	int device_id;
+	int unit_id;
+	const char *bus_id;
+
+	if (parent_dev == NULL)
+		return NULL;
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+
+	if (sscanf (bus_id, "fw%d.%d", &device_id, &unit_id) == 2 ) {
+		return firewire_add_unit (sysfs_path, unit_id, parent_dev);
+	} else if (sscanf (bus_id, "fw%d", &device_id) == 1) {
+		return firewire_add_device (sysfs_path, device_file, parent_dev);
+	} else {
+		return NULL;
+	}
+}
+
+static const gchar *
+firewire_get_prober (HalDevice *d)
+{
+	const char *prober = NULL;
+
+	/* run prober only for AVC devices */
+	if (hal_device_has_capability (d, "ieee1394_unit.avc")) {
+		prober = "hald-probe-ieee1394-unit";
+	}
+
+	return prober;
+}
+
+static gboolean
+firewire_post_probing (HalDevice *d)
+{
+	return TRUE;
+}
+
+
+static gboolean
+firewire_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	if (hal_device_has_capability (d, "ieee1394")) {
+		hald_compute_udi (udi, sizeof (udi),
+				  "/org/freedesktop/Hal/devices/ieee1394_guid%0llx",
+				  hal_device_property_get_uint64 (d, "ieee1394.guid"));
+	} else {
+		hald_compute_udi (udi, sizeof (udi),
+				  "%s_unit%d",
+				  hal_device_property_get_string (d, "ieee1394_unit.originating_device"),
+				  hal_device_property_get_int (d, "ieee1394_unit.unit_index"));
+	}
+
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+ide_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+	guint host, channel;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+
+	sscanf (bus_id, "%d.%d", &host, &channel);
+	hal_device_property_set_int (d, "ide.host", host);
+	hal_device_property_set_int (d, "ide.channel", channel);
+
+	if (channel == 0) {
+		hal_device_property_set_string (d, "info.product", "IDE device (master)");
+	} else {
+		hal_device_property_set_string (d, "info.product", "IDE device (slave)");
+	}
+	
+	return d;
+}
+
+static gboolean
+ide_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_ide_%d_%d",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_int (d, "ide.host"),
+			  hal_device_property_get_int (d, "ide.channel"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+ieee1394_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	long long unsigned int guid;
+	gint host_id;
+	const gchar *bus_id;
+	gchar buf[64];
+
+	d = NULL;
+
+	if (parent_dev == NULL)
+		goto out;
+
+	/* skip the useless class devices, which should be removed from the kernel */
+	if (strstr(sysfs_path, "/class/") != NULL)
+		goto out;
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+
+	if (sscanf (bus_id, "fw-host%d", &host_id) == 1)
+		goto out;
+
+	if (sscanf (bus_id, "%llx-%d", &guid, &host_id) !=2 )
+		goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_device_property_set_uint64 (d, "ieee1394.guid", guid);
+	hal_util_set_int_from_file    (d, "ieee1394.vendor_id", sysfs_path, "../vendor_id", 16);
+	hal_util_set_int_from_file    (d, "ieee1394.specifier_id", sysfs_path, "specifier_id", 16);
+	hal_util_set_int_from_file    (d, "ieee1394.version", sysfs_path, "version", 16);
+
+	if (!hal_util_set_string_from_file (d, "ieee1394.vendor", sysfs_path, "../vendor_oui")) {
+		g_snprintf (buf, sizeof (buf), "Unknown (0x%06x)", 
+			    hal_device_property_get_int (d, "ieee1394.vendor_id"));
+		hal_device_property_set_string (d, "ieee1394.vendor", buf);
+	}
+
+	/* not all devices have product_id */
+	if (hal_util_set_int_from_file    (d, "ieee1394.product_id", sysfs_path, "model_id", 16)) {
+		if (!hal_util_set_string_from_file (d, "ieee1394.product", sysfs_path, "model_name_kv")) {
+			g_snprintf (buf, sizeof (buf), "Unknown (0x%06x)", 
+				    hal_device_property_get_int (d, "ieee1394.product_id"));
+			hal_device_property_set_string (d, "ieee1394.product", buf);
+		}
+	} else {
+		hal_device_property_set_int (d, "ieee1394.product_id", 0x000000);
+		hal_device_property_set_string (d, "ieee1394.product",
+						hal_device_property_get_string (d, "ieee1394.vendor"));
+	}
+		
+	hal_device_property_set_string (d, "info.vendor",
+					hal_device_property_get_string (d, "ieee1394.vendor"));
+	hal_device_property_set_string (d, "info.product",
+					hal_device_property_get_string (d, "ieee1394.product"));
+
+out:
+	return d;
+}
+
+static gboolean
+ieee1394_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/ieee1394_guid_%0llx",
+			  hal_device_property_get_uint64 (d, "ieee1394.guid"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
 static int
 input_str_to_bitmask (const char *s, long *bitmask, size_t max_size)
 {
@@ -407,88 +1190,191 @@ input_compute_udi (HalDevice *d)
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
+static inline void
+iucv_add_netiucv_properties (HalDevice *d, const gchar *sysfs_path)
+{
+	hal_util_set_string_from_file (d, "iucv.netiucv.user", sysfs_path,
+				       "user");
+	hal_util_set_int_from_file (d, "iucv.netiucv.buffer", sysfs_path,
+				    "buffer", 10);
+}
+
 static HalDevice *
-bluetooth_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, 
-	       const gchar *parent_path)
+iucv_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-	const char *type_entry;
-	const char *addr_entry;
-        unsigned int a5, a4, a3, a2, a1, a0;
-        dbus_uint64_t address;
+	const gchar *bus_id;
+	gchar driver_name[256];
 
-	d = NULL;
+	bus_id = hal_util_get_last_element (sysfs_path);
 
-	if (parent_dev == NULL) {
-		goto out;
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL)
+                hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+        else
+                hal_device_property_set_string
+		  (d, "info.parent",
+		   "/org/freedesktop/Hal/devices/computer");
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_device_property_set_string (d, "iucv.bus_id", bus_id);
+
+	if (hal_util_get_driver_name (sysfs_path, driver_name)) {
+		if (!strncmp (driver_name, "netiucv", 7))
+			iucv_add_netiucv_properties (d, sysfs_path);
 	}
+	return d;
+}
 
-	addr_entry = hal_util_get_string_from_file (sysfs_path, "address");
-        if (addr_entry == NULL)
-                goto out;
+static gboolean
+iucv_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
 
-        if (sscanf (addr_entry, "%x:%x:%x:%x:%x:%x", &a5, &a4, &a3, &a2, &a1, &a0) != 6) {
-                goto out;
-        }
-        address = ((dbus_uint64_t)a5<<40) |
-                ((dbus_uint64_t)a4<<32) | 
-                ((dbus_uint64_t)a3<<24) | 
-                ((dbus_uint64_t)a2<<16) | 
-                ((dbus_uint64_t)a1<< 8) | 
-                ((dbus_uint64_t)a0<< 0);
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/iucv_%s",
+			  hal_device_property_get_string
+			  (d, "iucv.bus_id"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
 
-	type_entry = hal_util_get_string_from_file (sysfs_path, "type");
-        if (type_entry == NULL)
-                goto out;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+mmc_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+	gint host_num, rca, manfid, oemid;
+	gchar *scr, *type;
+
+	if (parent_dev == NULL) {
+		d = NULL;
+		goto out;
+	}
 
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
 	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
 
-	if (strcmp (type_entry, "ACL") == 0) {
-		hal_device_property_set_string (d, "info.category", "bluetooth_acl");
-		hal_device_add_capability (d, "bluetooth_acl");
-                hal_device_property_set_uint64 (d, "bluetooth_acl.address", address);
-		hal_device_property_set_string (d, "info.product", "Bluetooth Asynchronous Connection-oriented Link");
-		hal_device_property_set_string (d, "bluetooth_acl.originating_device", hal_device_get_udi (parent_dev));
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
 
-	} else if (strcmp (type_entry, "SCO") == 0) {
-		hal_device_property_set_string (d, "info.category", "bluetooth_sco");
-		hal_device_add_capability (d, "bluetooth_sco");
-                hal_device_property_set_uint64 (d, "bluetooth_sco.address", address);
-		hal_device_property_set_string (d, "info.product", "Bluetooth Synchronous Connection-oriented Link");
-		hal_device_property_set_string (d, "bluetooth_sco.originating_device", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.category", "bluetooth_hci");
-		hal_device_add_capability (d, "bluetooth_hci");
-		hal_device_property_set_string (d, "info.product", "Bluetooth Host Controller Interface");
-		hal_device_property_set_string (d, "bluetooth_hci.originating_device", hal_device_get_udi (parent_dev));
-                hal_device_property_set_uint64 (d, "bluetooth_hci.address", address);
+	bus_id = hal_util_get_last_element (sysfs_path);
+	sscanf (bus_id, "mmc%d:%x", &host_num, &rca);
+	hal_device_property_set_int (d, "mmc.rca", rca);
+	
+	hal_util_set_string_from_file (d, "mmc.cid", sysfs_path, "cid");
+	hal_util_set_string_from_file (d, "mmc.csd", sysfs_path, "csd");
+	
+	type = hal_util_get_string_from_file (sysfs_path, "type");
+	if (type != NULL)
+		/* Possible MMC/SD/SDIO */
+		hal_device_property_set_string (d, "mmc.type", type);
+
+	scr = hal_util_get_string_from_file (sysfs_path, "scr");
+	if (scr != NULL) {
+		if (strcmp (scr, "0000000000000000") == 0)
+			scr = NULL;
+		else
+			hal_device_property_set_string (d, "mmc.scr", scr);
 	}
 
+	if (!hal_util_set_string_from_file (d, "info.product", sysfs_path, "name")) {
+		gchar buf[64];
+		if (type != NULL) {
+			g_snprintf(buf, sizeof(buf), "%s Card", type);
+			hal_device_property_set_string (d, "info.product", buf);
+		} else if (scr != NULL) {
+			g_snprintf(buf, sizeof(buf), "SD Card");
+			hal_device_property_set_string (d, "info.product", buf);
+		} else {
+			g_snprintf(buf, sizeof(buf), "MMC Card");
+                }
+		hal_device_property_set_string (d, "mmc.product", buf);
+	}
+	
+	if (hal_util_get_int_from_file (sysfs_path, "manfid", &manfid, 16)) {
+		/* TODO: Here we should have a mapping to a name */
+		char vendor[256];
+		snprintf(vendor, 256, "Unknown (%d)", manfid);
+		hal_device_property_set_string (d, "info.vendor", vendor);
+		hal_device_property_set_string (d, "mmc.vendor", vendor);
+	}
+	if (hal_util_get_int_from_file (sysfs_path, "oemid", &oemid, 16)) {
+		/* TODO: Here we should have a mapping to a name */
+		char oem[256];
+		snprintf(oem, 256, "Unknown (%d)", oemid);
+		hal_device_property_set_string (d, "mmc.oem", oem);
+	}
+
+	hal_util_set_string_from_file (d, "mmc.date", sysfs_path, "date");
+	hal_util_set_int_from_file (d, "mmc.hwrev", sysfs_path, "hwrev", 16);
+	hal_util_set_int_from_file (d, "mmc.fwrev", sysfs_path, "fwrev", 16);
+	hal_util_set_int_from_file (d, "mmc.serial", sysfs_path, "serial", 16);
+
 out:
 	return d;
 }
 
 static gboolean
-bluetooth_compute_udi (HalDevice *d)
+mmc_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	if (hal_device_has_capability (d, "bluetooth_acl")) {
-		hald_compute_udi (udi, sizeof (udi),
-                                  "/org/freedesktop/Hal/devices/bluetooth_acl_%0llx",
-                                  hal_device_property_get_uint64 (d, "bluetooth_acl.address"));
-	} else if (hal_device_has_capability (d, "bluetooth_sco")) {
-		hald_compute_udi (udi, sizeof (udi),
-                                  "/org/freedesktop/Hal/devices/bluetooth_acl_%0llx",
-                                  hal_device_property_get_uint64 (d, "bluetooth_acl.address"));
-	} else {
-		hald_compute_udi (udi, sizeof (udi),
-                                  "%s_bluetooth_hci_%0llx",
-                                  hal_device_property_get_string (d, "info.parent"),
-                                  hal_device_property_get_uint64 (d, "bluetooth_hci.address"));
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_mmc_card_rca%d",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_int (d, "mmc.rca"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+mmc_host_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	gint host_num;
+	const gchar *last_elem;
+
+	d = NULL;
+
+	if (parent_dev == NULL || parent_path == NULL) {
+		goto out;
 	}
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+
+	hal_device_property_set_string (d, "info.category", "mmc_host");
+	hal_device_add_capability (d, "mmc_host");
+
+	hal_device_property_set_string (d, "info.product", "MMC/SD Host Adapter");
+
+	last_elem = hal_util_get_last_element (sysfs_path);
+	sscanf (last_elem, "mmc%d", &host_num);
+	hal_device_property_set_int (d, "mmc_host.host", host_num);
+
+out:
+	return d;
+}
+
+static gboolean
+mmc_host_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_mmc_host",
+			  hal_device_property_get_string (d, "info.parent"));
 	hal_device_set_udi (d, udi);
 	return TRUE;
 }
@@ -670,6 +1556,1038 @@ net_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
+of_platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
+		 const gchar *sysfs_path_in_devices)
+{
+	HalDevice *d;
+	const gchar *dev_id;
+	gchar buf[64];
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	dev_id = hal_util_get_last_element (sysfs_path);
+
+	hal_device_property_set_string (d, "of_platform.id", dev_id);
+
+	g_snprintf (buf, sizeof (buf), "OpenFirmware Platform Device (%s)", hal_device_property_get_string (d, "of_platform.id"));
+	hal_device_property_set_string (d, "info.product", buf);
+
+	return d;
+}
+
+static gboolean
+of_platform_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi), "/org/freedesktop/Hal/devices/of_platform_%s",
+			 hal_device_property_get_string (d, "of_platform.id"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	gint device_class;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_device_property_set_string (d, "pci.linux.sysfs_path", sysfs_path);
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	if(!hal_util_set_int_from_file (d, "pci.product_id", sysfs_path, "device", 16) ||
+	   !hal_util_set_int_from_file (d, "pci.vendor_id", sysfs_path, "vendor", 16)) {
+		HAL_ERROR(("Could not get PCI product or vendor ID, don't add device, this info is mandatory!"));
+		return NULL;
+	}
+
+	hal_util_set_int_from_file (d, "pci.subsys_product_id", sysfs_path, "subsystem_device", 16);
+	hal_util_set_int_from_file (d, "pci.subsys_vendor_id", sysfs_path, "subsystem_vendor", 16);
+
+	if (hal_util_get_int_from_file (sysfs_path, "class", &device_class, 16)) {
+		hal_device_property_set_int (d, "pci.device_class", ((device_class >> 16) & 0xff));
+		hal_device_property_set_int (d, "pci.device_subclass", ((device_class >> 8) & 0xff));
+		hal_device_property_set_int (d, "pci.device_protocol", (device_class & 0xff));
+	}
+
+	{
+		gchar buf[64];
+		char *vendor_name = NULL;
+		char *product_name = NULL;
+		char *subsys_vendor_name = NULL;
+		char *subsys_product_name = NULL;
+
+		ids_find_pci (hal_device_property_get_int (d, "pci.vendor_id"), 
+			      hal_device_property_get_int (d, "pci.product_id"), 
+			      hal_device_property_get_int (d, "pci.subsys_vendor_id"), 
+			      hal_device_property_get_int (d, "pci.subsys_product_id"), 
+			      &vendor_name, &product_name, &subsys_vendor_name, &subsys_product_name);
+
+		if (vendor_name != NULL) {
+			hal_device_property_set_string (d, "pci.vendor", vendor_name);
+			hal_device_property_set_string (d, "info.vendor", vendor_name);
+		} else {
+			g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", 
+				    hal_device_property_get_int (d, "pci.vendor_id"));
+			hal_device_property_set_string (d, "info.vendor", buf);
+		}
+
+		if (product_name != NULL) {
+			hal_device_property_set_string (d, "pci.product", product_name);
+			hal_device_property_set_string (d, "info.product", product_name);
+		} else {
+			g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", 
+				    hal_device_property_get_int (d, "pci.product_id"));
+			hal_device_property_set_string (d, "info.product", buf);
+		}
+
+		if (subsys_vendor_name != NULL) {
+			hal_device_property_set_string (d, "pci.subsys_vendor", subsys_vendor_name);
+		} 
+		if (subsys_product_name != NULL) {
+			hal_device_property_set_string (d, "pci.subsys_product", subsys_product_name);
+		}
+	}
+
+	return d;
+}
+
+static gboolean
+pci_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/pci_%x_%x",
+			  hal_device_property_get_int (d, "pci.vendor_id"),
+			  hal_device_property_get_int (d, "pci.product_id"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+pcmcia_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+	guint socket, function;
+	const char *prod_id1;
+	const char *prod_id2;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	/* not sure if %d.%d means socket function - need to revisit */
+	sscanf (bus_id, "%d.%d", &socket, &function);
+	hal_device_property_set_int (d, "pcmcia.socket_number", socket);
+
+	hal_util_set_string_from_file (d, "pcmcia.prod_id1", sysfs_path, "prod_id1");
+	hal_util_set_string_from_file (d, "pcmcia.prod_id2", sysfs_path, "prod_id2");
+	hal_util_set_string_from_file (d, "pcmcia.prod_id3", sysfs_path, "prod_id3");
+	hal_util_set_string_from_file (d, "pcmcia.prod_id4", sysfs_path, "prod_id4");
+
+	hal_util_set_int_from_file (d, "pcmcia.manf_id", sysfs_path, "manf_id", 16);
+	hal_util_set_int_from_file (d, "pcmcia.card_id", sysfs_path, "card_id", 16);
+	hal_util_set_int_from_file (d, "pcmcia.func_id", sysfs_path, "func_id", 16);
+
+	prod_id1 = hal_device_property_get_string (d, "pcmcia.prod_id1");
+	prod_id2 = hal_device_property_get_string (d, "pcmcia.prod_id2");
+
+	/* Provide best-guess of vendor, goes in Vendor property */
+	if (prod_id1 != NULL) {
+		hal_device_property_set_string (d, "pcmcia.vendor", prod_id1);
+		hal_device_property_set_string (d, "info.vendor", prod_id1);
+	} else {
+		char buf[50];
+		g_snprintf (buf, sizeof(buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "pcmcia.manf_id"));
+		hal_device_property_set_string (d, "info.vendor", buf);
+	}
+
+	/* Provide best-guess of name, goes in Product property */
+	if (prod_id2 != NULL) {
+		hal_device_property_set_string (d, "pcmcia.product", prod_id1);
+		hal_device_property_set_string (d, "info.product", prod_id2);
+	} else {
+		char buf[50];
+		g_snprintf (buf, sizeof(buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "pcmcia.card_id"));
+		hal_device_property_set_string (d, "info.product", buf);
+	}
+
+	return d;
+}
+
+static gboolean
+pcmcia_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/pcmcia_%d_%d",
+			  hal_device_property_get_int (d, "pcmcia.manfid1"),
+			  hal_device_property_get_int (d, "pcmcia.manfid2"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *dev_id;
+	gchar buf[64];
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	dev_id = hal_util_get_last_element (sysfs_path);
+
+	hal_device_property_set_string (d, "platform.id", dev_id);
+
+	g_snprintf (buf, sizeof (buf), "Platform Device (%s)", hal_device_property_get_string (d, "platform.id"));
+	hal_device_property_set_string (d, "info.product", buf);
+
+	if (strncmp (dev_id, "dock", 4) == 0) {
+		int docked;
+
+		hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
+		hal_device_property_set_bool (d, "info.docked", docked);
+	}
+
+	return d;
+}
+
+static gboolean
+platform_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/platform_%s",
+			  hal_device_property_get_string (d, "platform.id"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+}
+
+static gboolean
+platform_refresh_undock (gpointer data)
+{
+	HalDevice *d;
+	gint flags, docked;
+	const gchar *sysfs_path;
+
+	if (data == NULL)
+		return FALSE;
+	d = (HalDevice *) data;
+
+	sysfs_path = hal_device_property_get_string(d, "linux.sysfs_path");
+	hal_util_get_int_from_file (sysfs_path, "flags", &flags, 0);
+
+	/* check for != 0, maybe the user did an immediate dock */
+	if (flags != 0)
+		return TRUE;
+
+	hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
+	hal_device_property_set_bool (d, "info.docked", docked);
+
+	return FALSE;
+}
+
+static gboolean
+platform_refresh (HalDevice *d)
+{
+	const gchar *id, *sysfs_path;
+	gint docked, flags;
+
+	id = hal_device_property_get_string (d, "platform.id");
+	if (strncmp (id, "dock", 4) != 0)
+		return TRUE;
+
+	sysfs_path = hal_device_property_get_string(d, "linux.sysfs_path");
+	hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
+
+	if (docked == 1) {
+		/* undock still in progress? */
+		hal_util_get_int_from_file (sysfs_path, "flags", &flags, 0);
+		if (flags == 2) {
+			g_timeout_add (DOCK_STATION_UNDOCK_POLL_INTERVAL,
+				       platform_refresh_undock, d);
+			return TRUE;
+		}
+	}
+
+	hal_device_property_set_bool (d, "info.docked", docked);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static void
+pnp_set_serial_info (const gchar *sysfs_path, HalDevice *d) {
+
+	hal_util_set_int_elem_from_file (d, "pnp.serial.irq", sysfs_path, "resources", "irq", 0, 10, TRUE);
+
+	if (hal_util_set_string_elem_from_file (d, "pnp.serial.port", sysfs_path, "resources", "io", 0, TRUE)) {
+		const char* port;
+		const char* _port;
+		_port = hal_device_property_get_string (d, "pnp.serial.port");
+		if(_port == NULL)
+			return;
+
+		port = strtok((char*) _port, "-");
+		if(port == NULL)
+			return;
+
+		hal_device_property_set_string (d, "pnp.serial.port", port);
+	}
+}
+
+
+static HalDevice *
+pnp_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	HalDevice *computer;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_util_set_string_from_file (d, "pnp.id", sysfs_path, "id");
+	if (hal_device_has_property (d, "pnp.id")) {
+		gchar *pnp_description;
+		const char *pnp_id;
+		ids_find_pnp (hal_device_property_get_string (d, "pnp.id"), &pnp_description);
+		if (pnp_description != NULL) {
+			hal_device_property_set_string (d, "pnp.description", pnp_description);
+			hal_device_property_set_string (d, "info.product", pnp_description);
+		}
+		pnp_id = hal_device_property_get_string (d, "pnp.id");
+		if( !strncmp(pnp_id, "WACf00", 6) || !strcmp(pnp_id, "FUJ02e5") ||
+		    !strcmp(pnp_id, "FUJ02e6") || !strcmp(pnp_id, "FPI2004")) {
+			/* a internal serial tablet --> this should be a tablet pc */
+			hal_device_add_capability (d, "input");
+			hal_device_add_capability (d, "input.tablet");
+			hal_device_add_capability (d, "input.tablet.tabletPC");
+
+			if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) != NULL ||
+			    (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) != NULL) {
+
+				hal_device_property_set_string (computer, "system.formfactor", "laptop");
+				hal_device_property_set_string (computer, "system.formfactor.subtype", "tabletpc");
+				/* collect info about serial port and irq etc. */
+				pnp_set_serial_info (sysfs_path, d);
+			}
+		}
+	}
+
+	if (!hal_device_has_property (d, "info.product")) {
+		gchar buf[64];
+		g_snprintf (buf, sizeof (buf), "PnP Device (%s)", hal_device_property_get_string (d, "pnp.id"));
+		hal_device_property_set_string (d, "info.product", buf);
+	}
+
+	
+	return d;
+}
+
+static gboolean
+pnp_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/pnp_%s",
+			  hal_device_property_get_string (d, "pnp.id"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static void
+refresh_ac_adapter (HalDevice *d)
+{
+	const char *path;
+	gboolean present = FALSE;
+
+	path = hal_device_property_get_string (d, "linux.sysfs_path");
+	if (path == NULL)
+		return;
+
+	if (hal_util_get_bool_from_file (path, "online", &present, "1") == FALSE) {
+		/* if we can't read the property, assume on ac */
+		present = TRUE;
+	}
+
+	hal_device_property_set_bool (d, "ac_adapter.present", present);
+}
+
+static void
+refresh_battery_fast (HalDevice *d)
+{
+	gint percentage = 0;
+	gint voltage_now = 0;
+	gint current = 0;
+	gint time = 0;
+	gint value_now = 0;
+	gint value_last_full = 0;
+	gboolean present = FALSE;
+	gboolean unknown_unit = TRUE;
+	gboolean is_mah = FALSE;
+	gboolean is_mwh = FALSE;
+	gboolean is_charging = FALSE;
+	gboolean is_discharging = FALSE;
+	gboolean got_time = FALSE;
+	gboolean got_percentage = FALSE;
+	const gchar *path;
+	const gchar *reporting_unit;
+	gchar *status;
+
+	path = hal_device_property_get_string (d, "linux.sysfs_path");
+	if (path == NULL)
+		return;
+
+	/* PRESENT */
+	if (hal_util_get_bool_from_file (path, "present", &present, "1")) {
+		hal_device_property_set_bool (d, "battery.present", present);
+	}
+	if (present == FALSE) {
+		/* remove all the optional keys associated with the cell */
+		device_pm_remove_optional_props (d);
+		return;
+	}
+
+	/* CAPACITY */
+	if (hal_util_get_int_from_file (path, "capacity", &percentage, 10)) {
+		/* sanity check */
+		if (percentage >= 0 && percentage <= 100)
+			got_percentage = TRUE;
+	}
+
+	/* VOLTAGE: we prefer the average if it exists, although present is still pretty good */
+	if (hal_util_get_int_from_file (path, "voltage_avg", &voltage_now, 10)) {
+		hal_device_property_set_int (d, "battery.voltage.current", voltage_now / 1000);
+	} else if (hal_util_get_int_from_file (path, "voltage_now", &voltage_now, 10)) {
+		hal_device_property_set_int (d, "battery.voltage.current", voltage_now / 1000);
+	}
+
+	/* CURRENT: we prefer the average if it exists, although present is still pretty good */
+	if (hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
+		hal_device_property_set_int (d, "battery.reporting.rate", current / 1000);
+	} else if (hal_util_get_int_from_file (path, "current_now", &current, 10)) {
+		hal_device_property_set_int (d, "battery.reporting.rate", current / 1000);
+	}
+
+	/* STATUS: Convert to charging/discharging state */
+	status = hal_util_get_string_from_file (path, "status");
+	if (status != NULL) {
+		if (strcasecmp (status, "charging") == 0) {
+			is_charging = TRUE;
+		} else if (strcasecmp (status, "discharging") == 0) {
+			is_discharging = TRUE;
+		}
+		hal_device_property_set_bool (d, "battery.is_rechargeable", TRUE);
+		hal_device_property_set_bool (d, "battery.rechargeable.is_charging", is_charging);
+		hal_device_property_set_bool (d, "battery.rechargeable.is_discharging", is_discharging);
+	}
+
+	/* TIME: Some batteries only provide time to discharge */
+	if (is_charging == TRUE) {
+		if (hal_util_get_int_from_file (path, "time_to_full_avg", &time, 10) ||
+		    hal_util_get_int_from_file (path, "time_to_full_now", &time, 10)) {
+			got_time = TRUE;
+		}
+	} else if (is_discharging == TRUE) {
+		if (hal_util_get_int_from_file (path, "time_to_empty_avg", &time, 10) ||
+		    hal_util_get_int_from_file (path, "time_to_empty_now", &time, 10)) {
+			got_time = TRUE;
+		}
+	}
+
+	/* Have we already got information about the reporting unit?
+	 * If we have, we can save a lots of file reads */
+	reporting_unit = hal_device_property_get_string (d, "battery.reporting.unit");
+	if (reporting_unit != NULL) {
+		if (strcasecmp (reporting_unit, "mah") == 0) {
+			is_mah = TRUE;
+			unknown_unit = FALSE;
+		} else if (strcasecmp (reporting_unit, "mwh") == 0) {
+			is_mwh = TRUE;
+			unknown_unit = FALSE;
+		}
+	}
+
+	/* ENERGY (reported in uWh, so need to convert to mWh) */
+	if (unknown_unit || is_mwh) {
+		if (hal_util_get_int_from_file (path, "energy_avg", &value_now, 10)) {
+			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
+			is_mwh = TRUE;
+		} else if (hal_util_get_int_from_file (path, "energy_now", &value_now, 10)) {
+			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
+			is_mwh = TRUE;
+		}
+		if (hal_util_get_int_from_file (path, "energy_full", &value_last_full, 10)) {
+			hal_device_property_set_int (d, "battery.reporting.last_full", value_last_full / 1000);
+			is_mwh = TRUE;
+		}
+	}
+
+	/* CHARGE (reported in uAh, so need to convert to mAh) */
+	if ((unknown_unit && !is_mwh) || is_mah) {
+		if (hal_util_get_int_from_file (path, "charge_avg", &value_now, 10)) {
+			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
+			is_mah = TRUE;
+		} else if (hal_util_get_int_from_file (path, "charge_now", &value_now, 10)) {
+			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
+			is_mah = TRUE;
+		}
+		if (hal_util_get_int_from_file (path, "charge_full", &value_last_full, 10)) {
+			hal_device_property_set_int (d, "battery.reporting.last_full", value_last_full / 1000);
+			is_mah = TRUE;
+		}
+	}
+
+	/* record these for future savings */
+	if (unknown_unit) {
+		if (is_mwh == TRUE) {
+			hal_device_property_set_string (d, "battery.reporting.unit", "mWh");
+		} else if (is_mah == TRUE) {
+			hal_device_property_set_string (d, "battery.reporting.unit", "mAh");
+		}
+	}
+
+	/* we've now got the 'reporting' keys, now we need to populate the
+	 * processed 'charge_level' keys so stuff like desktop power managers
+	 * do not have to deal with odd quirks */
+	device_pm_abstract_props (d);
+
+	/* if we have not read from the hardware, then calculate */
+	if (got_percentage) {
+		hal_device_property_set_int (d, "battery.charge_level.percentage", percentage);
+	} else {
+		device_pm_calculate_percentage (d);
+	}
+
+	/* if we havn't got time from the hardware, then try to calculate it */
+	if (got_time) {
+		/* zero time isn't displayed */
+		if (time > 0)
+			hal_device_property_set_int (d, "battery.remaining_time", time);
+		else
+			hal_device_property_remove (d, "battery.remaining_time");
+	} else {
+		device_pm_calculate_time (d);
+	}
+}
+
+static void
+refresh_battery_slow (HalDevice *d)
+{
+	gint voltage_design = 0;
+	gint value_full_design = 0;
+	char *technology_raw;
+	char *model_name;
+	char *manufacturer;
+	char *serial;
+	const gchar *path;
+
+	path = hal_device_property_get_string (d, "linux.sysfs_path");
+	if (path == NULL)
+		return;
+
+	/* get battery technology */
+	technology_raw = hal_util_get_string_from_file (path, "technology");
+	if (technology_raw != NULL) {
+		hal_device_property_set_string (d, "battery.reporting.technology", technology_raw);
+	}
+	hal_device_property_set_string (d, "battery.technology", util_get_battery_technology (technology_raw));
+
+	/* get product name */
+	model_name = hal_util_get_string_from_file (path, "model_name");
+	if (model_name != NULL) {
+		hal_device_property_set_string (d, "battery.model", model_name);
+		hal_device_property_set_string (d, "info.product", model_name);
+	} else {
+		hal_device_property_set_string (d, "info.product", "Generic Battery Device");
+	}
+
+	/* get manufacturer */
+	manufacturer = hal_util_get_string_from_file (path, "manufacturer");
+	if (manufacturer != NULL) {
+		hal_device_property_set_string (d, "battery.vendor", manufacturer);
+	}
+
+	/* get stuff that never changes */
+	if (hal_util_get_int_from_file (path, "voltage_max_design", &voltage_design, 10)) {
+		hal_device_property_set_int (d, "battery.voltage.design", voltage_design / 1000);
+		hal_device_property_set_string (d, "battery.voltage.unit", "mV");
+	} else if (hal_util_get_int_from_file (path, "voltage_min_design", &voltage_design, 10)) {
+		hal_device_property_set_int (d, "battery.voltage.design", voltage_design / 1000);
+		hal_device_property_set_string (d, "battery.voltage.unit", "mV");
+	}
+
+	/* try to get the design info and set the units */
+	if (hal_util_get_int_from_file (path, "energy_full_design", &value_full_design, 10)) {
+		hal_device_property_set_int (d, "battery.reporting.design", value_full_design / 1000);
+		hal_device_property_set_string (d, "battery.reporting.unit", "mWh");	
+	} else if (hal_util_get_int_from_file (path, "charge_full_design", &value_full_design, 10)) {
+		hal_device_property_set_int (d, "battery.reporting.design", value_full_design / 1000);
+		hal_device_property_set_string (d, "battery.reporting.unit", "mAh");
+	}
+
+	/* get serial */
+	serial = hal_util_get_string_from_file (path, "serial_number");
+	if (serial != NULL) {
+		hal_device_property_set_string (d, "battery.serial", serial);
+	}
+
+	/* now do stuff that happens quickly */
+	refresh_battery_fast (d);
+}
+
+static gboolean
+power_supply_refresh (HalDevice *d)
+{
+	const gchar *type;
+	type = hal_device_property_get_string (d, "info.category");
+	if (type == NULL) {
+		return FALSE;
+	}
+	if (strcmp (type, "ac_adapter") == 0) {
+		device_property_atomic_update_begin ();
+		refresh_ac_adapter (d);
+		device_property_atomic_update_end ();
+	} else if (strcmp (type, "battery") == 0) {
+		device_property_atomic_update_begin ();
+		refresh_battery_fast (d);
+		device_property_atomic_update_end ();
+	} else {
+		HAL_WARNING (("Could not recognise power_supply type!"));
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static gboolean 
+power_supply_battery_poll (gpointer data) {
+
+	GSList *i;
+	GSList *battery_devices;
+	HalDevice *d;
+	gboolean battery_polled = FALSE;
+
+	/* for now do it only for primary batteries and extend if neede for the other types */
+	battery_devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
+                                                                    	    "battery.type",
+ 	                                                                    "primary");
+
+	if (battery_devices) {
+		for (i = battery_devices; i != NULL; i = g_slist_next (i)) {
+			const char *subsys;
+
+			d = HAL_DEVICE (i->data);
+
+			/* don't poll batteries if quirk is in place */
+			if (hal_device_property_get_bool (d, "battery.quirk.do_not_poll"))
+				continue;
+
+			subsys = hal_device_property_get_string (d, "info.subsystem");
+			if (subsys && (strcmp(subsys, "power_supply") == 0)) {
+				hal_util_grep_discard_existing_data();
+				device_property_atomic_update_begin ();
+				refresh_battery_fast(d);
+				device_property_atomic_update_end ();
+				battery_polled = TRUE;
+			}
+		}		
+	}
+
+	g_slist_free (battery_devices);
+
+	battery_poll_running = battery_polled;
+	return battery_polled;
+}
+
+static HalDevice *
+power_supply_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev,
+		  const gchar *sysfs_path_in_devices)
+{
+	HalDevice *d = NULL;
+	gboolean is_battery = FALSE;
+	gboolean is_ac_adapter = FALSE;
+	char *type = NULL;
+	const char *battery_type = NULL;
+
+	/* power_supply devices are very odd, they might be batteries or ac-adapters */
+	type = hal_util_get_string_from_file (sysfs_path, "type");
+	if (type == NULL) {
+		/* we don't need to free */
+		goto finish;
+	}
+	if (strcasecmp (type, "battery") == 0) {
+		is_battery = TRUE;
+		battery_type = "primary";
+	} else if (strcasecmp (type, "ups") == 0) {
+		is_battery = TRUE;
+		battery_type = "ups";
+	} else if (strcasecmp (type, "usb") == 0) {
+		is_battery = TRUE;
+		battery_type = "usb";
+	} else if (strcasecmp (type, "mains") == 0) {
+		is_ac_adapter = TRUE;
+	} else {
+		HAL_WARNING (("Power supply is neither ac_adapter or battery!"));
+		goto finish;
+	}
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+
+	if (is_battery == TRUE) {
+		hal_device_property_set_string (d, "info.category", "battery");
+		if (battery_type != NULL)
+			hal_device_property_set_string (d, "battery.type", battery_type);
+		refresh_battery_slow (d);
+		hal_device_add_capability (d, "battery");
+
+		/* setup timer for things that we need to poll */
+		if (!battery_poll_running) {
+#ifdef HAVE_GLIB_2_14
+			g_timeout_add_seconds (POWER_SUPPLY_BATTERY_POLL_INTERVAL,
+                                               power_supply_battery_poll,
+                                               NULL);
+#else
+			g_timeout_add (1000 * POWER_SUPPLY_BATTERY_POLL_INTERVAL,
+                                       power_supply_battery_poll,
+                                       NULL);
+#endif
+			battery_poll_running = TRUE;
+		}
+	}
+
+	if (is_ac_adapter == TRUE) {
+		hal_device_property_set_string (d, "info.category", "ac_adapter");
+		hal_device_property_set_string (d, "info.product", "Generic AC Adapter Device");
+		refresh_ac_adapter (d);
+		hal_device_add_capability (d, "ac_adapter");
+	}
+
+	_have_sysfs_power_supply = TRUE;
+finish:
+	return d;
+}
+
+static gboolean
+power_supply_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+	const char *dir;
+	const char *name;
+
+	dir = hal_device_property_get_string (d, "linux.sysfs_path");
+
+	name = hal_util_get_last_element(dir);
+	if (name) 
+		hald_compute_udi (udi, sizeof (udi),
+				  "%s_power_supply_%s_%s",
+				  hal_device_property_get_string (d, "info.parent"),
+				  hal_device_property_get_string (d, "info.category"),
+				  name);
+	else
+		hald_compute_udi (udi, sizeof (udi),
+				  "%s_power_supply_%s",
+				  hal_device_property_get_string (d, "info.parent"),
+				  hal_device_property_get_string (d, "info.category"));
+
+	hal_device_set_udi (d, udi);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+ps3_system_bus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
+		    const gchar *sysfs_path_in_devices)
+{
+	HalDevice *d;
+	const gchar *dev_id;
+	gchar buf[64];
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	dev_id = hal_util_get_last_element (sysfs_path);
+
+	hal_device_property_set_string (d, "ps3_system_bus.id", dev_id);
+
+	g_snprintf (buf, sizeof (buf), "PS3 Device (%s)", hal_device_property_get_string (d, "ps3_system_bus.id"));
+	hal_device_property_set_string (d, "info.product", buf);
+
+	return d;
+}
+
+static gboolean
+ps3_system_bus_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/ps3_system_bus_%s",
+			  hal_device_property_get_string (d, "ps3_system_bus.id"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *dev_id;
+	gchar buf[64];
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	dev_id = hal_util_get_last_element (sysfs_path);
+	hal_device_property_set_string (d, "pseudo.id", dev_id);
+
+	g_snprintf (buf, sizeof (buf), "SCSI Debug Device (%s)", hal_device_property_get_string (d, "pseudo.id"));
+	hal_device_property_set_string (d, "info.product", buf);
+
+	return d;
+}
+
+static gboolean
+pseudo_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "/org/freedesktop/Hal/devices/pseudo",
+			  hal_device_property_get_string (d, "platform.id"));
+	hal_device_set_udi (d, udi);
+
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+rfkill_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+        gchar buf[64];
+	const gchar *type;
+
+	d = hal_device_new ();
+	hal_device_add_capability (d, "killswitch");
+	hal_device_property_set_string (d, "info.category", "killswitch");
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+		hal_device_copy_property( parent_dev, "info.vendor", d, "info.vendor");
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	type = hal_util_get_string_from_file (sysfs_path, "type");
+	if (type == NULL)
+		type = "unknown";
+
+	if (strcasecmp (type, "wimax") == 0) {
+		hal_device_property_set_string (d, "killswitch.type", "wwan");
+	} else { 
+		hal_device_property_set_string (d, "killswitch.type", type);
+	}
+
+	hal_util_set_string_from_file (d, "killswitch.name", sysfs_path, "name");
+
+        g_snprintf(buf, sizeof(buf), "%s %s Killswitch", hal_device_property_get_string (d, "killswitch.name"),
+							 hal_device_property_get_string (d, "killswitch.type"));
+        hal_device_property_set_string (d, "info.product", buf);
+
+	return d;
+}
+
+static gboolean
+rfkill_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_rfkill_%s_%s",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_string (d, "killswitch.name"),
+			  hal_device_property_get_string (d, "killswitch.type"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+scsi_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d = NULL;
+	const gchar *bus_id;
+	gint host_num, bus_num, target_num, lun_num;
+	int type;
+
+	if (parent_dev == NULL)
+		goto out;
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+	if (sscanf (bus_id, "%d:%d:%d:%d", &host_num, &bus_num, &target_num, &lun_num) != 4)
+		goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	hal_device_property_set_int (d, "scsi.host", host_num);
+	hal_device_property_set_int (d, "scsi.bus", bus_num);
+	hal_device_property_set_int (d, "scsi.target", target_num);
+	hal_device_property_set_int (d, "scsi.lun", lun_num);
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_device_property_set_string (d, "info.product", "SCSI Device");
+
+	hal_util_set_string_from_file (d, "scsi.model", sysfs_path, "model");
+	hal_util_set_string_from_file (d, "scsi.vendor", sysfs_path, "vendor");
+	hal_util_get_int_from_file (sysfs_path, "type", &type, 0);
+	HAL_INFO (("%s/type -> %d (-> scsi.type)", sysfs_path, type));
+	switch (type) {
+	case 0:  /* TYPE_DISK (disk) */
+	case 7:  /* TYPE_MOD (Magneto-optical disk) */
+	case 14: /* TYPE_RBC (Reduced Block Commands)
+		  * Simple Direct Access Device, set it to disk
+		  * (some Firewire Disks use it)
+		  */
+		hal_device_property_set_string (d, "scsi.type", "disk");
+		break;
+	case 1: /* TYPE_TAPE (Tape) */
+		hal_device_property_set_string (d, "scsi.type", "tape");
+		break;
+	case 2:
+		/* TYPE_PRINTER (Tape) */
+		hal_device_property_set_string (d, "scsi.type", "printer");
+		break;
+	case 3:  /* TYPE_PROCESSOR */
+		hal_device_property_set_string (d, "scsi.type", "processor");
+		break;
+	case 4: /* TYPE_WORM */
+	case 5: /* TYPE_ROM (CD-ROM) */
+		hal_device_property_set_string (d, "scsi.type", "cdrom");
+		break;
+	case 6: /* TYPE_SCANNER */
+		hal_device_property_set_string (d, "scsi.type", "scanner");
+		break;
+	case 8: /* TYPE_MEDIUM_CHANGER */
+		hal_device_property_set_string (d, "scsi.type", "medium_changer");
+		break;
+	case 9: /* TYPE_COMM */
+		hal_device_property_set_string (d, "scsi.type", "comm");
+		break;
+	case 12: /* TYPE_RAID */
+		hal_device_property_set_string (d, "scsi.type", "raid");
+		break;
+	default:
+		hal_device_property_set_string (d, "scsi.type", "unknown");
+	}
+
+out:
+	return d;
+}
+
+static gboolean
+scsi_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_scsi_device_lun%d",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_int (d, "scsi.lun"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
 scsi_generic_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
@@ -829,206 +2747,191 @@ scsi_host_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-usbclass_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+sdio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-	gint host_num;
-	const gchar *last_elem;
-
-	d = NULL;
-
-	if (parent_dev == NULL || parent_path == NULL || device_file == NULL || device_file[0] == '\0') {
-		goto out;
-	}
-
-	last_elem = hal_util_get_last_element (sysfs_path);
-	if (sscanf (last_elem, "hiddev%d", &host_num) == 1) {
-
-		d = hal_device_new ();
-		hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	const gchar *bus_id;
+	gchar buf[256];
+	gint host_num, rca, card_id;
 
-		hal_device_property_set_string (d, "info.category", "hiddev");
-		hal_device_add_capability (d, "hiddev");
+	if (parent_dev == NULL)
+		return NULL;
 
-		hal_device_property_set_string (d, "info.product", "USB HID Device");
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
 
-		hal_device_property_set_string (d, "hiddev.device", device_file);
-	} else if (sscanf (last_elem, "lp%d", &host_num) == 1) {
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
 
-		d = hal_device_new ();
-		hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	bus_id = hal_util_get_last_element (sysfs_path);
+	sscanf (bus_id, "mmc%d:%x:%d", &host_num, &rca, &card_id);
+	hal_device_property_set_int (d, "sdio.rca", rca);
+	hal_device_property_set_int (d, "sdio.card_id", card_id);
 
-		hal_device_property_set_string (d, "info.category", "printer");
-		hal_device_add_capability (d, "printer");
+	hal_util_set_int_from_file (d, "sdio.vendor_id", sysfs_path, "vendor", 16);
+	hal_util_set_int_from_file (d, "sdio.product_id", sysfs_path, "device", 16);
+	hal_util_set_int_from_file (d, "sdio.class_id", sysfs_path, "class", 16);
 
-		hal_device_property_set_string (d, "info.product", "Printer");
-		hal_device_property_set_string (d, "printer.device", device_file);
+	/* TODO: Here we should have a mapping to a name */
+	g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "sdio.vendor_id"));
+	hal_device_property_set_string (d, "info.vendor", buf);
+	hal_device_property_set_string (d, "sdio.vendor", buf);
 
-		hal_device_property_set_string (d, "printer.originating_device", hal_device_get_udi (parent_dev));
-	}
+	/* TODO: Here we should have a mapping to a name */
+	g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "sdio.product_id"));
+	hal_device_property_set_string (d, "info.product", buf);
+	hal_device_property_set_string (d, "sdio.product", buf);
 
-out:
 	return d;
 }
 
-static const gchar *
-usbclass_get_prober (HalDevice *d)
-{
-	if (hal_device_has_capability (d, "hiddev"))
-		return "hald-probe-hiddev";
-	else if (hal_device_has_capability (d, "printer"))
-		return "hald-probe-printer";
-	else
-		return NULL;
-}
-
 static gboolean
-usbclass_compute_udi (HalDevice *d)
+sdio_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	if (hal_device_has_capability (d, "hiddev")) {
-		hald_compute_udi (udi, sizeof (udi),
-				  "%s_hiddev",
-				  hal_device_property_get_string (d, "info.parent"));
-		hal_device_set_udi (d, udi);
-	} else if (hal_device_has_capability (d, "printer")) {
-		const char *serial;
-
-		serial = hal_device_property_get_string (d, "printer.serial");
-		hald_compute_udi (udi, sizeof (udi),
-				  "%s_printer_%s",
-				  hal_device_property_get_string (d, "info.parent"),
-				  serial != NULL ? serial : "noserial");
-		hal_device_set_udi (d, udi);
-	}
-
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_sdio%d",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_int (d, "sdio.card_id"));
+	hal_device_set_udi (d, udi);
 	return TRUE;
 }
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-usbraw_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+serial_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
+	int portnum;
 	HalDevice *d;
+	const gchar *last_elem;
 
 	d = NULL;
 
-	if (parent_dev == NULL || parent_path == NULL)
+	if (parent_dev == NULL || parent_path == NULL || device_file == NULL || device_file[0] == '\0') {
 		goto out;
+	}
 
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
 	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	hal_device_property_set_string (d, "info.category", "usbraw");
-	hal_device_add_capability (d, "usbraw");
-	hal_device_property_set_string (d, "info.product", "USB Raw Device Access");
-	hal_device_property_set_string (d, "usbraw.device", device_file);
-
-out:
-	return d;
-}
-
-static gboolean
-usbraw_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi), "%s_usbraw",
-			  hal_device_property_get_string (d, "info.parent"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
+	hal_device_property_set_string (d, "info.category", "serial");
+	hal_device_add_capability (d, "serial");
+	hal_device_property_set_string (d, "serial.originating_device", hal_device_get_udi (parent_dev));
+	hal_device_property_set_string (d, "serial.device", device_file);
 
+	last_elem = hal_util_get_last_element(sysfs_path);
+	if (sscanf (last_elem, "ttyS%d", &portnum) == 1) {
+		hal_device_property_set_int (d, "serial.port", portnum);
+		hal_device_property_set_string (d, "serial.type", "platform");
+		hal_device_property_set_string (d, "info.product",
+						hal_device_property_get_string (parent_dev, "info.product"));
+	} else if (sscanf (last_elem, "ttyUSB%d", &portnum) == 1) {
+		HalDevice *usbdev;
 
-/*--------------------------------------------------------------------------------------------------------------*/
+		hal_device_property_set_int (d, "serial.port", portnum);
+		hal_device_property_set_string (d, "serial.type", "usb");
 
-static HalDevice *
-video4linux_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
+		usbdev = hal_device_store_find (hald_get_gdl (), 
+						hal_device_property_get_string (parent_dev, "info.parent"));
+		if (usbdev != NULL) {
+			hal_device_property_set_string (d, "info.product",
+							hal_device_property_get_string (usbdev, "info.product"));
+		} else {
+			hal_device_property_set_string (d, "info.product", "USB Serial Port");
+		}
+	} else {
+		int len;
+		int i;
 
-	d = NULL;
+		len = strlen (last_elem);
 
-	if (parent_dev == NULL || parent_path == NULL)
-		goto out;
+		for (i = len - 1; i >= 0 && isdigit (last_elem[i]); --i)
+			;
+		if (i == len - 1)
+			portnum = 0;
+		else
+			portnum = atoi (last_elem + i + 1);
 
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	hal_device_property_set_string (d, "info.category", "video4linux");
-	hal_device_add_capability (d, "video4linux");
-	hal_device_property_set_string (d, "info.product", "Multimedia Device");
-	hal_device_property_set_string (d, "video4linux.device", device_file);
+		hal_device_property_set_int (d, "serial.port", portnum);
+		hal_device_property_set_string (d, "serial.type", "unknown");
+		hal_device_property_set_string (d, "info.product", "Serial Port");
+	}
 
 out:
 	return d;
 }
 
 static const gchar *
-video4linux_get_prober (HalDevice *d)
+serial_get_prober (HalDevice *d)
 {
-	const char *prober = NULL;
-
-	/* run prober only for video4linux devices */
-	if (hal_device_has_capability (d, "video4linux")) {
-		prober = "hald-probe-video4linux";
-	}
+	const gchar *dev;
 
-	return prober;
+	/* FIXME TODO: check if there is an other way, to call the porber only
+		       on ttyS* devices, than check the name of the device file */
+	dev  = hal_device_property_get_string (d, "linux.device_file");
+	if (dev && !strncmp(dev, "/dev/ttyS", 9))
+		return "hald-probe-serial";
+	else 
+		return NULL;
 }
 
 static gboolean
-video4linux_compute_udi (HalDevice *d)
+serial_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	hald_compute_udi (udi, sizeof (udi), "%s_video4linux",
-			  hal_device_property_get_string (d, "info.parent"));
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_serial_%s_%d",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_string (d, "serial.type"),
+			  hal_device_property_get_int (d, "serial.port"));
 	hal_device_set_udi (d, udi);
 
 	return TRUE;
 }
 
-
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-dvb_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+serio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-
-	d = NULL;
-
-	if (parent_dev == NULL || parent_path == NULL)
-		goto out;
+	const gchar *bus_id;
 
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	hal_device_property_set_string (d, "info.category", "dvb");
-	hal_device_add_capability (d, "dvb");
-	hal_device_property_set_string (d, "info.product", "DVB Device");
-	hal_device_property_set_string (d, "dvb.device", device_file);
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
 
-out:
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+	hal_device_property_set_string (d, "serio.id", bus_id);
+	if (!hal_util_set_string_from_file (d, "serio.description", sysfs_path, "description")) {
+		hal_device_property_set_string (d, "serio.description", hal_device_property_get_string (d, "serio.id"));
+	}
+	hal_device_property_set_string (d, "info.product", hal_device_property_get_string (d, "serio.description"));
+	
 	return d;
 }
 
 static gboolean
-dvb_compute_udi (HalDevice *d)
+serio_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	hald_compute_udi (udi, sizeof (udi), "%s_dvb",
-			  hal_device_property_get_string (d, "info.parent"));
+	hald_compute_udi (udi, sizeof (udi),
+			  "%s_%s",
+			  hal_device_property_get_string (d, "info.parent"),
+			  hal_device_property_get_string (d, "serio.description"));
 	hal_device_set_udi (d, udi);
-
 	return TRUE;
+
 }
 
 /*--------------------------------------------------------------------------------------------------------------*/
@@ -1357,100 +3260,6 @@ sound_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-serial_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	int portnum;
-	HalDevice *d;
-	const gchar *last_elem;
-
-	d = NULL;
-
-	if (parent_dev == NULL || parent_path == NULL || device_file == NULL || device_file[0] == '\0') {
-		goto out;
-	}
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	hal_device_property_set_string (d, "info.category", "serial");
-	hal_device_add_capability (d, "serial");
-	hal_device_property_set_string (d, "serial.originating_device", hal_device_get_udi (parent_dev));
-	hal_device_property_set_string (d, "serial.device", device_file);
-
-	last_elem = hal_util_get_last_element(sysfs_path);
-	if (sscanf (last_elem, "ttyS%d", &portnum) == 1) {
-		hal_device_property_set_int (d, "serial.port", portnum);
-		hal_device_property_set_string (d, "serial.type", "platform");
-		hal_device_property_set_string (d, "info.product",
-						hal_device_property_get_string (parent_dev, "info.product"));
-	} else if (sscanf (last_elem, "ttyUSB%d", &portnum) == 1) {
-		HalDevice *usbdev;
-
-		hal_device_property_set_int (d, "serial.port", portnum);
-		hal_device_property_set_string (d, "serial.type", "usb");
-
-		usbdev = hal_device_store_find (hald_get_gdl (), 
-						hal_device_property_get_string (parent_dev, "info.parent"));
-		if (usbdev != NULL) {
-			hal_device_property_set_string (d, "info.product",
-							hal_device_property_get_string (usbdev, "info.product"));
-		} else {
-			hal_device_property_set_string (d, "info.product", "USB Serial Port");
-		}
-	} else {
-		int len;
-		int i;
-
-		len = strlen (last_elem);
-
-		for (i = len - 1; i >= 0 && isdigit (last_elem[i]); --i)
-			;
-		if (i == len - 1)
-			portnum = 0;
-		else
-			portnum = atoi (last_elem + i + 1);
-
-		hal_device_property_set_int (d, "serial.port", portnum);
-		hal_device_property_set_string (d, "serial.type", "unknown");
-		hal_device_property_set_string (d, "info.product", "Serial Port");
-	}
-
-out:
-	return d;
-}
-
-static const gchar *
-serial_get_prober (HalDevice *d)
-{
-	const gchar *dev;
-
-	/* FIXME TODO: check if there is an other way, to call the porber only
-		       on ttyS* devices, than check the name of the device file */
-	dev  = hal_device_property_get_string (d, "linux.device_file");
-	if (dev && !strncmp(dev, "/dev/ttyS", 9))
-		return "hald-probe-serial";
-	else 
-		return NULL;
-}
-
-static gboolean
-serial_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_serial_%s_%d",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_string (d, "serial.type"),
-			  hal_device_property_get_int (d, "serial.port"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
 tape_add (const gchar *sysfs_path, const gchar *device_file, 
 	  HalDevice *parent_dev, const gchar *parent_path)
 {
@@ -1499,142 +3308,6 @@ tape_compute_udi (HalDevice *d)
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
-static HalDevice *
-mmc_host_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	gint host_num;
-	const gchar *last_elem;
-
-	d = NULL;
-
-	if (parent_dev == NULL || parent_path == NULL) {
-		goto out;
-	}
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-
-	hal_device_property_set_string (d, "info.category", "mmc_host");
-	hal_device_add_capability (d, "mmc_host");
-
-	hal_device_property_set_string (d, "info.product", "MMC/SD Host Adapter");
-
-	last_elem = hal_util_get_last_element (sysfs_path);
-	sscanf (last_elem, "mmc%d", &host_num);
-	hal_device_property_set_int (d, "mmc_host.host", host_num);
-
-out:
-	return d;
-}
-
-static gboolean
-mmc_host_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_mmc_host",
-			  hal_device_property_get_string (d, "info.parent"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	gint device_class;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	hal_device_property_set_string (d, "pci.linux.sysfs_path", sysfs_path);
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	if(!hal_util_set_int_from_file (d, "pci.product_id", sysfs_path, "device", 16) ||
-	   !hal_util_set_int_from_file (d, "pci.vendor_id", sysfs_path, "vendor", 16)) {
-		HAL_ERROR(("Could not get PCI product or vendor ID, don't add device, this info is mandatory!"));
-		return NULL;
-	}
-
-	hal_util_set_int_from_file (d, "pci.subsys_product_id", sysfs_path, "subsystem_device", 16);
-	hal_util_set_int_from_file (d, "pci.subsys_vendor_id", sysfs_path, "subsystem_vendor", 16);
-
-	if (hal_util_get_int_from_file (sysfs_path, "class", &device_class, 16)) {
-		hal_device_property_set_int (d, "pci.device_class", ((device_class >> 16) & 0xff));
-		hal_device_property_set_int (d, "pci.device_subclass", ((device_class >> 8) & 0xff));
-		hal_device_property_set_int (d, "pci.device_protocol", (device_class & 0xff));
-	}
-
-	{
-		gchar buf[64];
-		char *vendor_name = NULL;
-		char *product_name = NULL;
-		char *subsys_vendor_name = NULL;
-		char *subsys_product_name = NULL;
-
-		ids_find_pci (hal_device_property_get_int (d, "pci.vendor_id"), 
-			      hal_device_property_get_int (d, "pci.product_id"), 
-			      hal_device_property_get_int (d, "pci.subsys_vendor_id"), 
-			      hal_device_property_get_int (d, "pci.subsys_product_id"), 
-			      &vendor_name, &product_name, &subsys_vendor_name, &subsys_product_name);
-
-		if (vendor_name != NULL) {
-			hal_device_property_set_string (d, "pci.vendor", vendor_name);
-			hal_device_property_set_string (d, "info.vendor", vendor_name);
-		} else {
-			g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", 
-				    hal_device_property_get_int (d, "pci.vendor_id"));
-			hal_device_property_set_string (d, "info.vendor", buf);
-		}
-
-		if (product_name != NULL) {
-			hal_device_property_set_string (d, "pci.product", product_name);
-			hal_device_property_set_string (d, "info.product", product_name);
-		} else {
-			g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", 
-				    hal_device_property_get_int (d, "pci.product_id"));
-			hal_device_property_set_string (d, "info.product", buf);
-		}
-
-		if (subsys_vendor_name != NULL) {
-			hal_device_property_set_string (d, "pci.subsys_vendor", subsys_vendor_name);
-		} 
-		if (subsys_product_name != NULL) {
-			hal_device_property_set_string (d, "pci.subsys_product", subsys_product_name);
-		}
-	}
-
-	return d;
-}
-
-static gboolean
-pci_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/pci_%x_%x",
-			  hal_device_property_get_int (d, "pci.vendor_id"),
-			  hal_device_property_get_int (d, "pci.product_id"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
 static void 
 usbif_set_name (HalDevice *d, int ifclass, int ifsubclass, int ifprotocol)
 {
@@ -1852,1811 +3525,226 @@ usb_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-ide_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+usbclass_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-	const gchar *bus_id;
-	guint host, channel;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	sscanf (bus_id, "%d.%d", &host, &channel);
-	hal_device_property_set_int (d, "ide.host", host);
-	hal_device_property_set_int (d, "ide.channel", channel);
-
-	if (channel == 0) {
-		hal_device_property_set_string (d, "info.product", "IDE device (master)");
-	} else {
-		hal_device_property_set_string (d, "info.product", "IDE device (slave)");
-	}
-	
-	return d;
-}
-
-static gboolean
-ide_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_ide_%d_%d",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_int (d, "ide.host"),
-			  hal_device_property_get_int (d, "ide.channel"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-static void
-pnp_set_serial_info (const gchar *sysfs_path, HalDevice *d) {
-
-	hal_util_set_int_elem_from_file (d, "pnp.serial.irq", sysfs_path, "resources", "irq", 0, 10, TRUE);
-
-	if (hal_util_set_string_elem_from_file (d, "pnp.serial.port", sysfs_path, "resources", "io", 0, TRUE)) {
-		const char* port;
-		const char* _port;
-		_port = hal_device_property_get_string (d, "pnp.serial.port");
-		if(_port == NULL)
-			return;
+	gint host_num;
+	const gchar *last_elem;
 
-		port = strtok((char*) _port, "-");
-		if(port == NULL)
-			return;
+	d = NULL;
 
-		hal_device_property_set_string (d, "pnp.serial.port", port);
+	if (parent_dev == NULL || parent_path == NULL || device_file == NULL || device_file[0] == '\0') {
+		goto out;
 	}
-}
-
 
-static HalDevice *
-pnp_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	HalDevice *computer;
+	last_elem = hal_util_get_last_element (sysfs_path);
+	if (sscanf (last_elem, "hiddev%d", &host_num) == 1) {
 
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
+		d = hal_device_new ();
+		hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
 		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
 
-	hal_util_set_string_from_file (d, "pnp.id", sysfs_path, "id");
-	if (hal_device_has_property (d, "pnp.id")) {
-		gchar *pnp_description;
-		const char *pnp_id;
-		ids_find_pnp (hal_device_property_get_string (d, "pnp.id"), &pnp_description);
-		if (pnp_description != NULL) {
-			hal_device_property_set_string (d, "pnp.description", pnp_description);
-			hal_device_property_set_string (d, "info.product", pnp_description);
-		}
-		pnp_id = hal_device_property_get_string (d, "pnp.id");
-		if( !strncmp(pnp_id, "WACf00", 6) || !strcmp(pnp_id, "FUJ02e5") ||
-		    !strcmp(pnp_id, "FUJ02e6") || !strcmp(pnp_id, "FPI2004")) {
-			/* a internal serial tablet --> this should be a tablet pc */
-			hal_device_add_capability (d, "input");
-			hal_device_add_capability (d, "input.tablet");
-			hal_device_add_capability (d, "input.tablet.tabletPC");
-
-			if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) != NULL ||
-			    (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) != NULL) {
-
-				hal_device_property_set_string (computer, "system.formfactor", "laptop");
-				hal_device_property_set_string (computer, "system.formfactor.subtype", "tabletpc");
-				/* collect info about serial port and irq etc. */
-				pnp_set_serial_info (sysfs_path, d);
-			}
-		}
-	}
-
-	if (!hal_device_has_property (d, "info.product")) {
-		gchar buf[64];
-		g_snprintf (buf, sizeof (buf), "PnP Device (%s)", hal_device_property_get_string (d, "pnp.id"));
-		hal_device_property_set_string (d, "info.product", buf);
-	}
-
-	
-	return d;
-}
-
-static gboolean
-pnp_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/pnp_%s",
-			  hal_device_property_get_string (d, "pnp.id"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-
-}
+		hal_device_property_set_string (d, "info.category", "hiddev");
+		hal_device_add_capability (d, "hiddev");
 
-/*--------------------------------------------------------------------------------------------------------------*/
+		hal_device_property_set_string (d, "info.product", "USB HID Device");
 
-static HalDevice *
-platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *dev_id;
-	gchar buf[64];
+		hal_device_property_set_string (d, "hiddev.device", device_file);
+	} else if (sscanf (last_elem, "lp%d", &host_num) == 1) {
 
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
+		d = hal_device_new ();
+		hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
 		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	dev_id = hal_util_get_last_element (sysfs_path);
-
-	hal_device_property_set_string (d, "platform.id", dev_id);
-
-	g_snprintf (buf, sizeof (buf), "Platform Device (%s)", hal_device_property_get_string (d, "platform.id"));
-	hal_device_property_set_string (d, "info.product", buf);
-
-	if (strncmp (dev_id, "dock", 4) == 0) {
-		int docked;
-
-		hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
-		hal_device_property_set_bool (d, "info.docked", docked);
-	}
-
-	return d;
-}
-
-static gboolean
-platform_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/platform_%s",
-			  hal_device_property_get_string (d, "platform.id"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
-
-static gboolean
-platform_refresh_undock (gpointer data)
-{
-	HalDevice *d;
-	gint flags, docked;
-	const gchar *sysfs_path;
-
-	if (data == NULL)
-		return FALSE;
-	d = (HalDevice *) data;
-
-	sysfs_path = hal_device_property_get_string(d, "linux.sysfs_path");
-	hal_util_get_int_from_file (sysfs_path, "flags", &flags, 0);
-
-	/* check for != 0, maybe the user did an immediate dock */
-	if (flags != 0)
-		return TRUE;
-
-	hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
-	hal_device_property_set_bool (d, "info.docked", docked);
-
-	return FALSE;
-}
-
-static gboolean
-platform_refresh (HalDevice *d)
-{
-	const gchar *id, *sysfs_path;
-	gint docked, flags;
-
-	id = hal_device_property_get_string (d, "platform.id");
-	if (strncmp (id, "dock", 4) != 0)
-		return TRUE;
-
-	sysfs_path = hal_device_property_get_string(d, "linux.sysfs_path");
-	hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
 
-	if (docked == 1) {
-		/* undock still in progress? */
-		hal_util_get_int_from_file (sysfs_path, "flags", &flags, 0);
-		if (flags == 2) {
-			g_timeout_add (DOCK_STATION_UNDOCK_POLL_INTERVAL,
-				       platform_refresh_undock, d);
-			return TRUE;
-		}
-	}
-
-	hal_device_property_set_bool (d, "info.docked", docked);
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
+		hal_device_property_set_string (d, "info.category", "printer");
+		hal_device_add_capability (d, "printer");
 
-static HalDevice *
-serio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *bus_id;
+		hal_device_property_set_string (d, "info.product", "Printer");
+		hal_device_property_set_string (d, "printer.device", device_file);
 
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+		hal_device_property_set_string (d, "printer.originating_device", hal_device_get_udi (parent_dev));
 	}
 
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-	hal_device_property_set_string (d, "serio.id", bus_id);
-	if (!hal_util_set_string_from_file (d, "serio.description", sysfs_path, "description")) {
-		hal_device_property_set_string (d, "serio.description", hal_device_property_get_string (d, "serio.id"));
-	}
-	hal_device_property_set_string (d, "info.product", hal_device_property_get_string (d, "serio.description"));
-	
+out:
 	return d;
 }
 
-static gboolean
-serio_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_%s",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_string (d, "serio.description"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-pcmcia_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+static const gchar *
+usbclass_get_prober (HalDevice *d)
 {
-	HalDevice *d;
-	const gchar *bus_id;
-	guint socket, function;
-	const char *prod_id1;
-	const char *prod_id2;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	/* not sure if %d.%d means socket function - need to revisit */
-	sscanf (bus_id, "%d.%d", &socket, &function);
-	hal_device_property_set_int (d, "pcmcia.socket_number", socket);
-
-	hal_util_set_string_from_file (d, "pcmcia.prod_id1", sysfs_path, "prod_id1");
-	hal_util_set_string_from_file (d, "pcmcia.prod_id2", sysfs_path, "prod_id2");
-	hal_util_set_string_from_file (d, "pcmcia.prod_id3", sysfs_path, "prod_id3");
-	hal_util_set_string_from_file (d, "pcmcia.prod_id4", sysfs_path, "prod_id4");
-
-	hal_util_set_int_from_file (d, "pcmcia.manf_id", sysfs_path, "manf_id", 16);
-	hal_util_set_int_from_file (d, "pcmcia.card_id", sysfs_path, "card_id", 16);
-	hal_util_set_int_from_file (d, "pcmcia.func_id", sysfs_path, "func_id", 16);
-
-	prod_id1 = hal_device_property_get_string (d, "pcmcia.prod_id1");
-	prod_id2 = hal_device_property_get_string (d, "pcmcia.prod_id2");
-
-	/* Provide best-guess of vendor, goes in Vendor property */
-	if (prod_id1 != NULL) {
-		hal_device_property_set_string (d, "pcmcia.vendor", prod_id1);
-		hal_device_property_set_string (d, "info.vendor", prod_id1);
-	} else {
-		char buf[50];
-		g_snprintf (buf, sizeof(buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "pcmcia.manf_id"));
-		hal_device_property_set_string (d, "info.vendor", buf);
-	}
-
-	/* Provide best-guess of name, goes in Product property */
-	if (prod_id2 != NULL) {
-		hal_device_property_set_string (d, "pcmcia.product", prod_id1);
-		hal_device_property_set_string (d, "info.product", prod_id2);
-	} else {
-		char buf[50];
-		g_snprintf (buf, sizeof(buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "pcmcia.card_id"));
-		hal_device_property_set_string (d, "info.product", buf);
-	}
-
-	return d;
+	if (hal_device_has_capability (d, "hiddev"))
+		return "hald-probe-hiddev";
+	else if (hal_device_has_capability (d, "printer"))
+		return "hald-probe-printer";
+	else
+		return NULL;
 }
 
 static gboolean
-pcmcia_compute_udi (HalDevice *d)
+usbclass_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/pcmcia_%d_%d",
-			  hal_device_property_get_int (d, "pcmcia.manfid1"),
-			  hal_device_property_get_int (d, "pcmcia.manfid2"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-scsi_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d = NULL;
-	const gchar *bus_id;
-	gint host_num, bus_num, target_num, lun_num;
-	int type;
-
-	if (parent_dev == NULL)
-		goto out;
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-	if (sscanf (bus_id, "%d:%d:%d:%d", &host_num, &bus_num, &target_num, &lun_num) != 4)
-		goto out;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	hal_device_property_set_int (d, "scsi.host", host_num);
-	hal_device_property_set_int (d, "scsi.bus", bus_num);
-	hal_device_property_set_int (d, "scsi.target", target_num);
-	hal_device_property_set_int (d, "scsi.lun", lun_num);
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_device_property_set_string (d, "info.product", "SCSI Device");
+	if (hal_device_has_capability (d, "hiddev")) {
+		hald_compute_udi (udi, sizeof (udi),
+				  "%s_hiddev",
+				  hal_device_property_get_string (d, "info.parent"));
+		hal_device_set_udi (d, udi);
+	} else if (hal_device_has_capability (d, "printer")) {
+		const char *serial;
 
-	hal_util_set_string_from_file (d, "scsi.model", sysfs_path, "model");
-	hal_util_set_string_from_file (d, "scsi.vendor", sysfs_path, "vendor");
-	hal_util_get_int_from_file (sysfs_path, "type", &type, 0);
-	HAL_INFO (("%s/type -> %d (-> scsi.type)", sysfs_path, type));
-	switch (type) {
-	case 0:  /* TYPE_DISK (disk) */
-	case 7:  /* TYPE_MOD (Magneto-optical disk) */
-	case 14: /* TYPE_RBC (Reduced Block Commands)
-		  * Simple Direct Access Device, set it to disk
-		  * (some Firewire Disks use it)
-		  */
-		hal_device_property_set_string (d, "scsi.type", "disk");
-		break;
-	case 1: /* TYPE_TAPE (Tape) */
-		hal_device_property_set_string (d, "scsi.type", "tape");
-		break;
-	case 2:
-		/* TYPE_PRINTER (Tape) */
-		hal_device_property_set_string (d, "scsi.type", "printer");
-		break;
-	case 3:  /* TYPE_PROCESSOR */
-		hal_device_property_set_string (d, "scsi.type", "processor");
-		break;
-	case 4: /* TYPE_WORM */
-	case 5: /* TYPE_ROM (CD-ROM) */
-		hal_device_property_set_string (d, "scsi.type", "cdrom");
-		break;
-	case 6: /* TYPE_SCANNER */
-		hal_device_property_set_string (d, "scsi.type", "scanner");
-		break;
-	case 8: /* TYPE_MEDIUM_CHANGER */
-		hal_device_property_set_string (d, "scsi.type", "medium_changer");
-		break;
-	case 9: /* TYPE_COMM */
-		hal_device_property_set_string (d, "scsi.type", "comm");
-		break;
-	case 12: /* TYPE_RAID */
-		hal_device_property_set_string (d, "scsi.type", "raid");
-		break;
-	default:
-		hal_device_property_set_string (d, "scsi.type", "unknown");
+		serial = hal_device_property_get_string (d, "printer.serial");
+		hald_compute_udi (udi, sizeof (udi),
+				  "%s_printer_%s",
+				  hal_device_property_get_string (d, "info.parent"),
+				  serial != NULL ? serial : "noserial");
+		hal_device_set_udi (d, udi);
 	}
 
-out:
-	return d;
-}
-
-static gboolean
-scsi_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_scsi_device_lun%d",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_int (d, "scsi.lun"));
-	hal_device_set_udi (d, udi);
 	return TRUE;
-
 }
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-mmc_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+usbraw_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-	const gchar *bus_id;
-	gint host_num, rca, manfid, oemid;
-	gchar *scr, *type;
 
-	if (parent_dev == NULL) {
-		d = NULL;
+	d = NULL;
+
+	if (parent_dev == NULL || parent_path == NULL)
 		goto out;
-	}
 
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
 	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-	sscanf (bus_id, "mmc%d:%x", &host_num, &rca);
-	hal_device_property_set_int (d, "mmc.rca", rca);
-	
-	hal_util_set_string_from_file (d, "mmc.cid", sysfs_path, "cid");
-	hal_util_set_string_from_file (d, "mmc.csd", sysfs_path, "csd");
-	
-	type = hal_util_get_string_from_file (sysfs_path, "type");
-	if (type != NULL)
-		/* Possible MMC/SD/SDIO */
-		hal_device_property_set_string (d, "mmc.type", type);
-
-	scr = hal_util_get_string_from_file (sysfs_path, "scr");
-	if (scr != NULL) {
-		if (strcmp (scr, "0000000000000000") == 0)
-			scr = NULL;
-		else
-			hal_device_property_set_string (d, "mmc.scr", scr);
-	}
-
-	if (!hal_util_set_string_from_file (d, "info.product", sysfs_path, "name")) {
-		gchar buf[64];
-		if (type != NULL) {
-			g_snprintf(buf, sizeof(buf), "%s Card", type);
-			hal_device_property_set_string (d, "info.product", buf);
-		} else if (scr != NULL) {
-			g_snprintf(buf, sizeof(buf), "SD Card");
-			hal_device_property_set_string (d, "info.product", buf);
-		} else {
-			g_snprintf(buf, sizeof(buf), "MMC Card");
-                }
-		hal_device_property_set_string (d, "mmc.product", buf);
-	}
-	
-	if (hal_util_get_int_from_file (sysfs_path, "manfid", &manfid, 16)) {
-		/* TODO: Here we should have a mapping to a name */
-		char vendor[256];
-		snprintf(vendor, 256, "Unknown (%d)", manfid);
-		hal_device_property_set_string (d, "info.vendor", vendor);
-		hal_device_property_set_string (d, "mmc.vendor", vendor);
-	}
-	if (hal_util_get_int_from_file (sysfs_path, "oemid", &oemid, 16)) {
-		/* TODO: Here we should have a mapping to a name */
-		char oem[256];
-		snprintf(oem, 256, "Unknown (%d)", oemid);
-		hal_device_property_set_string (d, "mmc.oem", oem);
-	}
-
-	hal_util_set_string_from_file (d, "mmc.date", sysfs_path, "date");
-	hal_util_set_int_from_file (d, "mmc.hwrev", sysfs_path, "hwrev", 16);
-	hal_util_set_int_from_file (d, "mmc.fwrev", sysfs_path, "fwrev", 16);
-	hal_util_set_int_from_file (d, "mmc.serial", sysfs_path, "serial", 16);
+	hal_device_property_set_string (d, "info.category", "usbraw");
+	hal_device_add_capability (d, "usbraw");
+	hal_device_property_set_string (d, "info.product", "USB Raw Device Access");
+	hal_device_property_set_string (d, "usbraw.device", device_file);
 
 out:
 	return d;
 }
 
 static gboolean
-mmc_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_mmc_card_rca%d",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_int (d, "mmc.rca"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-sdio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *bus_id;
-	gchar buf[256];
-	gint host_num, rca, card_id;
-
-	if (parent_dev == NULL)
-		return NULL;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-	sscanf (bus_id, "mmc%d:%x:%d", &host_num, &rca, &card_id);
-	hal_device_property_set_int (d, "sdio.rca", rca);
-	hal_device_property_set_int (d, "sdio.card_id", card_id);
-
-	hal_util_set_int_from_file (d, "sdio.vendor_id", sysfs_path, "vendor", 16);
-	hal_util_set_int_from_file (d, "sdio.product_id", sysfs_path, "device", 16);
-	hal_util_set_int_from_file (d, "sdio.class_id", sysfs_path, "class", 16);
-
-	/* TODO: Here we should have a mapping to a name */
-	g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "sdio.vendor_id"));
-	hal_device_property_set_string (d, "info.vendor", buf);
-	hal_device_property_set_string (d, "sdio.vendor", buf);
-
-	/* TODO: Here we should have a mapping to a name */
-	g_snprintf (buf, sizeof (buf), "Unknown (0x%04x)", hal_device_property_get_int (d, "sdio.product_id"));
-	hal_device_property_set_string (d, "info.product", buf);
-	hal_device_property_set_string (d, "sdio.product", buf);
-
-	return d;
-}
-
-static gboolean
-sdio_compute_udi (HalDevice *d)
+usbraw_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_sdio%d",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_int (d, "sdio.card_id"));
+	hald_compute_udi (udi, sizeof (udi), "%s_usbraw",
+			  hal_device_property_get_string (d, "info.parent"));
 	hal_device_set_udi (d, udi);
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-xen_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *devtype;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_device_property_set_string (d, "xen.bus_id",
-					hal_util_get_last_element (sysfs_path));
-
-	hal_util_set_string_from_file (d, "xen.path", sysfs_path, "nodename");
 
-	devtype = hal_util_get_string_from_file (sysfs_path, "devtype");
-	if (devtype != NULL) {
-		hal_device_property_set_string (d, "xen.type", devtype);
-
-		if (strcmp (devtype, "pci") == 0) {
-			hal_device_property_set_string (d, "info.product", "Xen PCI Device");
-		} else if (strcmp (devtype, "vbd") == 0) {
-			hal_device_property_set_string (d, "info.product", "Xen Virtual Block Device");
-		} else if (strcmp (devtype, "vif") == 0) {
-			hal_device_property_set_string (d, "info.product", "Xen Virtual Network Device");
-		} else if (strcmp (devtype, "vtpm") == 0) {
-			hal_device_property_set_string (d, "info.product", "Xen Virtual Trusted Platform Module");
-		} else {
-			char buf[64];
-			g_snprintf (buf, sizeof (buf), "Xen Device (%s)", devtype);
-			hal_device_property_set_string (d, "info.product", buf);
-		}
-	} else {
-		 hal_device_property_set_string (d, "info.product", "Xen Device (unknown)");
-	}
-
-	return d;
-}
-
-static gboolean
-xen_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/xen_%s",
-			  hal_device_property_get_string (d, "xen.bus_id"));
-	hal_device_set_udi (d, udi);
 	return TRUE;
 }
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-ieee1394_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+video4linux_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-	long long unsigned int guid;
-	gint host_id;
-	const gchar *bus_id;
-	gchar buf[64];
 
 	d = NULL;
 
-	if (parent_dev == NULL)
-		goto out;
-
-	/* skip the useless class devices, which should be removed from the kernel */
-	if (strstr(sysfs_path, "/class/") != NULL)
-		goto out;
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	if (sscanf (bus_id, "fw-host%d", &host_id) == 1)
-		goto out;
-
-	if (sscanf (bus_id, "%llx-%d", &guid, &host_id) !=2 )
+	if (parent_dev == NULL || parent_path == NULL)
 		goto out;
 
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
 	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_device_property_set_uint64 (d, "ieee1394.guid", guid);
-	hal_util_set_int_from_file    (d, "ieee1394.vendor_id", sysfs_path, "../vendor_id", 16);
-	hal_util_set_int_from_file    (d, "ieee1394.specifier_id", sysfs_path, "specifier_id", 16);
-	hal_util_set_int_from_file    (d, "ieee1394.version", sysfs_path, "version", 16);
-
-	if (!hal_util_set_string_from_file (d, "ieee1394.vendor", sysfs_path, "../vendor_oui")) {
-		g_snprintf (buf, sizeof (buf), "Unknown (0x%06x)", 
-			    hal_device_property_get_int (d, "ieee1394.vendor_id"));
-		hal_device_property_set_string (d, "ieee1394.vendor", buf);
-	}
-
-	/* not all devices have product_id */
-	if (hal_util_set_int_from_file    (d, "ieee1394.product_id", sysfs_path, "model_id", 16)) {
-		if (!hal_util_set_string_from_file (d, "ieee1394.product", sysfs_path, "model_name_kv")) {
-			g_snprintf (buf, sizeof (buf), "Unknown (0x%06x)", 
-				    hal_device_property_get_int (d, "ieee1394.product_id"));
-			hal_device_property_set_string (d, "ieee1394.product", buf);
-		}
-	} else {
-		hal_device_property_set_int (d, "ieee1394.product_id", 0x000000);
-		hal_device_property_set_string (d, "ieee1394.product",
-						hal_device_property_get_string (d, "ieee1394.vendor"));
-	}
-		
-	hal_device_property_set_string (d, "info.vendor",
-					hal_device_property_get_string (d, "ieee1394.vendor"));
-	hal_device_property_set_string (d, "info.product",
-					hal_device_property_get_string (d, "ieee1394.product"));
+	hal_device_property_set_string (d, "info.category", "video4linux");
+	hal_device_add_capability (d, "video4linux");
+	hal_device_property_set_string (d, "info.product", "Multimedia Device");
+	hal_device_property_set_string (d, "video4linux.device", device_file);
 
 out:
 	return d;
 }
 
-static gboolean
-ieee1394_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/ieee1394_guid_%0llx",
-			  hal_device_property_get_uint64 (d, "ieee1394.guid"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-firewire_add_device (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev)
-{
-	HalDevice *d = NULL;
-	gchar buf[64];
-
-	if (device_file == NULL || device_file[0] == '\0')
-		goto out;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.subsystem", "ieee1394");
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	hal_device_add_capability (d, "ieee1394");
-	hal_device_property_set_string (d, "ieee1394.device", device_file);
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_util_set_uint64_from_file (d, "ieee1394.guid", sysfs_path, "guid", 16);	
-	hal_util_set_int_from_file  (d, "ieee1394.vendor_id", sysfs_path, "vendor", 16);
-	hal_util_set_int_from_file  (d, "ieee1394.product_id", sysfs_path, "model", 16);
-	hal_util_set_int_from_file  (d, "ieee1394.harware_version", sysfs_path, "harware_version", 16);
-
-	if (!hal_util_set_string_from_file (d, "ieee1394.vendor", sysfs_path, "vendor_name")) {
-		/* FIXME: We should do a OUI lookup here, see
-		 * http://standards.ieee.org/regauth/oui/oui.txt */
-
-		g_snprintf (buf, sizeof (buf), "Unknown (0x%06x)", 
-			    hal_device_property_get_int (d, "ieee1394.vendor_id"));
-		hal_device_property_set_string (d, "ieee1394.vendor", buf);
-	}
-
-	hal_util_set_string_from_file (d, "ieee1394.product", sysfs_path, "model_name");
-
- out:
-	return d;
-}
-
-static HalDevice *
-firewire_add_unit (const gchar *sysfs_path, int unit_id, HalDevice *parent_dev)
-{
-	int specifier_id;
-	int version;
-	HalDevice *d;
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.subsystem", "ieee1394_unit");
-	hal_device_property_set_string (d, "info.parent",
-					hal_device_get_udi (parent_dev));
-	hal_device_property_set_string (d, "ieee1394_unit.originating_device", 
-					hal_device_get_udi (parent_dev));
-	hal_device_property_set_int (d, "ieee1394_unit.unit_index", unit_id);
-	hal_device_add_capability (d, "ieee1394_unit");
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_util_set_int_from_file  (d, "ieee1394.vendor_id", sysfs_path, "../vendor_id", 16);
-	hal_util_get_int_from_file  (sysfs_path, "specifier_id", &specifier_id, 16);
-	hal_device_property_set_int (d, "ieee1394_unit.specifier_id", specifier_id);
-	hal_util_get_int_from_file  (sysfs_path, "version", &version, 16);
-	hal_device_property_set_int (d, "ieee1394_unit.version", version);
-
-	if (specifier_id == 0x00609e && version == 0x010483) {
-		hal_device_add_capability (d, "ieee1394_unit.sbp2");
-	} else if (specifier_id == 0x00a02d) {
-		if ((version & 0xffff00) == 0x000100)
-			hal_device_add_capability (d, "ieee1394_unit.iidc");
-		if ((version & 0xff0001) == 0x010001)
-			hal_device_add_capability (d, "ieee1394_unit.avc");
-		if ((version & 0xff0002) == 0x010002)
-			hal_device_add_capability (d, "ieee1394_unit.cal");
-		if ((version & 0xff0004) == 0x010004)
-			hal_device_add_capability (d, "ieee1394_unit.ehs");
-		if ((version & 0xff0004) == 0x010008)
-			hal_device_add_capability (d, "ieee1394_unit.havi");
-	} else if (specifier_id == 0x000b09d && version == 0x800002) {
-		/* Workaround for pointgrey cameras taken from libdc1394 */
-		hal_device_add_capability (d, "ieee1394_unit.iidc");
-	}
-
-	return d;
-}
-
-static HalDevice *
-firewire_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	int device_id;
-	int unit_id;
-	const char *bus_id;
-
-	if (parent_dev == NULL)
-		return NULL;
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	if (sscanf (bus_id, "fw%d.%d", &device_id, &unit_id) == 2 ) {
-		return firewire_add_unit (sysfs_path, unit_id, parent_dev);
-	} else if (sscanf (bus_id, "fw%d", &device_id) == 1) {
-		return firewire_add_device (sysfs_path, device_file, parent_dev);
-	} else {
-		return NULL;
-	}
-}
-
 static const gchar *
-firewire_get_prober (HalDevice *d)
+video4linux_get_prober (HalDevice *d)
 {
 	const char *prober = NULL;
 
-	/* run prober only for AVC devices */
-	if (hal_device_has_capability (d, "ieee1394_unit.avc")) {
-		prober = "hald-probe-ieee1394-unit";
+	/* run prober only for video4linux devices */
+	if (hal_device_has_capability (d, "video4linux")) {
+		prober = "hald-probe-video4linux";
 	}
 
 	return prober;
 }
 
 static gboolean
-firewire_post_probing (HalDevice *d)
-{
-	return TRUE;
-}
-
-
-static gboolean
-firewire_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	if (hal_device_has_capability (d, "ieee1394")) {
-		hald_compute_udi (udi, sizeof (udi),
-				  "/org/freedesktop/Hal/devices/ieee1394_guid%0llx",
-				  hal_device_property_get_uint64 (d, "ieee1394.guid"));
-	} else {
-		hald_compute_udi (udi, sizeof (udi),
-				  "%s_unit%d",
-				  hal_device_property_get_string (d, "ieee1394_unit.originating_device"),
-				  hal_device_property_get_int (d, "ieee1394_unit.unit_index"));
-	}
-
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static inline void
-ccw_add_dasd_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	const gchar *disc;
-	
-	hal_util_set_int_from_file (d, "ccw.dasd.use_diag", sysfs_path,
-				    "use_diag", 2);
-	hal_util_set_int_from_file (d, "ccw.dasd.readonly", sysfs_path,
-				    "readonly", 2);
-	disc = hal_util_get_string_from_file (sysfs_path, "discipline");
-	if (disc)
-		hal_device_property_set_string(d, "ccw.dasd.discipline", disc);
-}
-
-static inline void
-ccw_add_zfcp_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	int online;
-
-	/* zfcp adapter properties are only valid for online devices. */
-	if (!hal_util_get_int_from_file (sysfs_path, "online", &online, 2))
-		return;
-	if (!online)
-		return;
-
-	hal_util_set_int_from_file (d, "ccw.zfcp.in_recovery", sysfs_path,
-				    "in_recovery", 2);
-	hal_util_set_int_from_file (d, "ccw.zfcp.failed", sysfs_path,
-				    "failed", 2);
-}
-
-static inline void
-ccw_add_tape_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	int medium_state, online;
-
-	const gchar *state_text[3] = {"unknown", "loaded", "no medium"};
-
-	hal_util_set_string_from_file (d, "ccw.tape.state", sysfs_path, "state");
-    	hal_util_set_string_from_file (d, "ccw.tape.operation", sysfs_path,
-				       "operation");
-	/* The following properties are only valid for online devices. */
-	if (!hal_util_get_int_from_file (sysfs_path, "online", &online, 2))
-		return;
-	if (!online)
-		return;
-	hal_util_set_int_from_file (d, "ccw.tape.blocksize", sysfs_path,
-				    "blocksize", 10);
-	if (!hal_util_get_int_from_file (sysfs_path, "medium_state",
-					&medium_state, 10))
-		return;
-	hal_device_property_set_string (d, "ccw.tape.medium_state",
-					state_text[medium_state]);
-}
-
-static inline void
-ccw_add_3270_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	hal_util_set_int_from_file (d, "ccw.3270.model", sysfs_path,
-				    "model", 10);
-	hal_util_set_int_from_file (d, "ccw.3270.rows", sysfs_path, "rows", 10);
-	hal_util_set_int_from_file (d, "ccw.3270.columns", sysfs_path,
-				    "columns", 10);
-}
-
-static HalDevice *
-ccw_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *bus_id;
-	const gchar *pimpampom;
-	int pim, pam, pom;
-	const gchar *chpids;
-	int chpid[8];
-	gchar attr[25];
-	int i;
-	gchar driver_name[256];
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL)
-                hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-        else
-                hal_device_property_set_string
-		  (d, "info.parent",
-		   "/org/freedesktop/Hal/devices/computer");
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_device_property_set_string (d, "ccw.bus_id", bus_id);
-	hal_util_set_int_from_file (d, "ccw.online", sysfs_path, "online", 2);
-	hal_util_set_string_from_file (d, "ccw.availablity", sysfs_path,
-				       "availability");
-	hal_util_set_int_from_file (d, "ccw.cmb_enable", sysfs_path,
-				    "cmb_enable", 2);
-	hal_util_set_string_from_file (d, "ccw.cutype", sysfs_path, "cutype");
-	hal_util_set_string_from_file (d, "ccw.devtype", sysfs_path, "devtype");
-
-	/* Get some values from the higher level subchannel structure.*/
-	pimpampom = hal_util_get_string_from_file (sysfs_path, "../pimpampom");
-	if (pimpampom) {
-		sscanf (pimpampom, "%x %x %x", &pim, &pam, &pom);
-		hal_device_property_set_int (d, "ccw.subchannel.pim", pim);
-		hal_device_property_set_int (d, "ccw.subchannel.pam", pam);
-		hal_device_property_set_int (d, "ccw.subchannel.pom", pom);
-	}
-
-	chpids = hal_util_get_string_from_file (sysfs_path, "../chpids");
-	if (chpids) {
-		sscanf (chpids, "%x %x %x %x %x %x %x %x", &chpid[0], &chpid[1],
-			&chpid[2], &chpid[3], &chpid[4], &chpid[5], &chpid[6],
-			&chpid[7]);
-		for (i=0; i<8 && (chpid[i] != 0); i++) {
-			g_snprintf (attr, sizeof (attr),
-				    "ccw.subchannel.chpid%x", i);
-			hal_device_property_set_int (d, attr, chpid[i]);
-		}
-	}
-
-	/* Add some special properties. */
-	if (hal_util_get_driver_name (sysfs_path, driver_name)) {
-		if (!strncmp (driver_name, "dasd", 4))
-			/* Same attributes for dasd_eckd and dasd_fba. */
-			ccw_add_dasd_properties (d, sysfs_path);
-		if (!strncmp (driver_name, "zfcp", 4))
-			ccw_add_zfcp_properties (d, sysfs_path);
-		if (!strncmp (driver_name, "tape_3", 6))
-			/* For all channel attached tapes. */
-			ccw_add_tape_properties (d, sysfs_path);
-		if (!strncmp (driver_name, "3270", 4))
-			ccw_add_3270_properties (d, sysfs_path);
-	}
-	return d;
-}
-
-static gboolean
-ccw_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/ccw_%s",
-			  hal_device_property_get_string
-			  (d, "ccw.bus_id"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static inline void
-ccwgroup_add_qeth_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	int is_layer2;
-
-	/* Some attributes are not applicable for devices in layer2 mode. */
-	hal_util_get_int_from_file (sysfs_path, "layer2", &is_layer2, 2);
-
-	hal_util_set_string_from_file (d, "ccwgroup.qeth.large_send",
-				       sysfs_path, "large_send");
-	hal_util_set_string_from_file (d, "ccwgroup.qeth.card_type", sysfs_path,
-				       "card_type");
-	hal_util_set_string_from_file (d, "ccwgroup.qeth.checksumming",
-				       sysfs_path, "checksumming");
-	if (!is_layer2) {
-		/* CH: the next two are only valid for token ring devices */
-		hal_util_set_int_from_file (d,
-					    "ccwgroup.qeth.canonical_macaddr",
-					    sysfs_path, "canonical_macaddr", 2);
-		hal_util_set_string_from_file (d,
-					       "ccwgroup.qeth.broadcast_mode",
-					       sysfs_path, "broadcast_mode");
-		hal_util_set_int_from_file (d, "ccwgroup.qeth.fake_broadcast",
-					    sysfs_path, "fake_broadcast", 2);
-		hal_util_set_int_from_file (d, "ccwgroup.qeth.fake_ll",
-					    sysfs_path, "fake_ll", 2);
-	}
-	hal_device_property_set_int (d, "ccwgroup.qeth.layer2", is_layer2);
-	hal_util_set_string_from_file (d, "ccwgroup.qeth.portname", sysfs_path,
-				       "portname");
-	hal_util_set_int_from_file (d, "ccwgroup.qeth.portno", sysfs_path,
-				    "portno", 10);
-	hal_util_set_int_from_file (d, "ccwgroup.qeth.buffer_count", sysfs_path,
-				    "buffer_count", 10);
-	hal_util_set_int_from_file (d, "ccwgroup.qeth.add_hhlen", sysfs_path,
-				    "add_hhlen", 10);
-	hal_util_set_string_from_file (d, "ccwgroup.qeth.priority_queueing",
-				       sysfs_path, "priority_queueing");
-	if (!is_layer2) {
-		hal_util_set_string_from_file (d, "ccwgroup.qeth.route4",
-					       sysfs_path, "route4");
-		hal_util_set_string_from_file (d, "ccwgroup.qeth.route6",
-					       sysfs_path, "route6");
-	}
-	hal_util_set_string_from_file (d, "ccwgroup.qeth.state", sysfs_path,
-				       "state");
-}
-
-static inline void
-ccwgroup_add_ctc_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	/* CH: use protocol descriptions? */
-	hal_util_set_int_from_file (d, "ccwgroup.ctc.protocol", sysfs_path,
-				    "protocol", 2);
-	hal_util_set_string_from_file (d, "ccwgroup.ctc.type", sysfs_path,
-				       "type");
-	hal_util_set_int_from_file (d, "ccwgroup.ctc.buffer", sysfs_path,
-				    "buffer", 10);
-}
-
-static inline void
-ccwgroup_add_lcs_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	hal_util_set_int_from_file (d, "ccwgroup.lcs.portnumber", sysfs_path,
-				    "portno", 10);
-	hal_util_set_string_from_file (d, "ccwgroup.lcs.type", sysfs_path,
-				       "type");
-	hal_util_set_int_from_file (d, "ccwgroup.lcs.lancmd_timeout",
-				    sysfs_path, "lancmd_timeout", 10);
-}
-
-static inline void
-ccwgroup_add_claw_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	hal_util_set_string_from_file (d, "ccwgroup.claw.api_type", sysfs_path,
-				       "api_type");
-	hal_util_set_string_from_file (d, "ccwgroup.claw.adapter_name",
-				       sysfs_path, "adapter_name");
-	hal_util_set_string_from_file (d, "ccwgroup.claw.host_name", sysfs_path,
-				       "host_name");
-	hal_util_set_int_from_file (d, "ccwgroup.claw.read_buffer", sysfs_path,
-				    "read_buffer", 10);
-	hal_util_set_int_from_file (d, "ccwgroup.claw.write_buffer", sysfs_path,
-				    "write_buffer", 10);
-}
-
-static HalDevice *
-ccwgroup_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *bus_id;
-	gchar driver_name[256];
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL)
-                hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-        else
-                hal_device_property_set_string
-		  (d, "info.parent",
-		   "/org/freedesktop/Hal/devices/computer");
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_device_property_set_string (d, "ccwgroup.bus_id", bus_id);
-	hal_util_set_int_from_file (d, "ccwgroup.online", sysfs_path,
-				    "online", 2);
-
-	/* Some devices have extra properties. */
-	if (hal_util_get_driver_name (sysfs_path, driver_name)) {
-		if (!strncmp (driver_name, "qeth", 4))
-			ccwgroup_add_qeth_properties (d, sysfs_path);
-		if (!strncmp (driver_name, "ctc", 3))
-			ccwgroup_add_ctc_properties (d, sysfs_path);
-		if (!strncmp (driver_name, "lcs", 3))
-			ccwgroup_add_lcs_properties (d, sysfs_path);
-		if (!strncmp (driver_name, "claw", 4))
-			ccwgroup_add_claw_properties (d, sysfs_path);
-	}
-	return d;
-}
-
-static gboolean
-ccwgroup_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/ccwgroup_%s",
-			  hal_device_property_get_string
-			  (d, "ccwgroup.bus_id"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static inline void
-iucv_add_netiucv_properties (HalDevice *d, const gchar *sysfs_path)
-{
-	hal_util_set_string_from_file (d, "iucv.netiucv.user", sysfs_path,
-				       "user");
-	hal_util_set_int_from_file (d, "iucv.netiucv.buffer", sysfs_path,
-				    "buffer", 10);
-}
-
-static HalDevice *
-iucv_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *bus_id;
-	gchar driver_name[256];
-
-	bus_id = hal_util_get_last_element (sysfs_path);
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL)
-                hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-        else
-                hal_device_property_set_string
-		  (d, "info.parent",
-		   "/org/freedesktop/Hal/devices/computer");
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	hal_device_property_set_string (d, "iucv.bus_id", bus_id);
-
-	if (hal_util_get_driver_name (sysfs_path, driver_name)) {
-		if (!strncmp (driver_name, "netiucv", 7))
-			iucv_add_netiucv_properties (d, sysfs_path);
-	}
-	return d;
-}
-
-static gboolean
-iucv_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/iucv_%s",
-			  hal_device_property_get_string
-			  (d, "iucv.bus_id"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-backlight_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev,
-	       const gchar *sysfs_path_in_devices)
-{
-	HalDevice *d;
-	int max_brightness;
-
-	d = hal_device_new ();
-	hal_device_add_capability (d, "laptop_panel");
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	hal_device_property_set_string (d, "info.category", "laptop_panel");
-	hal_device_property_set_string (d, "info.product", "Generic Backlight Device");
-	hal_device_property_set_string (d, "laptop_panel.access_method", "general");
-
-	hal_util_get_int_from_file (sysfs_path, "max_brightness", &max_brightness, 10);
-	hal_device_property_set_int (d, "laptop_panel.num_levels", max_brightness + 1);
-	return d;
-}
-
-static gboolean
-backlight_compute_udi (HalDevice *d)
+video4linux_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_backlight",
+	hald_compute_udi (udi, sizeof (udi), "%s_video4linux",
 			  hal_device_property_get_string (d, "info.parent"));
 	hal_device_set_udi (d, udi);
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
 
-static void
-refresh_ac_adapter (HalDevice *d)
-{
-	const char *path;
-	gboolean present = FALSE;
-
-	path = hal_device_property_get_string (d, "linux.sysfs_path");
-	if (path == NULL)
-		return;
-
-	if (hal_util_get_bool_from_file (path, "online", &present, "1") == FALSE) {
-		/* if we can't read the property, assume on ac */
-		present = TRUE;
-	}
-
-	hal_device_property_set_bool (d, "ac_adapter.present", present);
-}
-
-static void
-refresh_battery_fast (HalDevice *d)
-{
-	gint percentage = 0;
-	gint voltage_now = 0;
-	gint current = 0;
-	gint time = 0;
-	gint value_now = 0;
-	gint value_last_full = 0;
-	gboolean present = FALSE;
-	gboolean unknown_unit = TRUE;
-	gboolean is_mah = FALSE;
-	gboolean is_mwh = FALSE;
-	gboolean is_charging = FALSE;
-	gboolean is_discharging = FALSE;
-	gboolean got_time = FALSE;
-	gboolean got_percentage = FALSE;
-	const gchar *path;
-	const gchar *reporting_unit;
-	gchar *status;
-
-	path = hal_device_property_get_string (d, "linux.sysfs_path");
-	if (path == NULL)
-		return;
-
-	/* PRESENT */
-	if (hal_util_get_bool_from_file (path, "present", &present, "1")) {
-		hal_device_property_set_bool (d, "battery.present", present);
-	}
-	if (present == FALSE) {
-		/* remove all the optional keys associated with the cell */
-		device_pm_remove_optional_props (d);
-		return;
-	}
-
-	/* CAPACITY */
-	if (hal_util_get_int_from_file (path, "capacity", &percentage, 10)) {
-		/* sanity check */
-		if (percentage >= 0 && percentage <= 100)
-			got_percentage = TRUE;
-	}
-
-	/* VOLTAGE: we prefer the average if it exists, although present is still pretty good */
-	if (hal_util_get_int_from_file (path, "voltage_avg", &voltage_now, 10)) {
-		hal_device_property_set_int (d, "battery.voltage.current", voltage_now / 1000);
-	} else if (hal_util_get_int_from_file (path, "voltage_now", &voltage_now, 10)) {
-		hal_device_property_set_int (d, "battery.voltage.current", voltage_now / 1000);
-	}
-
-	/* CURRENT: we prefer the average if it exists, although present is still pretty good */
-	if (hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
-		hal_device_property_set_int (d, "battery.reporting.rate", current / 1000);
-	} else if (hal_util_get_int_from_file (path, "current_now", &current, 10)) {
-		hal_device_property_set_int (d, "battery.reporting.rate", current / 1000);
-	}
-
-	/* STATUS: Convert to charging/discharging state */
-	status = hal_util_get_string_from_file (path, "status");
-	if (status != NULL) {
-		if (strcasecmp (status, "charging") == 0) {
-			is_charging = TRUE;
-		} else if (strcasecmp (status, "discharging") == 0) {
-			is_discharging = TRUE;
-		}
-		hal_device_property_set_bool (d, "battery.is_rechargeable", TRUE);
-		hal_device_property_set_bool (d, "battery.rechargeable.is_charging", is_charging);
-		hal_device_property_set_bool (d, "battery.rechargeable.is_discharging", is_discharging);
-	}
-
-	/* TIME: Some batteries only provide time to discharge */
-	if (is_charging == TRUE) {
-		if (hal_util_get_int_from_file (path, "time_to_full_avg", &time, 10) ||
-		    hal_util_get_int_from_file (path, "time_to_full_now", &time, 10)) {
-			got_time = TRUE;
-		}
-	} else if (is_discharging == TRUE) {
-		if (hal_util_get_int_from_file (path, "time_to_empty_avg", &time, 10) ||
-		    hal_util_get_int_from_file (path, "time_to_empty_now", &time, 10)) {
-			got_time = TRUE;
-		}
-	}
-
-	/* Have we already got information about the reporting unit?
-	 * If we have, we can save a lots of file reads */
-	reporting_unit = hal_device_property_get_string (d, "battery.reporting.unit");
-	if (reporting_unit != NULL) {
-		if (strcasecmp (reporting_unit, "mah") == 0) {
-			is_mah = TRUE;
-			unknown_unit = FALSE;
-		} else if (strcasecmp (reporting_unit, "mwh") == 0) {
-			is_mwh = TRUE;
-			unknown_unit = FALSE;
-		}
-	}
-
-	/* ENERGY (reported in uWh, so need to convert to mWh) */
-	if (unknown_unit || is_mwh) {
-		if (hal_util_get_int_from_file (path, "energy_avg", &value_now, 10)) {
-			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
-			is_mwh = TRUE;
-		} else if (hal_util_get_int_from_file (path, "energy_now", &value_now, 10)) {
-			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
-			is_mwh = TRUE;
-		}
-		if (hal_util_get_int_from_file (path, "energy_full", &value_last_full, 10)) {
-			hal_device_property_set_int (d, "battery.reporting.last_full", value_last_full / 1000);
-			is_mwh = TRUE;
-		}
-	}
-
-	/* CHARGE (reported in uAh, so need to convert to mAh) */
-	if ((unknown_unit && !is_mwh) || is_mah) {
-		if (hal_util_get_int_from_file (path, "charge_avg", &value_now, 10)) {
-			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
-			is_mah = TRUE;
-		} else if (hal_util_get_int_from_file (path, "charge_now", &value_now, 10)) {
-			hal_device_property_set_int (d, "battery.reporting.current", value_now / 1000);
-			is_mah = TRUE;
-		}
-		if (hal_util_get_int_from_file (path, "charge_full", &value_last_full, 10)) {
-			hal_device_property_set_int (d, "battery.reporting.last_full", value_last_full / 1000);
-			is_mah = TRUE;
-		}
-	}
-
-	/* record these for future savings */
-	if (unknown_unit) {
-		if (is_mwh == TRUE) {
-			hal_device_property_set_string (d, "battery.reporting.unit", "mWh");
-		} else if (is_mah == TRUE) {
-			hal_device_property_set_string (d, "battery.reporting.unit", "mAh");
-		}
-	}
-
-	/* we've now got the 'reporting' keys, now we need to populate the
-	 * processed 'charge_level' keys so stuff like desktop power managers
-	 * do not have to deal with odd quirks */
-	device_pm_abstract_props (d);
-
-	/* if we have not read from the hardware, then calculate */
-	if (got_percentage) {
-		hal_device_property_set_int (d, "battery.charge_level.percentage", percentage);
-	} else {
-		device_pm_calculate_percentage (d);
-	}
-
-	/* if we havn't got time from the hardware, then try to calculate it */
-	if (got_time) {
-		/* zero time isn't displayed */
-		if (time > 0)
-			hal_device_property_set_int (d, "battery.remaining_time", time);
-		else
-			hal_device_property_remove (d, "battery.remaining_time");
-	} else {
-		device_pm_calculate_time (d);
-	}
-}
-
-static void
-refresh_battery_slow (HalDevice *d)
-{
-	gint voltage_design = 0;
-	gint value_full_design = 0;
-	char *technology_raw;
-	char *model_name;
-	char *manufacturer;
-	char *serial;
-	const gchar *path;
-
-	path = hal_device_property_get_string (d, "linux.sysfs_path");
-	if (path == NULL)
-		return;
-
-	/* get battery technology */
-	technology_raw = hal_util_get_string_from_file (path, "technology");
-	if (technology_raw != NULL) {
-		hal_device_property_set_string (d, "battery.reporting.technology", technology_raw);
-	}
-	hal_device_property_set_string (d, "battery.technology", util_get_battery_technology (technology_raw));
-
-	/* get product name */
-	model_name = hal_util_get_string_from_file (path, "model_name");
-	if (model_name != NULL) {
-		hal_device_property_set_string (d, "battery.model", model_name);
-		hal_device_property_set_string (d, "info.product", model_name);
-	} else {
-		hal_device_property_set_string (d, "info.product", "Generic Battery Device");
-	}
-
-	/* get manufacturer */
-	manufacturer = hal_util_get_string_from_file (path, "manufacturer");
-	if (manufacturer != NULL) {
-		hal_device_property_set_string (d, "battery.vendor", manufacturer);
-	}
-
-	/* get stuff that never changes */
-	if (hal_util_get_int_from_file (path, "voltage_max_design", &voltage_design, 10)) {
-		hal_device_property_set_int (d, "battery.voltage.design", voltage_design / 1000);
-		hal_device_property_set_string (d, "battery.voltage.unit", "mV");
-	} else if (hal_util_get_int_from_file (path, "voltage_min_design", &voltage_design, 10)) {
-		hal_device_property_set_int (d, "battery.voltage.design", voltage_design / 1000);
-		hal_device_property_set_string (d, "battery.voltage.unit", "mV");
-	}
-
-	/* try to get the design info and set the units */
-	if (hal_util_get_int_from_file (path, "energy_full_design", &value_full_design, 10)) {
-		hal_device_property_set_int (d, "battery.reporting.design", value_full_design / 1000);
-		hal_device_property_set_string (d, "battery.reporting.unit", "mWh");	
-	} else if (hal_util_get_int_from_file (path, "charge_full_design", &value_full_design, 10)) {
-		hal_device_property_set_int (d, "battery.reporting.design", value_full_design / 1000);
-		hal_device_property_set_string (d, "battery.reporting.unit", "mAh");
-	}
-
-	/* get serial */
-	serial = hal_util_get_string_from_file (path, "serial_number");
-	if (serial != NULL) {
-		hal_device_property_set_string (d, "battery.serial", serial);
-	}
-
-	/* now do stuff that happens quickly */
-	refresh_battery_fast (d);
-}
-
-static gboolean
-power_supply_refresh (HalDevice *d)
-{
-	const gchar *type;
-	type = hal_device_property_get_string (d, "info.category");
-	if (type == NULL) {
-		return FALSE;
-	}
-	if (strcmp (type, "ac_adapter") == 0) {
-		device_property_atomic_update_begin ();
-		refresh_ac_adapter (d);
-		device_property_atomic_update_end ();
-	} else if (strcmp (type, "battery") == 0) {
-		device_property_atomic_update_begin ();
-		refresh_battery_fast (d);
-		device_property_atomic_update_end ();
-	} else {
-		HAL_WARNING (("Could not recognise power_supply type!"));
-		return FALSE;
-	}
-	return TRUE;
-}
-
-
-static gboolean 
-power_supply_battery_poll (gpointer data) {
-
-	GSList *i;
-	GSList *battery_devices;
-	HalDevice *d;
-	gboolean battery_polled = FALSE;
-
-	/* for now do it only for primary batteries and extend if neede for the other types */
-	battery_devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
-                                                                    	    "battery.type",
- 	                                                                    "primary");
-
-	if (battery_devices) {
-		for (i = battery_devices; i != NULL; i = g_slist_next (i)) {
-			const char *subsys;
-
-			d = HAL_DEVICE (i->data);
-
-			/* don't poll batteries if quirk is in place */
-			if (hal_device_property_get_bool (d, "battery.quirk.do_not_poll"))
-				continue;
-
-			subsys = hal_device_property_get_string (d, "info.subsystem");
-			if (subsys && (strcmp(subsys, "power_supply") == 0)) {
-				hal_util_grep_discard_existing_data();
-				device_property_atomic_update_begin ();
-				refresh_battery_fast(d);
-				device_property_atomic_update_end ();
-				battery_polled = TRUE;
-			}
-		}		
-	}
-
-	g_slist_free (battery_devices);
-
-	battery_poll_running = battery_polled;
-	return battery_polled;
-}
-
-static HalDevice *
-power_supply_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev,
-		  const gchar *sysfs_path_in_devices)
-{
-	HalDevice *d = NULL;
-	gboolean is_battery = FALSE;
-	gboolean is_ac_adapter = FALSE;
-	char *type = NULL;
-	const char *battery_type = NULL;
-
-	/* power_supply devices are very odd, they might be batteries or ac-adapters */
-	type = hal_util_get_string_from_file (sysfs_path, "type");
-	if (type == NULL) {
-		/* we don't need to free */
-		goto finish;
-	}
-	if (strcasecmp (type, "battery") == 0) {
-		is_battery = TRUE;
-		battery_type = "primary";
-	} else if (strcasecmp (type, "ups") == 0) {
-		is_battery = TRUE;
-		battery_type = "ups";
-	} else if (strcasecmp (type, "usb") == 0) {
-		is_battery = TRUE;
-		battery_type = "usb";
-	} else if (strcasecmp (type, "mains") == 0) {
-		is_ac_adapter = TRUE;
-	} else {
-		HAL_WARNING (("Power supply is neither ac_adapter or battery!"));
-		goto finish;
-	}
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-
-	if (is_battery == TRUE) {
-		hal_device_property_set_string (d, "info.category", "battery");
-		if (battery_type != NULL)
-			hal_device_property_set_string (d, "battery.type", battery_type);
-		refresh_battery_slow (d);
-		hal_device_add_capability (d, "battery");
-
-		/* setup timer for things that we need to poll */
-		if (!battery_poll_running) {
-#ifdef HAVE_GLIB_2_14
-			g_timeout_add_seconds (POWER_SUPPLY_BATTERY_POLL_INTERVAL,
-                                               power_supply_battery_poll,
-                                               NULL);
-#else
-			g_timeout_add (1000 * POWER_SUPPLY_BATTERY_POLL_INTERVAL,
-                                       power_supply_battery_poll,
-                                       NULL);
-#endif
-			battery_poll_running = TRUE;
-		}
-	}
-
-	if (is_ac_adapter == TRUE) {
-		hal_device_property_set_string (d, "info.category", "ac_adapter");
-		hal_device_property_set_string (d, "info.product", "Generic AC Adapter Device");
-		refresh_ac_adapter (d);
-		hal_device_add_capability (d, "ac_adapter");
-	}
-
-	_have_sysfs_power_supply = TRUE;
-finish:
-	return d;
-}
-
-static gboolean
-power_supply_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-	const char *dir;
-	const char *name;
-
-	dir = hal_device_property_get_string (d, "linux.sysfs_path");
-
-	name = hal_util_get_last_element(dir);
-	if (name) 
-		hald_compute_udi (udi, sizeof (udi),
-				  "%s_power_supply_%s_%s",
-				  hal_device_property_get_string (d, "info.parent"),
-				  hal_device_property_get_string (d, "info.category"),
-				  name);
-	else
-		hald_compute_udi (udi, sizeof (udi),
-				  "%s_power_supply_%s",
-				  hal_device_property_get_string (d, "info.parent"),
-				  hal_device_property_get_string (d, "info.category"));
-
-	hal_device_set_udi (d, udi);
 	return TRUE;
 }
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-rfkill_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+vio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
+		    const gchar *sysfs_path_in_devices)
 {
 	HalDevice *d;
-        gchar buf[64];
-	const gchar *type;
+	const gchar *dev_id;
+	const gchar *dev_type;
+	gchar buf[64];
 
 	d = hal_device_new ();
-	hal_device_add_capability (d, "killswitch");
-	hal_device_property_set_string (d, "info.category", "killswitch");
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	
 	if (parent_dev != NULL) {
 		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-		hal_device_copy_property( parent_dev, "info.vendor", d, "info.vendor");
 	} else {
 		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
 	}
 
-	type = hal_util_get_string_from_file (sysfs_path, "type");
-	if (type == NULL)
-		type = "unknown";
-
-	if (strcasecmp (type, "wimax") == 0) {
-		hal_device_property_set_string (d, "killswitch.type", "wwan");
-	} else { 
-		hal_device_property_set_string (d, "killswitch.type", type);
-	}
-
-	hal_util_set_string_from_file (d, "killswitch.name", sysfs_path, "name");
-
-        g_snprintf(buf, sizeof(buf), "%s %s Killswitch", hal_device_property_get_string (d, "killswitch.name"),
-							 hal_device_property_get_string (d, "killswitch.type"));
-        hal_device_property_set_string (d, "info.product", buf);
-
-	return d;
-}
-
-static gboolean
-rfkill_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_rfkill_%s_%s",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_string (d, "killswitch.name"),
-			  hal_device_property_get_string (d, "killswitch.type"));
-	hal_device_set_udi (d, udi);
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
-drm_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d = NULL;
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
 
-	d = hal_device_new ();
+	dev_id = hal_util_get_last_element (sysfs_path);
+	hal_device_property_set_string (d, "vio.id", dev_id);
 
-	hal_device_add_capability (d, "drm");
+	dev_type = hal_util_get_string_from_file (sysfs_path, "name");
 
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-		hal_device_copy_property( parent_dev, "info.vendor", d, "info.vendor");
+	if (dev_type) {
+		hal_device_property_set_string (d, "vio.type", dev_type);
+		g_snprintf (buf, sizeof (buf), "Vio %s Device (%s)", dev_type, dev_id);
+		hal_device_property_set_string (d, "info.product", buf);
 	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+		hal_device_property_set_string (d, "info.product", "Vio Device (unknown)");
 	}
 
-	hal_device_property_set_string (d, "info.product", "Direct Rendering Manager Device");
-	hal_device_property_set_string (d, "info.category", "drm");
-	hal_device_property_set_string (d, "linux.device_file", device_file);
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path); /* not sure if this is needed/set */
-	hal_util_set_string_from_file (d, "drm.dri_library", sysfs_path, "dri_library_name");
-	hal_util_set_string_from_file (d, "drm.version", sysfs_path, "../version");
-	
 	return d;
 }
 
 static gboolean
-drm_compute_udi (HalDevice *d)
+vio_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
-	const char *dir;
-	const char *name;
-
-	dir = hal_device_property_get_string (d, "linux.sysfs_path");
-
-	name = hal_util_get_last_element(dir);
-
-	/* generate e.g.: /org/freedesktop/Hal/devices/pci_8086_2a02_drm_i915_card0 */
-	hald_compute_udi (udi, sizeof (udi),
-			  "%s_drm_%s_%s",
-			  hal_device_property_get_string (d, "info.parent"),
-			  hal_device_property_get_string (d, "drm.dri_library"),
-			  name);
-
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
+	const char *type;
 
-static HalDevice *
-ps3_system_bus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
-		    const gchar *sysfs_path_in_devices)
-{
-	HalDevice *d;
-	const gchar *dev_id;
-	gchar buf[64];
+	type = hal_device_property_get_string (d, "vio.type");
 
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	if (type) {
+		hald_compute_udi (udi, sizeof (udi),
+				  "/org/freedesktop/Hal/devices/vio_%s_%s",
+				  type,
+				  hal_device_property_get_string (d, "vio.id"));
 	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+		hald_compute_udi (udi, sizeof (udi),
+				  "/org/freedesktop/Hal/devices/vio_%s",
+				  hal_device_property_get_string (d, "vio.id"));
 	}
 
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	dev_id = hal_util_get_last_element (sysfs_path);
-
-	hal_device_property_set_string (d, "ps3_system_bus.id", dev_id);
-
-	g_snprintf (buf, sizeof (buf), "PS3 Device (%s)", hal_device_property_get_string (d, "ps3_system_bus.id"));
-	hal_device_property_set_string (d, "info.product", buf);
-
-	return d;
-}
-
-static gboolean
-ps3_system_bus_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/ps3_system_bus_%s",
-			  hal_device_property_get_string (d, "ps3_system_bus.id"));
 	hal_device_set_udi (d, udi);
 
 	return TRUE;
@@ -3708,67 +3796,6 @@ virtio_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-vio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
-		    const gchar *sysfs_path_in_devices)
-{
-	HalDevice *d;
-	const gchar *dev_id;
-	const gchar *dev_type;
-	gchar buf[64];
-
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
-	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-	}
-
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	dev_id = hal_util_get_last_element (sysfs_path);
-	hal_device_property_set_string (d, "vio.id", dev_id);
-
-	dev_type = hal_util_get_string_from_file (sysfs_path, "name");
-
-	if (dev_type) {
-		hal_device_property_set_string (d, "vio.type", dev_type);
-		g_snprintf (buf, sizeof (buf), "Vio %s Device (%s)", dev_type, dev_id);
-		hal_device_property_set_string (d, "info.product", buf);
-	} else {
-		hal_device_property_set_string (d, "info.product", "Vio Device (unknown)");
-	}
-
-	return d;
-}
-
-static gboolean
-vio_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-	const char *type;
-
-	type = hal_device_property_get_string (d, "vio.type");
-
-	if (type) {
-		hald_compute_udi (udi, sizeof (udi),
-				  "/org/freedesktop/Hal/devices/vio_%s_%s",
-				  type,
-				  hal_device_property_get_string (d, "vio.id"));
-	} else {
-		hald_compute_udi (udi, sizeof (udi),
-				  "/org/freedesktop/Hal/devices/vio_%s",
-				  hal_device_property_get_string (d, "vio.id"));
-	}
-
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
-
-/*--------------------------------------------------------------------------------------------------------------*/
-
-static HalDevice *
 vmbus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
@@ -3834,16 +3861,13 @@ vmbus_compute_udi (HalDevice *d)
 	return TRUE;
 }
 
-
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
-of_platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
-		 const gchar *sysfs_path_in_devices)
+xen_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
-	const gchar *dev_id;
-	gchar buf[64];
+	const gchar *devtype;
 
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
@@ -3855,68 +3879,45 @@ of_platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *p
 
 	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
 
-	dev_id = hal_util_get_last_element (sysfs_path);
-
-	hal_device_property_set_string (d, "of_platform.id", dev_id);
-
-	g_snprintf (buf, sizeof (buf), "OpenFirmware Platform Device (%s)", hal_device_property_get_string (d, "of_platform.id"));
-	hal_device_property_set_string (d, "info.product", buf);
-
-	return d;
-}
-
-static gboolean
-of_platform_compute_udi (HalDevice *d)
-{
-	gchar udi[256];
-
-	hald_compute_udi (udi, sizeof (udi), "/org/freedesktop/Hal/devices/of_platform_%s",
-			 hal_device_property_get_string (d, "of_platform.id"));
-	hal_device_set_udi (d, udi);
-
-	return TRUE;
-}
+	hal_device_property_set_string (d, "xen.bus_id",
+					hal_util_get_last_element (sysfs_path));
 
-/*--------------------------------------------------------------------------------------------------------------*/
+	hal_util_set_string_from_file (d, "xen.path", sysfs_path, "nodename");
 
-static HalDevice *
-pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
-{
-	HalDevice *d;
-	const gchar *dev_id;
-	gchar buf[64];
+	devtype = hal_util_get_string_from_file (sysfs_path, "devtype");
+	if (devtype != NULL) {
+		hal_device_property_set_string (d, "xen.type", devtype);
 
-	d = hal_device_new ();
-	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	if (parent_dev != NULL) {
-		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+		if (strcmp (devtype, "pci") == 0) {
+			hal_device_property_set_string (d, "info.product", "Xen PCI Device");
+		} else if (strcmp (devtype, "vbd") == 0) {
+			hal_device_property_set_string (d, "info.product", "Xen Virtual Block Device");
+		} else if (strcmp (devtype, "vif") == 0) {
+			hal_device_property_set_string (d, "info.product", "Xen Virtual Network Device");
+		} else if (strcmp (devtype, "vtpm") == 0) {
+			hal_device_property_set_string (d, "info.product", "Xen Virtual Trusted Platform Module");
+		} else {
+			char buf[64];
+			g_snprintf (buf, sizeof (buf), "Xen Device (%s)", devtype);
+			hal_device_property_set_string (d, "info.product", buf);
+		}
 	} else {
-		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+		 hal_device_property_set_string (d, "info.product", "Xen Device (unknown)");
 	}
 
-	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
-
-	dev_id = hal_util_get_last_element (sysfs_path);
-	hal_device_property_set_string (d, "pseudo.id", dev_id);
-
-	g_snprintf (buf, sizeof (buf), "SCSI Debug Device (%s)", hal_device_property_get_string (d, "pseudo.id"));
-	hal_device_property_set_string (d, "info.product", buf);
-
 	return d;
 }
 
 static gboolean
-pseudo_compute_udi (HalDevice *d)
+xen_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
 
 	hald_compute_udi (udi, sizeof (udi),
-			  "/org/freedesktop/Hal/devices/pseudo",
-			  hal_device_property_get_string (d, "platform.id"));
+			  "/org/freedesktop/Hal/devices/xen_%s",
+			  hal_device_property_get_string (d, "xen.bus_id"));
 	hal_device_set_udi (d, udi);
-
 	return TRUE;
-
 }
 
 /*--------------------------------------------------------------------------------------------------------------*/
@@ -3945,15 +3946,15 @@ struct DevHandler_s
 };
 
 /*--------------------------------------------------------------------------------------------------------------*/
+/* 		 	PLEASE KEEP THE SUBSYSTEMS IN ALPHABETICAL ORDER !!!					*/
+/*--------------------------------------------------------------------------------------------------------------*/
 
-static DevHandler dev_handler_input = 
-{ 
-	.subsystem    = "input",
-	.add          = input_add,
-	.get_prober   = input_get_prober,
-	.post_probing = input_post_probing,
-	.compute_udi  = input_compute_udi,
-	.remove       = dev_remove
+static DevHandler dev_handler_backlight =
+{
+       .subsystem    = "backlight",
+       .add          = backlight_add,
+       .compute_udi  = backlight_compute_udi,
+       .remove       = dev_remove
 };
 
 static DevHandler dev_handler_bluetooth = 
@@ -3966,65 +3967,27 @@ static DevHandler dev_handler_bluetooth =
 	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_net = 
-{ 
-	.subsystem    = "net",
-	.add          = net_add,
-	.refresh      = net_refresh,
-	.get_prober   = net_get_prober,
-	.post_probing = net_post_probing,
-	.compute_udi  = net_compute_udi,
-	.remove       = dev_remove
-};
-
-static DevHandler dev_handler_scsi_generic =
-{ 
-	.subsystem    = "scsi_generic",
-	.add          = scsi_generic_add,
-	.get_prober   = NULL,
-	.post_probing = NULL,
-	.compute_udi  = scsi_generic_compute_udi,
-	.remove       = dev_remove
-};
-
-static DevHandler dev_handler_scsi_host = 
-{ 
-	.subsystem    = "scsi_host",
-	.add          = scsi_host_add,
-	.get_prober   = NULL,
-	.post_probing = NULL,
-	.compute_udi  = scsi_host_compute_udi,
-	.remove       = dev_remove
-};
-
-static DevHandler dev_handler_usbclass = 
-{ 
-	.subsystem    = "usb",
-	.add          = usbclass_add,
-	.get_prober   = usbclass_get_prober,
-	.post_probing = NULL,
-	.compute_udi  = usbclass_compute_udi,
-	.remove       = dev_remove
+/* s390 specific busses */
+static DevHandler dev_handler_ccw = {
+	.subsystem   = "ccw",
+	.add         = ccw_add,
+	.compute_udi = ccw_compute_udi,
+	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_usbraw =
-{ 
-	.subsystem    = "usb_device",
-	.add          = usbraw_add,
-	.get_prober   = NULL,
-	.post_probing = NULL,
-	.compute_udi  = usbraw_compute_udi,
-	.remove       = dev_remove
+static DevHandler dev_handler_ccwgroup = {
+	.subsystem   = "ccwgroup",
+	.add         = ccwgroup_add,
+	.compute_udi = ccwgroup_compute_udi,
+	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_video4linux =
-{ 
-	.subsystem    = "video4linux",
-	.add          = video4linux_add,
-	.get_prober   = video4linux_get_prober,
-	.post_probing = NULL,
-	.compute_udi  = video4linux_compute_udi,
-	.remove       = dev_remove
+static DevHandler dev_handler_drm =
+{
+       .subsystem    = "drm",
+       .add          = drm_add,
+       .compute_udi  = drm_compute_udi,
+       .remove       = dev_remove
 };
 
 static DevHandler dev_handler_dvb =
@@ -4037,44 +4000,52 @@ static DevHandler dev_handler_dvb =
 	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_sound = 
-{ 
-	.subsystem    = "sound",
-	.add          = sound_add,
-	.get_prober   = NULL,
-	.post_probing = NULL,
-	.compute_udi  = sound_compute_udi,
+/* krh's new firewire stack */
+static DevHandler dev_handler_firewire = { 
+	.subsystem    = "firewire",
+	.add          = firewire_add,
+	.get_prober   = firewire_get_prober,
+	.post_probing = firewire_post_probing,
+	.compute_udi  = firewire_compute_udi,
 	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_serial = 
+static DevHandler dev_handler_ide = { 
+	.subsystem   = "ide",
+	.add         = ide_add,
+	.compute_udi = ide_compute_udi,
+	.remove      = dev_remove
+};
+
+static DevHandler dev_handler_ieee1394 = { 
+	.subsystem   = "ieee1394",
+	.add         = ieee1394_add,
+	.compute_udi = ieee1394_compute_udi,
+	.remove      = dev_remove
+};
+
+static DevHandler dev_handler_input = 
 { 
-	.subsystem    = "tty",
-	.add          = serial_add,
-	.get_prober   = serial_get_prober,
-	.post_probing = NULL,
-	.compute_udi  = serial_compute_udi,
+	.subsystem    = "input",
+	.add          = input_add,
+	.get_prober   = input_get_prober,
+	.post_probing = input_post_probing,
+	.compute_udi  = input_compute_udi,
 	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_tape =
-{
-	.subsystem    = "tape",
-	.add          = tape_add,
-	.get_prober   = NULL,
-	.post_probing = NULL,
-	.compute_udi  = tape_compute_udi,
-	.remove       = dev_remove
+static DevHandler dev_handler_iucv = {
+	.subsystem   = "iucv",
+	.add         = iucv_add,
+	.compute_udi = iucv_compute_udi,
+	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_tape390 =
-{
-	.subsystem    = "tape390",
-	.add          = tape_add,
-	.get_prober   = NULL,
-	.post_probing = NULL,
-	.compute_udi  = tape_compute_udi,
-	.remove       = dev_remove
+static DevHandler dev_handler_mmc = { 
+	.subsystem   = "mmc",
+	.add         = mmc_add,
+	.compute_udi = mmc_compute_udi,
+	.remove      = dev_remove
 };
 
 static DevHandler dev_handler_mmc_host =
@@ -4087,6 +4058,25 @@ static DevHandler dev_handler_mmc_host =
 	.remove       = dev_remove
 };
 
+static DevHandler dev_handler_net = 
+{ 
+	.subsystem    = "net",
+	.add          = net_add,
+	.refresh      = net_refresh,
+	.get_prober   = net_get_prober,
+	.post_probing = net_post_probing,
+	.compute_udi  = net_compute_udi,
+	.remove       = dev_remove
+};
+
+static DevHandler dev_handler_of_platform =
+{
+	.subsystem   = "of_platform",
+	.add         = of_platform_add,
+	.compute_udi = of_platform_compute_udi,
+	.remove      = dev_remove
+};
+
 static DevHandler dev_handler_pci = { 
 	.subsystem   = "pci",
 	.add         = pci_add,
@@ -4094,17 +4084,18 @@ static DevHandler dev_handler_pci = {
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_usb = { 
-	.subsystem   = "usb",
-	.add         = usb_add,
-	.compute_udi = usb_compute_udi,
+static DevHandler dev_handler_pcmcia = { 
+	.subsystem   = "pcmcia",
+	.add         = pcmcia_add,
+	.compute_udi = pcmcia_compute_udi,
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_ide = { 
-	.subsystem   = "ide",
-	.add         = ide_add,
-	.compute_udi = ide_compute_udi,
+static DevHandler dev_handler_platform = {
+	.subsystem   = "platform",
+	.add         = platform_add,
+	.refresh     = platform_refresh,
+	.compute_udi = platform_compute_udi,
 	.remove      = dev_remove
 };
 
@@ -4115,26 +4106,37 @@ static DevHandler dev_handler_pnp = {
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_platform = {
-	.subsystem   = "platform",
-	.add         = platform_add,
-	.refresh     = platform_refresh,
-	.compute_udi = platform_compute_udi,
+static DevHandler dev_handler_ps3_system_bus =
+{
+	.subsystem   = "ps3_system_bus",
+	.add         = ps3_system_bus_add,
+	.compute_udi = ps3_system_bus_compute_udi,
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_serio = { 
-	.subsystem   = "serio",
-	.add         = serio_add,
-	.compute_udi = serio_compute_udi,
+/* SCSI debug, to test thousends of fake devices */
+static DevHandler dev_handler_pseudo = {
+	.subsystem   = "pseudo",
+	.add         = pseudo_add,
+	.compute_udi = pseudo_compute_udi,
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_pcmcia = { 
-	.subsystem   = "pcmcia",
-	.add         = pcmcia_add,
-	.compute_udi = pcmcia_compute_udi,
-	.remove      = dev_remove
+static DevHandler dev_handler_power_supply =
+{
+       .subsystem    = "power_supply",
+       .add          = power_supply_add,
+       .refresh      = power_supply_refresh,
+       .compute_udi  = power_supply_compute_udi,
+       .remove       = dev_remove
+};
+
+static DevHandler dev_handler_rfkill =
+{
+       .subsystem    = "rfkill",
+       .add          = rfkill_add,
+       .compute_udi  = rfkill_compute_udi,
+       .remove       = dev_remove
 };
 
 static DevHandler dev_handler_scsi = { 
@@ -4143,12 +4145,24 @@ static DevHandler dev_handler_scsi = {
 	.compute_udi = scsi_compute_udi,
 	.remove      = dev_remove
 };
+static DevHandler dev_handler_scsi_generic =
+{ 
+	.subsystem    = "scsi_generic",
+	.add          = scsi_generic_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = scsi_generic_compute_udi,
+	.remove       = dev_remove
+};
 
-static DevHandler dev_handler_mmc = { 
-	.subsystem   = "mmc",
-	.add         = mmc_add,
-	.compute_udi = mmc_compute_udi,
-	.remove      = dev_remove
+static DevHandler dev_handler_scsi_host = 
+{ 
+	.subsystem    = "scsi_host",
+	.add          = scsi_host_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = scsi_host_compute_udi,
+	.remove       = dev_remove
 };
 
 static DevHandler dev_handler_sdio = { 
@@ -4158,91 +4172,95 @@ static DevHandler dev_handler_sdio = {
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_ieee1394 = { 
-	.subsystem   = "ieee1394",
-	.add         = ieee1394_add,
-	.compute_udi = ieee1394_compute_udi,
-	.remove      = dev_remove
-};
-
-/* krh's new firewire stack */
-static DevHandler dev_handler_firewire = { 
-	.subsystem    = "firewire",
-	.add          = firewire_add,
-	.get_prober   = firewire_get_prober,
-	.post_probing = firewire_post_probing,
-	.compute_udi  = firewire_compute_udi,
+static DevHandler dev_handler_serial = 
+{ 
+	.subsystem    = "tty",
+	.add          = serial_add,
+	.get_prober   = serial_get_prober,
+	.post_probing = NULL,
+	.compute_udi  = serial_compute_udi,
 	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_xen = {
-	.subsystem   = "xen",
-	.add         = xen_add,
-	.compute_udi = xen_compute_udi,
-	.remove      = dev_remove
-};
-
-/* s390 specific busses */
-static DevHandler dev_handler_ccw = {
-	.subsystem   = "ccw",
-	.add         = ccw_add,
-	.compute_udi = ccw_compute_udi,
+static DevHandler dev_handler_serio = { 
+	.subsystem   = "serio",
+	.add         = serio_add,
+	.compute_udi = serio_compute_udi,
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_ccwgroup = {
-	.subsystem   = "ccwgroup",
-	.add         = ccwgroup_add,
-	.compute_udi = ccwgroup_compute_udi,
-	.remove      = dev_remove
+static DevHandler dev_handler_sound = 
+{ 
+	.subsystem    = "sound",
+	.add          = sound_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = sound_compute_udi,
+	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_iucv = {
-	.subsystem   = "iucv",
-	.add         = iucv_add,
-	.compute_udi = iucv_compute_udi,
-	.remove      = dev_remove
+static DevHandler dev_handler_tape =
+{
+	.subsystem    = "tape",
+	.add          = tape_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = tape_compute_udi,
+	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_backlight =
+static DevHandler dev_handler_tape390 =
 {
-       .subsystem    = "backlight",
-       .add          = backlight_add,
-       .compute_udi  = backlight_compute_udi,
-       .remove       = dev_remove
+	.subsystem    = "tape390",
+	.add          = tape_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = tape_compute_udi,
+	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_power_supply =
-{
-       .subsystem    = "power_supply",
-       .add          = power_supply_add,
-       .refresh      = power_supply_refresh,
-       .compute_udi  = power_supply_compute_udi,
-       .remove       = dev_remove
+static DevHandler dev_handler_usb = { 
+	.subsystem   = "usb",
+	.add         = usb_add,
+	.compute_udi = usb_compute_udi,
+	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_rfkill =
-{
-       .subsystem    = "rfkill",
-       .add          = rfkill_add,
-       .compute_udi  = rfkill_compute_udi,
-       .remove       = dev_remove
+static DevHandler dev_handler_usbclass = 
+{ 
+	.subsystem    = "usb",
+	.add          = usbclass_add,
+	.get_prober   = usbclass_get_prober,
+	.post_probing = NULL,
+	.compute_udi  = usbclass_compute_udi,
+	.remove       = dev_remove
 };
 
+static DevHandler dev_handler_usbraw =
+{ 
+	.subsystem    = "usb_device",
+	.add          = usbraw_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = usbraw_compute_udi,
+	.remove       = dev_remove
+};
 
-static DevHandler dev_handler_drm =
-{
-       .subsystem    = "drm",
-       .add          = drm_add,
-       .compute_udi  = drm_compute_udi,
-       .remove       = dev_remove
+static DevHandler dev_handler_video4linux =
+{ 
+	.subsystem    = "video4linux",
+	.add          = video4linux_add,
+	.get_prober   = video4linux_get_prober,
+	.post_probing = NULL,
+	.compute_udi  = video4linux_compute_udi,
+	.remove       = dev_remove
 };
 
-static DevHandler dev_handler_ps3_system_bus =
+static DevHandler dev_handler_vio =
 {
-	.subsystem   = "ps3_system_bus",
-	.add         = ps3_system_bus_add,
-	.compute_udi = ps3_system_bus_compute_udi,
+	.subsystem   = "vio",
+	.add         = vio_add,
+	.compute_udi = vio_compute_udi,
 	.remove      = dev_remove
 };
 
@@ -4254,14 +4272,6 @@ static DevHandler dev_handler_virtio =
 	.remove      = dev_remove
 };
 
-static DevHandler dev_handler_vio =
-{
-	.subsystem   = "vio",
-	.add         = vio_add,
-	.compute_udi = vio_compute_udi,
-	.remove      = dev_remove
-};
-
 static DevHandler dev_handler_vmbus =
 {
 	.subsystem   = "vmbus",
@@ -4271,65 +4281,58 @@ static DevHandler dev_handler_vmbus =
 };
 
 
-static DevHandler dev_handler_of_platform =
-{
-	.subsystem   = "of_platform",
-	.add         = of_platform_add,
-	.compute_udi = of_platform_compute_udi,
-	.remove      = dev_remove
-};
-
-/* SCSI debug, to test thousends of fake devices */
-static DevHandler dev_handler_pseudo = {
-	.subsystem   = "pseudo",
-	.add         = pseudo_add,
-	.compute_udi = pseudo_compute_udi,
+static DevHandler dev_handler_xen = {
+	.subsystem   = "xen",
+	.add         = xen_add,
+	.compute_udi = xen_compute_udi,
 	.remove      = dev_remove
 };
 
 /*--------------------------------------------------------------------------------------------------------------*/
+/* 		 	PLEASE KEEP THE SUBSYSTEMS IN ALPHABETICAL ORDER !!!					*/
+/*--------------------------------------------------------------------------------------------------------------*/
 
 static DevHandler *dev_handlers[] = {
-	&dev_handler_pci,
-	&dev_handler_usbclass,
-	&dev_handler_usb,
-	&dev_handler_ide,
-	&dev_handler_pnp,
-	&dev_handler_platform,
-	&dev_handler_serio,
-	&dev_handler_pcmcia,
-	&dev_handler_scsi,
-	&dev_handler_mmc,
-	&dev_handler_sdio,
-	&dev_handler_ieee1394,
-	&dev_handler_xen,
+	&dev_handler_backlight,
+	&dev_handler_bluetooth,
 	&dev_handler_ccw,
 	&dev_handler_ccwgroup,
-	&dev_handler_iucv,
-	&dev_handler_pseudo,
+	&dev_handler_drm,
+	&dev_handler_dvb,
+	&dev_handler_firewire,
+	&dev_handler_ide,
+	&dev_handler_ieee1394,
 	&dev_handler_input,
-	&dev_handler_bluetooth,
+	&dev_handler_iucv,
+	&dev_handler_mmc,
+	&dev_handler_mmc_host,
 	&dev_handler_net,
+	&dev_handler_of_platform,
+	&dev_handler_pci,
+	&dev_handler_pcmcia,
+	&dev_handler_platform,
+	&dev_handler_pnp,
+	&dev_handler_power_supply,
+	&dev_handler_ps3_system_bus,
+	&dev_handler_pseudo,
+	&dev_handler_rfkill,
+	&dev_handler_scsi,
 	&dev_handler_scsi_generic,
 	&dev_handler_scsi_host,
-	&dev_handler_usbraw,
-	&dev_handler_video4linux,
-	&dev_handler_dvb,
-	&dev_handler_sound,
+	&dev_handler_sdio,
 	&dev_handler_serial,
+	&dev_handler_serio,
+	&dev_handler_sound,
 	&dev_handler_tape,
 	&dev_handler_tape390,
-	&dev_handler_mmc_host,
-	&dev_handler_backlight,
-	&dev_handler_firewire,
-	&dev_handler_power_supply,
-	&dev_handler_rfkill,
-	&dev_handler_drm,
-	&dev_handler_ps3_system_bus,
-	&dev_handler_virtio,
+	&dev_handler_usb,
+	&dev_handler_usbclass,
+	&dev_handler_usbraw,
+	&dev_handler_video4linux,
 	&dev_handler_vio,
+	&dev_handler_virtio,
 	&dev_handler_vmbus,
-	&dev_handler_of_platform,
+	&dev_handler_xen,
 	NULL
 };
 


More information about the hal-commit mailing list