hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Thu Feb 21 12:48:19 PST 2008


 doc/spec/hal-spec-properties.xml |   33 +++++++++++++++++++++++
 hald/linux/device.c              |   55 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)

New commits:
commit 75a9042c1e31da76b7c448dc921d6dc744ca9a86
Author: Colin Watson <cjwatson at ubuntu.com>
Date:   Thu Feb 21 21:48:12 2008 +0100

    add ps3 system bus support
    
    The attached patch adds fairly trivial support for
    /sys/bus/ps3_system_bus, as found on PlayStation 3 systems. I've tested
    this on Ubuntu 7.10, which ships Linux 2.6.22 with some patches pulled
    from the PS3 development tree. This is enough to be able to let
    NetworkManager successfully manage the wired network device on that
    system, which I figured was a decent result.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 877ea5f..f3e5752 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -2837,6 +2837,39 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
         </tgroup>
       </informaltable>
     </sect2>
+    <sect2 id="device-properties-ps3_system_bus">
+      <title>
+        ps3_system_bus namespace
+      </title>
+      <para>
+        Devices on the PlayStation 3 system bus are represented by device
+        objects where <literal>info.subsystem</literal> equals
+        <literal>ps3_system_bus</literal>. The following properties are
+        available for such device objects.
+      </para>
+      <informaltable>
+        <tgroup cols="2">
+          <thead>
+            <row>
+              <entry>Key (type)</entry>
+              <entry>Values</entry>
+              <entry>Mandatory</entry>
+              <entry>Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry>
+                <literal>ps3_system_bus.id</literal> (string)
+              </entry>
+              <entry>example: serial</entry>
+              <entry>Yes</entry>
+              <entry>Device identification</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </informaltable>
+    </sect2>
   </sect1>
 
   <sect1 id="properties-functional">
diff --git a/hald/linux/device.c b/hald/linux/device.c
index ef55089..c566914 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3456,6 +3456,52 @@ drm_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 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);
+	hal_device_property_set_string (d, "info.subsystem", "ps3_system_bus");
+	hal_device_property_set_string (d, "info.bus", "ps3_system_bus");
+	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];
+
+	hal_util_compute_udi (hald_get_gdl (), 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);
+	hal_device_property_set_string (d, "info.udi", udi);
+
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
 pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
@@ -3801,6 +3847,14 @@ static DevHandler dev_handler_drm =
        .remove       = dev_remove
 };
 
+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
+};
+
 /* SCSI debug, to test thousends of fake devices */
 static DevHandler dev_handler_pseudo = {
 	.subsystem   = "pseudo",
@@ -3845,6 +3899,7 @@ static DevHandler *dev_handlers[] = {
 	&dev_handler_firewire,
 	&dev_handler_power_supply,
 	&dev_handler_drm,
+	&dev_handler_ps3_system_bus,
 	NULL
 };
 


More information about the hal-commit mailing list