hal/hald hald_dbus.c,1.31,1.32
David Zeuthen
david at freedesktop.org
Wed Mar 2 11:19:15 PST 2005
Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv21926/hald
Modified Files:
hald_dbus.c
Log Message:
2005-03-02 David Zeuthen <davidz at redhat.com>
* tools/device-manager/DeviceManager.py: Move some things around
only to discover that D-BUS python bindings need fixing to actually
push signals we subscribe to without giving the path...
* tools/lshal.c (device_condition): Fix this function so it works
after the DeviceCondition format changes earlier
* libhal/libhal.h: Export prototype for libhal_device_emit_condition
* libhal/libhal.c (libhal_device_emit_condition): New function
* hald/linux2/addons/addon-storage.c (main): Fix that we should
be verbose
* hald/linux2/addons/addon-acpi.c (read_line): Rewrite this
to not malloc all over the place
(main): Try two places for ACPI events. Rework parsing of events
and send out DeviceConditions where appropriate
* hald/hald_dbus.c (device_emit_condition): New function
(hald_dbus_filter_function): Handle EmitCondition
2005-03-01 Richard Hughes <richard at hughsie.com>
* hald/linux2/addons/addon-acpi.c (main): Call
libhal_device_rescan for each ACPI event.
Index: hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- hald_dbus.c 1 Mar 2005 20:38:42 -0000 1.31
+++ hald_dbus.c 2 Mar 2005 19:19:12 -0000 1.32
@@ -2160,6 +2160,66 @@
}
+static DBusHandlerResult
+device_emit_condition (DBusConnection * connection, DBusMessage * message)
+{
+ const char *udi;
+ HalDevice *device;
+ DBusMessageIter iter;
+ DBusMessage *reply;
+ DBusError error;
+ const char *condition_name;
+ const char *condition_details;
+ dbus_bool_t res;
+
+ HAL_TRACE (("entering"));
+
+ udi = dbus_message_get_path (message);
+
+ if (!sender_has_privileges (connection, message)) {
+ raise_permission_denied (connection, message, "Reprobe: not privileged");
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ HAL_DEBUG (("udi=%s", udi));
+
+ dbus_error_init (&error);
+ if (!dbus_message_get_args (message, &error,
+ DBUS_TYPE_STRING, &condition_name,
+ DBUS_TYPE_STRING, &condition_details,
+ DBUS_TYPE_INVALID)) {
+ raise_syntax (connection, message, "EmitCondition");
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+
+ device = hal_device_store_find (hald_get_gdl (), udi);
+ if (device == NULL)
+ device = hal_device_store_find (hald_get_tdl (), udi);
+
+ if (device == NULL) {
+ raise_no_such_device (connection, message, udi);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ device_send_signal_condition (device, condition_name, condition_details);
+
+ res = TRUE;
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ DIE (("No memory"));
+ dbus_message_iter_init_append (reply, &iter);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &res);
+
+ if (!dbus_connection_send (connection, reply, NULL))
+ DIE (("No memory"));
+
+ dbus_message_unref (reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+
/** Message handler for method invocations. All invocations on any object
* or interface is routed through this function.
*
@@ -2313,6 +2373,10 @@
"org.freedesktop.Hal.Device",
"Reprobe")) {
return device_reprobe (connection, message);
+ } else if (dbus_message_is_method_call (message,
+ "org.freedesktop.Hal.Device",
+ "EmitCondition")) {
+ return device_emit_condition (connection, message);
} else
osspec_filter_function (connection, message, user_data);
More information about the hal-commit
mailing list