Lines Matching +full:hal +full:. +full:o

4  * dbus.c : D-BUS interface of HAL daemon
6 * Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
13 * (at your option) any later version.
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 # include <config.h>
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <string.h>
33 #include <unistd.h>
34 #include <stdarg.h>
35 #include <stdint.h>
36 #include <sys/time.h>
38 #include <dbus/dbus.h>
39 #include <dbus/dbus-glib-lowlevel.h>
41 #include "hald.h"
42 #include "hald_dbus.h"
43 #include "device.h"
44 #include "device_store.h"
45 #include "device_info.h"
46 #include "logger.h"
47 #include "osspec.h"
48 #include "util.h"
49 #include "hald_runner.h"
59 char *format, ...) __attribute__((format (printf, 4, 5)));
64 * @brief Various error messages the HAL daemon can raise
68 /** Raise HAL error
79 char *format, ...) in raise_error() argument
98 /** Raise the org.freedesktop.Hal.NoSuchDevice error
110 "org.freedesktop.Hal.NoSuchDevice", in raise_no_such_device()
116 /** Raise the org.freedesktop.Hal.NoSuchProperty error
130 "org.freedesktop.Hal.NoSuchProperty", in raise_no_such_property()
136 /** Raise the org.freedesktop.Hal.TypeMismatch error
150 "org.freedesktop.Hal.TypeMismatch", in raise_property_type_error()
156 /** Raise the org.freedesktop.Hal.SyntaxError error
169 "org.freedesktop.Hal.SyntaxError", in raise_syntax()
175 /** Raise the org.freedesktop.Hal.DeviceNotLocked error
188 "org.freedesktop.Hal.DeviceNotLocked", in raise_device_not_locked()
194 /** Raise the org.freedesktop.Hal.DeviceAlreadyLocked error
208 reason = hal_device_property_get_string (device, "info.locked.reason"); in raise_device_already_locked()
214 "org.freedesktop.Hal.DeviceAlreadyLocked", in raise_device_already_locked()
223 /** Raise the org.freedesktop.Hal.BranchAlreadyClaimed error
237 claim_service = hal_device_property_get_string (device, "info.claimed.service"); in raise_branch_already_claimed()
243 "org.freedesktop.Hal.BranchAlreadyClaimed", in raise_branch_already_claimed()
252 /** Raise the org.freedesktop.Hal.BranchNotClaimed error
265 "org.freedesktop.Hal.BranchNotClaimed", in raise_branch_not_claimed()
271 /** Raise the org.freedesktop.Hal.PermissionDenied error
284 "org.freedesktop.Hal.PermissionDenied", in raise_permission_denied()
293 * @defgroup ManagerInterface D-BUS interface org.freedesktop.Hal.Manager
313 /** Get all devices.
316 * array{object_reference} Manager.GetAllDevices()
393 if (strncmp (device->udi, "/org/freedesktop/Hal/devices/temp", in foreach_device_match_get_udi_tdl()
394 sizeof ("/org/freedesktop/Hal/devices/temp")) == 0) in foreach_device_match_get_udi_tdl()
416 * value. Also returns devices in the TDL that has a non-tmp UDI.
419 * array{object_reference} Manager.FindDeviceStringMatch(string key,
447 "Manager.FindDeviceStringMatch"); in manager_find_device_string_match()
461 info.key = key; in manager_find_device_string_match()
462 info.value = value; in manager_find_device_string_match()
463 info.iter = &iter_array; in manager_find_device_string_match()
503 /** Find devices in the GDL with a given capability.
506 * array{object_reference} Manager.FindDeviceByCapability(string capability)
531 "Manager.FindDeviceByCapability"); in manager_find_device_by_capability()
545 info.capability = capability; in manager_find_device_by_capability()
546 info.iter = &iter_array; in manager_find_device_by_capability()
563 /** Determine if a device exists.
566 * bool Manager.DeviceExists(string udi)
587 raise_syntax (connection, message, "Manager.DeviceExists"); in manager_device_exists()
613 /** Send signal DeviceAdded(string udi) on the org.freedesktop.Hal.Manager
614 * interface on the object /org/freedesktop/Hal/Manager.
630 message = dbus_message_new_signal ("/org/freedesktop/Hal/Manager", in manager_send_signal_device_added()
631 "org.freedesktop.Hal.Manager", in manager_send_signal_device_added()
646 /** Send signal DeviceRemoved(string udi) on the org.freedesktop.Hal.Manager
647 * interface on the object /org/freedesktop/Hal/Manager.
663 message = dbus_message_new_signal ("/org/freedesktop/Hal/Manager", in manager_send_signal_device_removed()
664 "org.freedesktop.Hal.Manager", in manager_send_signal_device_removed()
679 * org.freedesktop.Hal.Manager interface on the object
680 * /org/freedesktop/Hal/Manager.
698 message = dbus_message_new_signal ("/org/freedesktop/Hal/Manager", in manager_send_signal_new_capability()
699 "org.freedesktop.Hal.Manager", in manager_send_signal_new_capability()
717 * @defgroup DeviceInterface D-BUS interface org.freedesktop.Hal.Device
892 /** Get all properties on a device.
895 * map{string, any} Device.GetAllProperties()
897 * raises org.freedesktop.Hal.NoSuchDevice
956 #include <sys/stat.h>
962 return ((stat("/dev/vt/console_user", &st) == 0) && (st.st_uid == uid)); in user_at_console()
987 HAL_WARNING (("Could not get uid for connection: %s %s", error.name, error.message)); in sender_has_privileges()
997 "org.freedesktop.Hal.Device", in sender_has_privileges()
1016 /** Set multiple properties on a device in an atomic fashion.
1019 * Device.GetAllProperties(map{string, any} properties)
1021 * raises org.freedesktop.Hal.NoSuchDevice
1168 /** Get a property on a device.
1171 * any Device.GetProperty(string key)
1172 * string Device.GetPropertyString(string key)
1173 * int Device.GetPropertyInteger(string key)
1174 * bool Device.GetPropertyBoolean(string key)
1175 * double Device.GetPropertyDouble(string key)
1177 * raises org.freedesktop.Hal.NoSuchDevice,
1178 * org.freedesktop.Hal.NoSuchProperty
1299 /** Get the type of a property on a device.
1302 * int Device.GetPropertyType(string key)
1304 * raises org.freedesktop.Hal.NoSuchDevice,
1305 * org.freedesktop.Hal.NoSuchProperty
1368 /** Set a property on a device.
1371 * void Device.SetProperty(string key, any value)
1372 * void Device.SetPropertyString(string key, string value)
1373 * void Device.SetPropertyInteger(string key, int value)
1374 * void Device.SetPropertyBoolean(string key, bool value)
1375 * void Device.SetPropertyDouble(string key, double value)
1377 * raises org.freedesktop.Hal.NoSuchDevice,
1378 * org.freedesktop.Hal.NoSuchProperty
1379 * org.freedesktop.Hal.TypeMismatch
1488 /** This function is used to modify the Capabilities property. The reason
1489 * for having a dedicated function is that the HAL daemon will broadcast
1491 * have got a new capability.
1493 * This is useful as capabilities can be merged after the device is created.
1494 * One example of this is networking cards under Linux 2.6; the net.ethernet
1496 * /sys/devices; it is merged when the /sys/classes tree is searched.
1499 * though the capability already existed. This is useful in the above
1501 * don't have enough information to fill in the net.* and net.ethernet.*
1502 * fields since this only happens when we visit the /sys/classes tree.
1505 * void Device.AddCapability(string capability)
1507 * raises org.freedesktop.Hal.NoSuchDevice,
1508 * raises org.freedesktop.Hal.PermissionDenied,
1672 /** Remove a property on a device.
1675 * void Device.RemoveProperty(string key)
1677 * raises org.freedesktop.Hal.NoSuchDevice,
1678 * org.freedesktop.Hal.NoSuchProperty
1679 * org.freedesktop.Hal.PermissionDenied
1742 * bool Device.PropertyExists(string key)
1744 * raises org.freedesktop.Hal.NoSuchDevice,
1802 * bool Device.QueryCapability(string capability_name)
1804 * raises org.freedesktop.Hal.NoSuchDevice,
1850 caps = hal_device_property_get_strlist (d, "info.capabilities"); in device_query_capability()
1874 /** Grab an advisory lock on a device.
1877 * bool Device.Lock(string reason)
1879 * raises org.freedesktop.Hal.NoSuchDevice,
1880 * org.freedesktop.Hal.DeviceAlreadyLocked
1912 already_locked = hal_device_property_get_bool (d, "info.locked"); in device_lock()
1933 hal_device_property_set_bool (d, "info.locked", TRUE); in device_lock()
1934 hal_device_property_set_string (d, "info.locked.reason", reason); in device_lock()
1935 hal_device_property_set_string (d, "info.locked.dbus_name", in device_lock()
1956 /** Release an advisory lock on a device.
1959 * bool Device.Unlock()
1961 * raises org.freedesktop.Hal.NoSuchDevice,
1962 * org.freedesktop.Hal.DeviceNotLocked,
1963 * org.freedesktop.Hal.PermissionDenied
2005 rc = hal_device_property_get_bool (d, "info.locked"); in device_unlock()
2015 d, "info.locked.dbus_name")) != 0) { in device_unlock()
2036 hal_device_property_remove (d, "info.locked"); in device_unlock()
2037 hal_device_property_remove (d, "info.locked.reason"); in device_unlock()
2038 hal_device_property_remove (d, "info.locked.dbus_name"); in device_unlock()
2050 /** Claim a branch.
2053 * bool Manager.ClaimBranch(string udi, string claim_service)
2078 raise_syntax (connection, message, "Manager.ClaimBranch"); in manager_claim_branch()
2091 already_claimed = hal_device_property_get_bool (d, "info.claimed"); in manager_claim_branch()
2106 HAL_WARNING (("Could not get uid for connection: %s %s", error.name, error.message)); in manager_claim_branch()
2114 hal_device_property_set_string (d, "info.claimed.dbus_name", sender); in manager_claim_branch()
2134 /** Unclaim a branch.
2137 * bool Manager.UnclaimBranch(string udi)
2160 raise_syntax (connection, message, "Manager.UnclaimBranch"); in manager_unclaim_branch()
2173 already_claimed = hal_device_property_get_bool (d, "info.claimed"); in manager_unclaim_branch()
2184 d, "info.claimed.dbus_name")) != 0) { in manager_unclaim_branch()
2206 hal_device_property_remove (d, "info.claimed.dbus_name"); in manager_unclaim_branch()
2234 * in one go.
2244 /** End an atomic update.
2286 "org.freedesktop.Hal.Device", in device_property_atomic_update_end()
2392 "org.freedesktop.Hal.Device", in device_send_signal_property_modified()
2430 * this function to have effect.
2433 * ProcesserOverheating, BlockDeviceGotDevice, e.g. conditions that
2435 * (though some may).
2438 * in the D-BUS message. The recipient is supposed to extract the parameters
2439 * himself, by looking at the HAL specification.
2444 * @param ... value of first argument, list of additional
2445 * type-value pairs. Must be terminated with
2459 "org.freedesktop.Hal.Device", in device_send_signal_condition()
2508 hal_device_property_remove (d, "info.locked"); in service_deleted()
2509 hal_device_property_remove (d, "info.locked.reason"); in service_deleted()
2510 hal_device_property_remove (d, "info.locked.dbus_name"); in service_deleted()
2521 hal_device_property_remove (d, "info.claimed.dbus_name"); in service_deleted()
2734 hal_device_property_strlist_add (device, "info.interfaces", interface_name); in device_claim_interface()
2821 * Create new device in tdl. Return temporary udi.
2850 …udi = g_strdup_printf ("/org/freedesktop/Hal/devices/tmp%05x", ((unsigned) tv.tv_usec & 0xfffff)) … in manager_new_device()
2857 …raise_error (connection, message, "org.freedesktop.Hal.NoSpace", "NewDevice: no space for device"); in manager_new_device()
2862 hal_device_property_set_string (d, "info.udi", udi); in manager_new_device()
2877 * Callout helper.
2891 * Remove device. Looks in gdl and tdl.
2934 * run "info.callouts.remove" ? in manager_remove()
2936 * (auto) stop "info.addons" ? in manager_remove()
2956 * Callout helper.
2965 * Preprobing helper.
2970 if (hal_device_property_get_bool (d, "info.ignore")) { in manager_commit_preprobing_done()
2971 /* Leave the device here with info.ignore==TRUE so we won't pick up children in manager_commit_preprobing_done()
2974 hal_device_property_remove (d, "info.category"); in manager_commit_preprobing_done()
2975 hal_device_property_remove (d, "info.capabilities"); in manager_commit_preprobing_done()
2976 hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device"); in manager_commit_preprobing_done()
2977 hal_device_property_set_string (d, "info.product", "Ignored Device"); in manager_commit_preprobing_done()
2979 HAL_INFO (("Preprobing merged info.ignore==TRUE")); in manager_commit_preprobing_done()
2984 /* Merge properties from .fdi files */ in manager_commit_preprobing_done()
2993 * Move device from tdl to gdl. Runs helpers and callouts.
3040 …raise_error (connection, message, "org.freedesktop.Hal.DeviceExists", "CommitToGdl: Device exists:… in manager_commit_to_gdl()
3045 hal_device_property_remove (d, "info.udi"); in manager_commit_to_gdl()
3047 hal_device_property_set_string (d, "info.udi", udi); in manager_commit_to_gdl()
3052 * run "info.callouts.preprobe"? in manager_commit_to_gdl()
3053 * remove "info.ignore" devices? in manager_commit_to_gdl()
3056 * run "info.callouts.add"? in manager_commit_to_gdl()
3058 * (auto) start "info.addons"? in manager_commit_to_gdl()
3097 /* hald_runner_run_method() assumes ownership of mi->message.. so we don't free it here */ in hald_exec_method_free_mi()
3219 /* if method was Volume.Unmount() then refresh mount state */ in hald_exec_method_process_queue()
3220 if (strcmp (mi->interface, "org.freedesktop.Hal.Device.Volume") == 0 && in hald_exec_method_process_queue()
3248 /* the device went away before we got to it... */ in hald_exec_method_process_queue()
3284 …reply = dbus_message_new_error (message, "org.freedesktop.Hal.Device.UnknownError", "An unknown er… in hald_exec_method_cb()
3294 * if so we need a generic HAL error name; in hald_exec_method_cb()
3295 * otherwise, dbus will be messed up. in hald_exec_method_cb()
3299 exp_name = "org.freedesktop.Hal.Device.UnknownError"; in hald_exec_method_cb()
3303 /* error name may be invalid - assume caller fucked up and use a generic HAL error name */ in hald_exec_method_cb()
3304 …reply = dbus_message_new_error (message, "org.freedesktop.Hal.Device.UnknownError", "An unknown er… in hald_exec_method_cb()
3538 "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" in do_introspect()
3540 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" in do_introspect()
3559 " <node name=\"Hal\"/>\n"); in do_introspect()
3561 } else if (strcmp (path, "/org/freedesktop/Hal") == 0) { in do_introspect()
3567 } else if (strcmp (path, "/org/freedesktop/Hal/devices") == 0) { in do_introspect()
3573 } else if (strcmp (path, "/org/freedesktop/Hal/Manager") == 0) { in do_introspect()
3576 " <interface name=\"org.freedesktop.Hal.Manager\">\n" in do_introspect()
3582 " <arg name=\"udi\" direction=\"in\" type=\"o\"/>\n" in do_introspect()
3594 " <arg name=\"udi\" direction=\"in\" type=\"o\"/>\n" in do_introspect()
3599 " <arg name=\"udi\" direction=\"in\" type=\"o\"/>\n" in do_introspect()
3626 " <interface name=\"org.freedesktop.Hal.Device\">\n" in do_introspect()
3748 interfaces = hal_device_property_get_strlist (d, "info.interfaces"); in do_introspect()
3763 method_names_prop = g_strdup_printf ("%s.method_names", ifname); in do_introspect()
3764 method_signatures_prop = g_strdup_printf ("%s.method_signatures", ifname); in do_introspect()
3765 method_argnames_prop = g_strdup_printf ("%s.method_argnames", ifname); in do_introspect()
3904 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3907 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3910 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3913 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3916 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3919 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3923 (message, "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3926 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3930 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3933 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3936 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3939 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3942 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3945 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3948 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3951 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3954 "org.freedesktop.Hal.Manager", in hald_dbus_filter_handle_methods()
3957 "/org/freedesktop/Hal/Manager") == 0) { in hald_dbus_filter_handle_methods()
3960 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3964 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3968 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3972 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3976 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3980 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3984 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3988 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3992 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
3996 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4000 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4004 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4008 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4012 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4016 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4020 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4024 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4028 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4032 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4036 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4040 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4044 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4048 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4052 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4056 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4060 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4064 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4069 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4074 "org.freedesktop.Hal.Device", in hald_dbus_filter_handle_methods()
4078 "org.freedesktop.DBus.Introspectable", in hald_dbus_filter_handle_methods()
4143 interfaces = hal_device_property_get_strlist (d, "info.interfaces"); in hald_dbus_filter_handle_methods()
4152 s = g_strdup_printf ("%s.method_names", interface); in hald_dbus_filter_handle_methods()
4161 s = g_strdup_printf ("%s.method_execpaths", interface); in hald_dbus_filter_handle_methods()
4164 s = g_strdup_printf ("%s.method_signatures", interface); in hald_dbus_filter_handle_methods()
4189 /** Message handler for method invocations. All invocations on any object
4190 * or interface is routed through this function.
4204 /* this is a local message; e.g. from libdbus in this process */ in hald_dbus_filter_function()
4238 if (dbus_message_is_method_call (message, "org.freedesktop.DBus", "AddMatch")) { in local_server_message_handler()
4369 HAL_ERROR (("dbus_bus_get(): %s", dbus_error.message)); in hald_dbus_init()
4376 dbus_bus_request_name (dbus_connection, "org.freedesktop.Hal", in hald_dbus_init()
4380 dbus_error.message)); in hald_dbus_init()