hal/libhal libhal.c,1.43,1.44 libhal.h,1.24,1.25
David Zeuthen
david at freedesktop.org
Wed Mar 2 11:19:15 PST 2005
Update of /cvs/hal/hal/libhal
In directory gabe:/tmp/cvs-serv21926/libhal
Modified Files:
libhal.c libhal.h
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: libhal.c
===================================================================
RCS file: /cvs/hal/hal/libhal/libhal.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- libhal.c 26 Feb 2005 22:31:42 -0000 1.43
+++ libhal.c 2 Mar 2005 19:19:13 -0000 1.44
@@ -684,16 +684,17 @@
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal (message, "org.freedesktop.Hal.Device", "Condition")) {
- char *udi;
char *condition_name;
char *condition_detail;
+ printf ("foo0\n");
if (dbus_message_get_args (message, &error,
- DBUS_TYPE_STRING, &udi,
DBUS_TYPE_STRING, &condition_name,
DBUS_TYPE_STRING, &condition_detail,
DBUS_TYPE_INVALID)) {
+ printf ("foo1\n");
if (ctx->device_new_capability != NULL) {
- ctx->device_condition (ctx, udi, condition_name, condition_detail);
+ printf ("foo2\n");
+ ctx->device_condition (ctx, object_path, condition_name, condition_detail);
}
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -2965,4 +2966,60 @@
return result;
}
+dbus_bool_t libhal_device_emit_condition (LibHalContext *ctx,
+ const char *udi,
+ const char *condition_name,
+ const char *condition_details,
+ DBusError *error)
+{
+ DBusMessage *message;
+ DBusMessageIter iter;
+ DBusMessageIter reply_iter;
+ DBusMessage *reply;
+ dbus_bool_t result;
+
+ message = dbus_message_new_method_call ("org.freedesktop.Hal",
+ udi,
+ "org.freedesktop.Hal.Device",
+ "EmitCondition");
+
+ if (message == NULL) {
+ fprintf (stderr,
+ "%s %d : Couldn't allocate D-BUS message\n",
+ __FILE__, __LINE__);
+ return FALSE;
+ }
+
+ dbus_message_iter_init_append (message, &iter);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &condition_name);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &condition_details);
+
+ reply = dbus_connection_send_with_reply_and_block (ctx->connection,
+ message, -1,
+ error);
+
+ if (dbus_error_is_set (error)) {
+ dbus_message_unref (message);
+ return FALSE;
+ }
+
+ dbus_message_unref (message);
+
+ if (reply == NULL)
+ return FALSE;
+
+ dbus_message_iter_init (reply, &reply_iter);
+ if (dbus_message_iter_get_arg_type (&reply_iter) !=
+ DBUS_TYPE_BOOLEAN) {
+ dbus_message_unref (message);
+ dbus_message_unref (reply);
+ return FALSE;
+ }
+ dbus_message_iter_get_basic (&reply_iter, &result);
+
+ dbus_message_unref (reply);
+
+ return result;
+}
+
/** @} */
Index: libhal.h
===================================================================
RCS file: /cvs/hal/hal/libhal/libhal.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- libhal.h 26 Feb 2005 22:31:42 -0000 1.24
+++ libhal.h 2 Mar 2005 19:19:13 -0000 1.25
@@ -386,6 +386,12 @@
const char *udi,
DBusError *error);
+dbus_bool_t libhal_device_emit_condition (LibHalContext *ctx,
+ const char *udi,
+ const char *condition_name,
+ const char *condition_details,
+ DBusError *error);
+
/** @} */
#if defined(__cplusplus)
More information about the hal-commit
mailing list