hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Fri Apr 18 11:52:00 PDT 2008
doc/spec/hal-spec-properties.xml | 34 ++++++++++++++++++++++++
hald/linux/device.c | 54 +++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+)
New commits:
commit 11a1ebf96dd5233656a10a7443ec2c0d28d9b656
Author: David Woodhouse <dwmw2 at infradead.org>
Date: Fri Apr 18 20:51:52 2008 +0200
add support for of_platform subsystem
Added support for of_platform subsystem. The of_platform bus is present
on some PPC boards, it is the bus exposed by the kernel for a bunch of
the SoC devices. Without the patch, half the devices aren't found by HAL.
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 8153206..5ed5817 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -7482,6 +7482,40 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
No namespace specific properties.
</para>
</sect2>
+
+ <sect2 id="device-properties-of_platform">
+ <title>
+ of_platform namespace
+ </title>
+ <para>
+ Devices on the virtual 'of_platform' bus are represented
+ by device objects where <literal>info.subsystem</literal>
+ equals <literal>of_platform</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>of_platform.id</literal> (string)
+ </entry>
+ <entry>example: f0003000.ethernet</entry>
+ <entry>Yes</entry>
+ <entry>Device identification</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect2>
</sect1>
<sect1 id="properties-misc">
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 770f522..6c96d58 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3782,6 +3782,51 @@ vmbus_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);
+ hal_device_property_set_string (d, "info.subsystem", "of_platform");
+ 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];
+
+ hal_util_compute_udi (hald_get_gdl (), 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);
+ 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;
@@ -4165,6 +4210,14 @@ 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",
@@ -4214,6 +4267,7 @@ static DevHandler *dev_handlers[] = {
&dev_handler_virtio,
&dev_handler_vio,
&dev_handler_vmbus,
+ &dev_handler_of_platform,
NULL
};
More information about the hal-commit
mailing list