hal: Branch 'hal-0_5_11-branch' - 2 commits
Danny Kukawka
dkukawka at kemper.freedesktop.org
Wed May 7 05:39:56 PDT 2008
doc/spec/hal-spec-properties.xml | 100 +++++++++++++++++++++++++++++++++++++++
hald/linux/device.c | 33 +++---------
2 files changed, 109 insertions(+), 24 deletions(-)
New commits:
commit 00896a7e75826fce586675750146b7242b04eb92
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Mon May 5 19:52:14 2008 +0200
add documentation for the linux namespace to the spec
Added documentation for the linux namespace to the spec.
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 537fa7e..ee6fdfc 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -174,6 +174,106 @@
</informaltable>
</sect2>
+
+ <sect2 id="device-properties-info-linux">
+ <title>
+ linux namespace
+ </title>
+ <para>
+ The <literal>linux</literal> namespace contain properties that
+ can be considered metadata about device objects in Linux systems. These
+ properties are available only on Linux systems.
+ </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>linux.subsystem</literal> (string)
+ </entry>
+ <entry>pci, usb, ide_host, ide, block, usb, usbif, scsi_host, scsi</entry>
+ <entry>Yes</entry>
+ <entry>Describes what Linux subsystem the device is connected to. This can
+ differ from <literal>info.subsystem</literal></entry>
+ </row>
+ <row>
+ <entry>
+ <literal>linux.sysfs_path</literal> (string)
+ </entry>
+ <entry>for example: /sys/class/sound/seq</entry>
+ <entry>No</entry>
+ <entry>Path to the devuce in the sysfs. Could also be <literal>*.linux.sysfs_path</literal>
+ depending on the subsystem in some cases.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <literal>linux.device_file</literal> (string)
+ </entry>
+ <entry>for example: /dev/snd/pcmC0D1c or /dev/input/event6</entry>
+ <entry>No</entry>
+ <entry>Path to the corresponding device file in /dev/ on linux system.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <literal>info.linux.driver</literal> (string)
+ </entry>
+ <entry>for example: pcspkr, vesafb, serial8250</entry>
+ <entry>No</entry>
+ <entry>Name of the driver/module corresponding to the device and/or subsystem.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <literal>linux.hotplug_type</literal> (int)
+ </entry>
+ <entry></entry>
+ <entry>Yes</entry>
+ <entry>The type of hotplug event in a linux system.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <literal>linux.acpi_type</literal> (int)
+ </entry>
+ <entry></entry>
+ <entry>No (except for ACPI devices)</entry>
+ <entry>The type of ACPI device. Normaly only for HAL internal use.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <literal>linux.apm_type</literal> (int)
+ </entry>
+ <entry></entry>
+ <entry>No (except for APM devices)</entry>
+ <entry>The type of APM device. Normaly only for HAL internal use.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <literal>linux.pmu_type</literal> (int)
+ </entry>
+ <entry></entry>
+ <entry>No (except for PMU devices)</entry>
+ <entry>The type of PMU device. Normaly only for HAL internal use.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ </sect2>
+
<sect2 id="device-properties-info-callouts">
<title>Callouts</title>
commit c1be36d0a31cf2724e878820d50dfdf26fe2fc35
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Mon May 5 19:57:37 2008 +0200
fixed usage of info.subsystem and linux.subsystem
Fixed the Linux code to correct usage of the info.subsystem
property. This property is mandatory for all devices, so set
it always if it wasn't set in the .add handler. Set also
always linux.subsystem since it can differ from info.subsystem
and this key always point to the correct linux kernel
subsystem. It's also needed to use/get the correct handlers.
This should also fix fd.o #15679
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 94fb221..e48548e 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -557,7 +557,7 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path);
/* wireless dscape stack e.g. from rt2500pci driver*/
snprintf (wiphy_path, HAL_PATH_MAX, "%s/wiphy", sysfs_path);
- parent_subsys = hal_device_property_get_string (parent_dev, "linux.subsystem");
+ parent_subsys = hal_device_property_get_string (parent_dev, "info.subsystem");
if (parent_subsys && strcmp(parent_subsys, "bluetooth") == 0) {
hal_device_property_set_string (d, "info.product", "Bluetooth Interface");
@@ -1541,7 +1541,6 @@ pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "pci");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -1850,7 +1849,6 @@ ide_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "ide");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -1920,7 +1918,6 @@ pnp_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "pnp");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -1992,7 +1989,6 @@ platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *pare
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "platform");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -2092,7 +2088,6 @@ serio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "serio");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -2138,7 +2133,6 @@ pcmcia_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "pcmcia");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -2221,7 +2215,6 @@ scsi_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_d
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "scsi");
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);
@@ -2310,7 +2303,6 @@ mmc_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "mmc");
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
hal_util_set_driver (d, "info.linux.driver", sysfs_path);
@@ -2401,7 +2393,6 @@ sdio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_d
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "sdio");
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
hal_util_set_driver (d, "info.linux.driver", sysfs_path);
@@ -2451,7 +2442,6 @@ xen_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "xen");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -2531,7 +2521,6 @@ ieee1394_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *pare
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_util_set_driver (d, "info.linux.driver", sysfs_path);
@@ -2812,7 +2801,6 @@ ccw_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "ccw");
if (parent_dev != NULL)
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
else
@@ -2981,7 +2969,6 @@ ccwgroup_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *pare
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "ccwgroup");
if (parent_dev != NULL)
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
else
@@ -3045,7 +3032,6 @@ iucv_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_d
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "iucv");
if (parent_dev != NULL)
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
else
@@ -3396,7 +3382,7 @@ power_supply_battery_poll (gpointer data) {
const char *subsys;
d = HAL_DEVICE (i->data);
- subsys = hal_device_property_get_string (d, "linux.subsystem");
+ 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 ();
@@ -3524,7 +3510,6 @@ drm_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
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.subsystem", "drm");
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 */
@@ -3569,7 +3554,6 @@ ps3_system_bus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice
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");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -3613,7 +3597,6 @@ virtio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "virtio");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -3658,7 +3641,6 @@ vio_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "vio");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -3721,7 +3703,6 @@ vmbus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "vmbus");
hal_device_property_set_string (d, "info.vendor", "Microsoft/Citrix");
hal_util_set_driver (d, "info.linux.driver", sysfs_path);
@@ -3785,7 +3766,6 @@ of_platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *p
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 {
@@ -3829,7 +3809,6 @@ pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
- hal_device_property_set_string (d, "info.subsystem", "pseudo");
if (parent_dev != NULL) {
hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
} else {
@@ -4458,6 +4437,11 @@ hotplug_event_begin_add_dev (const gchar *subsystem, const gchar *sysfs_path, co
hal_device_property_set_int (d, "linux.hotplug_type", HOTPLUG_EVENT_SYSFS_DEVICE);
hal_device_property_set_string (d, "linux.subsystem", subsystem);
+
+ /* only set info.subsystem if it's not set already to prevent trouble with usb/usb_device and other */
+ if (!hal_device_has_property(d, "info.subsystem")) {
+ hal_device_property_set_string (d, "info.subsystem", subsystem);
+ }
if (device_file != NULL && strlen (device_file) > 0)
hal_device_property_set_string (d, "linux.device_file", device_file);
@@ -4599,7 +4583,7 @@ dev_generate_add_hotplug_event (HalDevice *d)
const char *device_file;
HotplugEvent *hotplug_event;
- subsystem = hal_device_property_get_string (d, "linux.subsystem");
+ subsystem = hal_device_property_get_string (d, "info.subsystem");
sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
device_file = hal_device_property_get_string (d, "linux.device_file");
@@ -4624,6 +4608,7 @@ dev_generate_remove_hotplug_event (HalDevice *d)
const char *sysfs_path;
HotplugEvent *hotplug_event;
+ /* be sure that we use linux.subsystem here because info.subsystem can differ see e.g. usb/usb_device */
subsystem = hal_device_property_get_string (d, "linux.subsystem");
sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
More information about the hal-commit
mailing list