summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <ervin@kde.org>2006-08-21 23:09:28 +0100
committerRichard Hughes <richard@hughsie.com>2006-08-21 23:09:28 +0100
commit1fe97744e639895b4342a1e7c9a22ac8a9920f43 (patch)
tree35f78f7a1587f4d806624e47963d8a3838eaf77f
parent0e0c9da6f5957eceff3b372c554697d7abbf4804 (diff)
correct the introspection to list all objects
Find attached a patch for hald_dbus.c that allows to list all the objects available in the HAL daemon (the manager object and all the devices). That completes the HAL introspection.
-rw-r--r--hald/hald_dbus.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 2526554e..3e270af7 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -3123,6 +3123,22 @@ error:
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
+static gboolean
+foreach_device_get_xml_node (HalDeviceStore *store, HalDevice *device,
+ gpointer user_data)
+{
+ GString *xml = user_data;
+ const char *udi, *name;
+
+ udi = hal_device_get_udi (device);
+ name = strrchr(udi, '/')+1;
+
+ xml = g_string_append(xml, " <node name=\"");
+ xml = g_string_append(xml, name);
+ xml = g_string_append(xml, "\"/>\n");
+
+ return TRUE;
+}
static DBusHandlerResult
do_introspect (DBusConnection *connection,
@@ -3147,7 +3163,34 @@ do_introspect (DBusConnection *connection,
" </method>\n"
" </interface>\n");
- if (strcmp (path, "/org/freedesktop/Hal/Manager") == 0) {
+ if (strcmp (path, "/") == 0) {
+
+ xml = g_string_append (xml,
+ " <node name=\"org\"/>\n");
+
+ } else if (strcmp (path, "/org") == 0) {
+
+ xml = g_string_append (xml,
+ " <node name=\"freedesktop\"/>\n");
+
+ } else if (strcmp (path, "/org/freedesktop") == 0) {
+
+ xml = g_string_append (xml,
+ " <node name=\"Hal\"/>\n");
+
+ } else if (strcmp (path, "/org/freedesktop/Hal") == 0) {
+
+ xml = g_string_append (xml,
+ " <node name=\"Manager\"/>\n"
+ " <node name=\"devices\"/>\n");
+
+ } else if (strcmp (path, "/org/freedesktop/Hal/devices") == 0) {
+
+ hal_device_store_foreach (hald_get_gdl (),
+ foreach_device_get_xml_node,
+ xml);
+
+ } else if (strcmp (path, "/org/freedesktop/Hal/Manager") == 0) {
xml = g_string_append (xml,
" <interface name=\"org.freedesktop.Hal.Manager\">\n"