hal/tools/linux hal_hotplug_map.c,1.3,1.4
David Zeuthen
david at freedesktop.org
Mon Jan 31 12:06:46 PST 2005
- Previous message: hal/libhal Makefile.am, 1.2, 1.3 libhal.c, 1.33, 1.34 libhal.h, 1.18,
1.19
- Next message: hal/tools fstab-sync.c, 1.28, 1.29 hal_get_property.c, 1.7,
1.8 hal_set_property.c, 1.7, 1.8 lshal.c, 1.9, 1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/tools/linux
In directory gabe:/tmp/cvs-serv1622/tools/linux
Modified Files:
hal_hotplug_map.c
Log Message:
2005-01-31 David Zeuthen <davidz at redhat.com>
* configure.in: Prebump to 0.5.0 - but we're not doing a release yet!
Add libtool versioning since libhal and libhal-storage are going
to break API and ABI backwards compatibility.
* hald/hald_test.c: Add the beginnings of a test suite
* hald/hald_test_libhal.c: -do-
* hald/Makefile.am: Add build rules for test suite
* tools/linux/hal_hotplug_map.c: Update to use new libhal API.
* tools/lshal.c: Update to use new libhal API.
* tools/hal_set_property.c: Update to use new libhal API.
* tools/hal_get_property.c: Update to use new libhal API.
* tools/fstab-sync.c: Update to use new libhal API.
* libhal-storage/libhal-storage.c: Update to use new libhal API.
This library will also go through a renaming/cleanup before 0.5.0.
* libhal-storage/Makefile.am: Use library versioning
* libhal/libhal.[ch]: Prefix all function names and other identifiers
with libhal instead of hal. Add code for string lists. Change the
way libhal is initialized to be a multistep process. Use HAL_PROPERTY_
TYPE_* instead of DBUS_TYPE_*. Make all functions using IPC take
a DBusError argument for better error handling. Notable changes
(libhal_device_get_all_properties): Teach this function about
string lists
(libhal_psi_get_strlist): New function
(hal_initialize): Removed
(hal_shutdown): Removed
(libhal_device_get_property_strlist): New function
(libhal_device_property_strlist_append): New function
(libhal_device_property_strlist_prepend): New function
(libhal_device_property_strlist_remove_index): New function
(libhal_device_property_strlist_remove): New function
(libhal_ctx_new): New function
(libhal_ctx_set_cache): New function
(libhal_ctx_set_dbus_connection): New function
(libhal_ctx_init): New function
(libhal_ctx_shutdown): New function
(libhal_ctx_free): New function
(libhal_ctx_set_device_added): New function
(libhal_ctx_set_device_removed): New function
(libhal_ctx_set_device_new_capability): New function
(libhal_ctx_set_device_lost_capability): New function
(libhal_ctx_set_device_property_modified): New function
(libhal_ctx_set_device_condition): New function
* libhal/Makefile.am: Use library versioning
* hald/linux2/probing/probe-input.c: Port to new libhal API
* hald/property.h: Rename property types to HAL_PROPERTY_TYPE_*.
Add prototypes for new string list properties.
* hald/property.c: Rename property types to HAL_PROPERTY_TYPE_*.
(hal_property_free): Teach this function about string lists.
(hal_property_new_strlist): New function
(hal_property_get_strlist): New function
(hal_property_strlist_append): New function
(hal_property_strlist_prepend): New function
(hal_property_strlist_remove_elem): New function
(hal_property_strlist_add): New function
(hal_property_strlist_remove): New function
* hald/hald_dbus.c: Rename property types to HAL_PROPERTY_TYPE_*.
Add new ugly code to handle string lists with the current D-BUS.
(device_string_list_append_prepend): New function
(hald_dbus_filter_function): Rename from filter_function. Add
handlers for new D-BUS methods. Export this function
* hald/hald.[ch]: Rip out persistent property code.
* hald/device_info.c: Rename property types to HAL_PROPERTY_TYPE_*.
* hald/device.c: Rename to property to HAL_PROPERTY_TYPE_*. Rip out
persistent property code.
(hal_device_property_get_as_string): Add code for strlist type
(hal_device_property_get_strlist): New function
(hal_device_property_strlist_append): New function
(hal_device_property_strlist_prepend): New function
(hal_device_property_strlist_remove_elem): New function
(hal_device_property_strlist_add): New function
(hal_device_property_strlist_remove): New function
* hald/device.h: Add new strlist prototypes
* pstore.[ch]: Remove for now as persistent properties needs to be
reworked
Index: hal_hotplug_map.c
===================================================================
RCS file: /cvs/hal/hal/tools/linux/hal_hotplug_map.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- hal_hotplug_map.c 27 Sep 2004 14:52:11 -0000 1.3
+++ hal_hotplug_map.c 31 Jan 2005 20:06:43 -0000 1.4
@@ -26,28 +26,48 @@
{
char *udi;
LibHalContext *hal_context = NULL;
+ DBusConnection *conn;
+ DBusError error;
udi = getenv ("UDI");
if (udi == NULL)
return FALSE;
- hal_context = hal_initialize (NULL, 0);
- if (hal_context == NULL)
- return FALSE;
+ dbus_error_init (&error);
+ conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (conn == NULL) {
+ fprintf (stderr, "error: dbus_bus_get: %s: %s\n", error.name, error.message);
+ goto out;
+ }
+ if ((hal_context = libhal_ctx_new ()) == NULL) {
+ fprintf (stderr, "error: libhal_ctx_new\n");
+ goto out;
+ }
+ if (!libhal_ctx_set_dbus_connection (hal_context, conn)) {
+ fprintf (stderr, "error: libhal_ctx_set_dbus_connection: %s: %s\n", error.name, error.message);
+ goto out;
+ }
+ if (!libhal_ctx_init (hal_context, &error)) {
+ fprintf (stderr, "error: libhal_ctx_init: %s: %s\n", error.name, error.message);
+ goto out;
+ }
+
if (strcmp (module, "usbcam") == 0 || strcmp(module, "libgphoto2") == 0) {
- hal_device_add_capability (hal_context, udi, "camera");
- hal_device_set_property_string (hal_context, udi, "info.category", "camera");
- hal_device_set_property_string (hal_context, udi, "camera.access_method", "user");
- hal_device_set_property_bool (hal_context, udi, "camera.libgphoto2_support", TRUE);
+ libhal_device_add_capability (hal_context, udi, "camera", &error);
+ libhal_device_set_property_string (hal_context, udi, "info.category", "camera", &error);
+ libhal_device_set_property_string (hal_context, udi, "camera.access_method", "user", &error);
+ libhal_device_set_property_bool (hal_context, udi, "camera.libgphoto2_support", TRUE, &error);
} else if (strcmp (module, "libusbscanner") == 0) {
- hal_device_add_capability (hal_context, udi, "scanner");
- hal_device_set_property_string (hal_context, udi, "info.category", "scanner");
- hal_device_set_property_string (hal_context, udi, "scanner.access_method", "user");
- hal_device_set_property_bool (hal_context, udi, "scanner.libsane_support", TRUE);
+ libhal_device_add_capability (hal_context, udi, "scanner", &error);
+ libhal_device_set_property_string (hal_context, udi, "info.category", "scanner", &error);
+ libhal_device_set_property_string (hal_context, udi, "scanner.access_method", "user", &error);
+ libhal_device_set_property_bool (hal_context, udi, "scanner.libsane_support", TRUE, &error);
}
- hal_shutdown (hal_context);
+ libhal_ctx_shutdown (hal_context, &error);
+ libhal_ctx_free (hal_context);
+out:
return TRUE;
}
- Previous message: hal/libhal Makefile.am, 1.2, 1.3 libhal.c, 1.33, 1.34 libhal.h, 1.18,
1.19
- Next message: hal/tools fstab-sync.c, 1.28, 1.29 hal_get_property.c, 1.7,
1.8 hal_set_property.c, 1.7, 1.8 lshal.c, 1.9, 1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list