hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Thu Mar 6 05:35:15 PST 2008


 doc/spec/hal-spec-properties.xml |   10 +++++++++-
 hald/linux/device.c              |   31 ++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 8 deletions(-)

New commits:
commit e35dc066876852a2006261b72ec7eccbf2c6e38c
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Thu Mar 6 14:35:09 2008 +0100

    vio bus: added type of vio bus and changed info.product/udi
    
    Added device type to vio devices (e.g. viodasd, v-scsi, l-lan), removed
    usage of info.bus, Changed info.product and udi generation. Added
    new key vio.type to the spec and fixed example for vio.id.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index afad7c6..afb638f 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -3019,10 +3019,18 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
               <entry>
                 <literal>vio.id</literal> (string)
               </entry>
-              <entry>example: 30000003</entry>
+              <entry>example: 1,10,3d</entry>
               <entry>Yes</entry>
               <entry>Device identification</entry>
             </row>
+            <row>
+              <entry>
+                <literal>vio.type</literal> (string)
+              </entry>
+              <entry>example: viodasd, v-scsi, l-lan</entry>
+              <entry>Yes</entry>
+              <entry>Device type.</entry>
+            </row>
           </tbody>
         </tgroup>
       </informaltable>
diff --git a/hald/linux/device.c b/hald/linux/device.c
index e4aae0c..8a9ed15 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3615,12 +3615,12 @@ vio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 {
 	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);
 	hal_device_property_set_string (d, "info.subsystem", "vio");
-	hal_device_property_set_string (d, "info.bus", "vio");
 	if (parent_dev != NULL) {
 		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
 	} else {
@@ -3630,11 +3630,17 @@ vio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	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);
 
-	g_snprintf (buf, sizeof (buf), "Vio Device (%s)", hal_device_property_get_string (d, "vio.id"));
-	hal_device_property_set_string (d, "info.product", buf);
+	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;
 }
@@ -3643,10 +3649,21 @@ static gboolean
 vio_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
+	const char *type;
+
+	type = hal_device_property_get_string (d, "vio.type");
+
+	if (type) {
+		hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+				      "/org/freedesktop/Hal/devices/vio_%s_%s",
+				      type,
+				      hal_device_property_get_string (d, "vio.id"));
+	} else {
+		hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+				      "/org/freedesktop/Hal/devices/vio_%s",
+				      hal_device_property_get_string (d, "vio.id"));
+	}		
 
-	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-			      "/org/freedesktop/Hal/devices/vio_%s",
-			      hal_device_property_get_string (d, "vio.id"));
 	hal_device_set_udi (d, udi);
 	hal_device_property_set_string (d, "info.udi", udi);
 


More information about the hal-commit mailing list