libhal

libhal

Functions

#define LIBHAL_FREE_DBUS_ERROR()
#define LIBHAL_CHECK_LIBHALCONTEXT()
void (*LibHalIntegrateDBusIntoMainLoop) ()
void (*LibHalDeviceAdded) ()
void (*LibHalDeviceRemoved) ()
void (*LibHalDeviceNewCapability) ()
void (*LibHalDeviceLostCapability) ()
void (*LibHalDevicePropertyModified) ()
void (*LibHalDeviceCondition) ()
void (*LibHalGlobalInterfaceLockAcquired) ()
void (*LibHalGlobalInterfaceLockReleased) ()
void (*LibHalInterfaceLockAcquired) ()
void (*LibHalInterfaceLockReleased) ()
void (*LibHalSingletonDeviceAdded) ()
void (*LibHalSingletonDeviceRemoved) ()
LibHalContext * libhal_ctx_new ()
dbus_bool_t libhal_ctx_set_cache ()
dbus_bool_t libhal_ctx_set_dbus_connection ()
DBusConnection * libhal_ctx_get_dbus_connection ()
dbus_bool_t libhal_ctx_set_user_data ()
void * libhal_ctx_get_user_data ()
dbus_bool_t libhal_ctx_set_device_added ()
dbus_bool_t libhal_ctx_set_device_removed ()
dbus_bool_t libhal_ctx_set_device_new_capability ()
dbus_bool_t libhal_ctx_set_device_lost_capability ()
dbus_bool_t libhal_ctx_set_device_property_modified ()
dbus_bool_t libhal_ctx_set_device_condition ()
dbus_bool_t libhal_ctx_set_global_interface_lock_acquired ()
dbus_bool_t libhal_ctx_set_global_interface_lock_released ()
dbus_bool_t libhal_ctx_set_interface_lock_acquired ()
dbus_bool_t libhal_ctx_set_interface_lock_released ()
dbus_bool_t libhal_ctx_set_singleton_device_added ()
dbus_bool_t libhal_ctx_set_singleton_device_removed ()
dbus_bool_t libhal_ctx_init ()
dbus_bool_t libhal_ctx_shutdown ()
dbus_bool_t libhal_ctx_free ()
LibHalContext * libhal_ctx_init_direct ()
char ** libhal_get_all_devices ()
dbus_bool_t libhal_device_exists ()
dbus_bool_t libhal_device_print ()
dbus_bool_t libhal_device_property_exists ()
char * libhal_device_get_property_string ()
dbus_int32_t libhal_device_get_property_int ()
dbus_uint64_t libhal_device_get_property_uint64 ()
double libhal_device_get_property_double ()
dbus_bool_t libhal_device_get_property_bool ()
char ** libhal_device_get_property_strlist ()
dbus_bool_t libhal_device_set_property_string ()
dbus_bool_t libhal_device_set_property_int ()
dbus_bool_t libhal_device_set_property_uint64 ()
dbus_bool_t libhal_device_set_property_double ()
dbus_bool_t libhal_device_set_property_bool ()
dbus_bool_t libhal_device_property_strlist_append ()
dbus_bool_t libhal_device_property_strlist_prepend ()
dbus_bool_t libhal_device_property_strlist_remove_index ()
dbus_bool_t libhal_device_property_strlist_remove ()
dbus_bool_t libhal_device_remove_property ()
LibHalPropertyType libhal_device_get_property_type ()
LibHalChangeSet * libhal_device_new_changeset ()
dbus_bool_t libhal_changeset_set_property_string ()
dbus_bool_t libhal_changeset_set_property_int ()
dbus_bool_t libhal_changeset_set_property_uint64 ()
dbus_bool_t libhal_changeset_set_property_double ()
dbus_bool_t libhal_changeset_set_property_bool ()
dbus_bool_t libhal_changeset_set_property_strlist ()
dbus_bool_t libhal_device_commit_changeset ()
void libhal_device_free_changeset ()
LibHalPropertySet * libhal_device_get_all_properties ()
dbus_bool_t libhal_get_all_devices_with_properties ()
void libhal_property_set_sort ()
void libhal_free_property_set ()
unsigned int libhal_property_set_get_num_elems ()
LibHalPropertyType libhal_ps_get_type ()
const char * libhal_ps_get_string ()
dbus_int32_t libhal_ps_get_int32 ()
dbus_uint64_t libhal_ps_get_uint64 ()
double libhal_ps_get_double ()
dbus_bool_t libhal_ps_get_bool ()
void libhal_psi_init ()
dbus_bool_t libhal_psi_has_more ()
void libhal_psi_next ()
LibHalPropertyType libhal_psi_get_type ()
char * libhal_psi_get_key ()
char * libhal_psi_get_string ()
dbus_int32_t libhal_psi_get_int ()
dbus_uint64_t libhal_psi_get_uint64 ()
double libhal_psi_get_double ()
dbus_bool_t libhal_psi_get_bool ()
char ** libhal_psi_get_strlist ()
unsigned int libhal_string_array_length ()
void libhal_free_string_array ()
void libhal_free_string ()
char * libhal_new_device ()
dbus_bool_t libhal_device_commit_to_gdl ()
dbus_bool_t libhal_remove_device ()
dbus_bool_t libhal_merge_properties ()
dbus_bool_t libhal_device_matches ()
char ** libhal_manager_find_device_string_match ()
dbus_bool_t libhal_device_add_capability ()
dbus_bool_t libhal_device_query_capability ()
char ** libhal_find_device_by_capability ()
dbus_bool_t libhal_device_property_watch_all ()
dbus_bool_t libhal_device_property_remove_watch_all ()
dbus_bool_t libhal_device_add_property_watch ()
dbus_bool_t libhal_device_remove_property_watch ()
dbus_bool_t libhal_device_lock ()
dbus_bool_t libhal_device_unlock ()
dbus_bool_t libhal_device_rescan ()
dbus_bool_t libhal_device_reprobe ()
dbus_bool_t libhal_device_emit_condition ()
dbus_bool_t libhal_device_claim_interface ()
dbus_bool_t libhal_device_addon_is_ready ()
dbus_bool_t libhal_device_singleton_addon_is_ready ()
dbus_bool_t libhal_device_acquire_interface_lock ()
dbus_bool_t libhal_device_release_interface_lock ()
dbus_bool_t libhal_acquire_global_interface_lock ()
dbus_bool_t libhal_release_global_interface_lock ()
dbus_bool_t libhal_device_is_caller_locked_out ()
dbus_bool_t libhal_device_is_locked_by_others ()
char * libhal_device_is_caller_privileged ()

Types and Values

Description

Functions

LIBHAL_FREE_DBUS_ERROR()

#define             LIBHAL_FREE_DBUS_ERROR(_dbus_error_)


LIBHAL_CHECK_LIBHALCONTEXT()

#define             LIBHAL_CHECK_LIBHALCONTEXT(_ctx_, _ret_)

Handy macro for checking whether a context is valid.

Parameters

_ctx_

the context

 

_ret_

what to use for return value if context is invalid

 

LibHalIntegrateDBusIntoMainLoop ()

void
(*LibHalIntegrateDBusIntoMainLoop) (LibHalContext *ctx,
                                    DBusConnection *dbus_connection);

Type for function in application code that integrates a DBusConnection object into its own mainloop.

Parameters

ctx

context for connection to hald

 

dbus_connection

DBus connection to use in ctx

 

LibHalDeviceAdded ()

void
(*LibHalDeviceAdded) (LibHalContext *ctx,
                      const char *udi);

Type for callback when a device is added.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

LibHalDeviceRemoved ()

void
(*LibHalDeviceRemoved) (LibHalContext *ctx,
                        const char *udi);

Type for callback when a device is removed.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

LibHalDeviceNewCapability ()

void
(*LibHalDeviceNewCapability) (LibHalContext *ctx,
                              const char *udi,
                              const char *capability);

Type for callback when a device gains a new capability.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

capability

capability of the device

 

LibHalDeviceLostCapability ()

void
(*LibHalDeviceLostCapability) (LibHalContext *ctx,
                               const char *udi,
                               const char *capability);

Type for callback when a device loses a capability.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

capability

capability of the device

 

LibHalDevicePropertyModified ()

void
(*LibHalDevicePropertyModified) (LibHalContext *ctx,
                                 const char *udi,
                                 const char *key,
                                 dbus_bool_t is_removed,
                                 dbus_bool_t is_added);

Type for callback when a property of a device changes.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

key

name of the property that has changed

 

is_removed

whether or not property was removed

 

is_added

whether or not property was added

 

LibHalDeviceCondition ()

void
(*LibHalDeviceCondition) (LibHalContext *ctx,
                          const char *udi,
                          const char *condition_name,
                          const char *condition_detail);

Type for callback when a non-continuous condition occurs on a device.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

condition_name

name of the condition, e.g. ProcessorOverheating. Consult the HAL spec for details

 

condition_detail

detail of condition

 

LibHalGlobalInterfaceLockAcquired ()

void
(*LibHalGlobalInterfaceLockAcquired) (LibHalContext *ctx,
                                      const char *interface_name,
                                      const char *lock_owner,
                                      int num_locks);

Type for callback when someone acquires a global lock.

Parameters

ctx

context for connection to hald

 

interface_name

the name of the interface

 

lock_owner

what service acquired the lock

 

num_locks

number of locks on the interface

 

LibHalGlobalInterfaceLockReleased ()

void
(*LibHalGlobalInterfaceLockReleased) (LibHalContext *ctx,
                                      const char *interface_name,
                                      const char *lock_owner,
                                      int num_locks);

Type for callback when someone releases a global lock.

Parameters

ctx

context for connection to hald

 

interface_name

the name of the interface

 

lock_owner

what service released the lock

 

num_locks

number of locks on the interface

 

LibHalInterfaceLockAcquired ()

void
(*LibHalInterfaceLockAcquired) (LibHalContext *ctx,
                                const char *udi,
                                const char *interface_name,
                                const char *lock_owner,
                                int num_locks);

Type for callback when someone acquires a lock on a device.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

interface_name

the name of the interface

 

lock_owner

what service acquired the lock

 

num_locks

number of locks on the interface

 

LibHalInterfaceLockReleased ()

void
(*LibHalInterfaceLockReleased) (LibHalContext *ctx,
                                const char *udi,
                                const char *interface_name,
                                const char *lock_owner,
                                int num_locks);

Type for callback when someone acquires a lock on a device.

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

interface_name

the name of the interface

 

lock_owner

what service released the lock

 

num_locks

number of locks on the interface

 

LibHalSingletonDeviceAdded ()

void
(*LibHalSingletonDeviceAdded) (LibHalContext *ctx,
                               const char *udi,
                               const LibHalPropertySet *properties);

Type for callback for addon singletons when a device is added

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

properties

the device's properties

 

LibHalSingletonDeviceRemoved ()

void
(*LibHalSingletonDeviceRemoved) (LibHalContext *ctx,
                                 const char *udi,
                                 const LibHalPropertySet *properties);

Type for callback for addon singletons when a device is added

Parameters

ctx

context for connection to hald

 

udi

the Unique Device Id

 

properties

the device's properties

 

libhal_ctx_new ()

LibHalContext *
libhal_ctx_new (void);

Create a new LibHalContext

Returns

a new uninitialized LibHalContext object


libhal_ctx_set_cache ()

dbus_bool_t
libhal_ctx_set_cache (LibHalContext *ctx,
                      dbus_bool_t use_cache);

Enable or disable caching. Note: Caching is not actually implemented yet.

Parameters

ctx

context to enable/disable cache for

 

use_cache

whether or not to use cache

 

Returns

TRUE if cache was successfully enabled/disabled, FALSE otherwise


libhal_ctx_set_dbus_connection ()

dbus_bool_t
libhal_ctx_set_dbus_connection (LibHalContext *ctx,
                                DBusConnection *conn);

Set DBus connection to use to talk to hald.

Parameters

ctx

context to set connection for

 

conn

DBus connection to use

 

Returns

TRUE if connection was successfully set, FALSE otherwise


libhal_ctx_get_dbus_connection ()

DBusConnection *
libhal_ctx_get_dbus_connection (LibHalContext *ctx);

Get DBus connection used for talking to hald.

Parameters

ctx

context to get connection for

 

Returns

DBus connection to use or NULL


libhal_ctx_set_user_data ()

dbus_bool_t
libhal_ctx_set_user_data (LibHalContext *ctx,
                          void *user_data);

Set user data for the context.

Parameters

ctx

the context for the connection to hald

 

user_data

user data

 

Returns

TRUE if user data was successfully set, FALSE if otherwise


libhal_ctx_get_user_data ()

void *
libhal_ctx_get_user_data (LibHalContext *ctx);

Get user data for the context.

Parameters

ctx

the context for the connection to hald

 

Returns

opaque pointer stored through libhal_ctx_set_user_data() or NULL if not set.


libhal_ctx_set_device_added ()

dbus_bool_t
libhal_ctx_set_device_added (LibHalContext *ctx,
                             LibHalDeviceAdded callback);

Set the callback for when a device is added

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device is added

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_device_removed ()

dbus_bool_t
libhal_ctx_set_device_removed (LibHalContext *ctx,
                               LibHalDeviceRemoved callback);

Set the callback for when a device is removed.

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device is removed

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_device_new_capability ()

dbus_bool_t
libhal_ctx_set_device_new_capability (LibHalContext *ctx,
                                      LibHalDeviceNewCapability callback);

Set the callback for when a device gains a new capability.

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device gains a new capability

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_device_lost_capability ()

dbus_bool_t
libhal_ctx_set_device_lost_capability (LibHalContext *ctx,
                                       LibHalDeviceLostCapability callback);

Set the callback for when a device loses a capability

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device loses a capability

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_device_property_modified ()

dbus_bool_t
libhal_ctx_set_device_property_modified
                               (LibHalContext *ctx,
                                LibHalDevicePropertyModified callback);

Set the callback for when a property is modified on a device.

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a property is modified on a device

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_device_condition ()

dbus_bool_t
libhal_ctx_set_device_condition (LibHalContext *ctx,
                                 LibHalDeviceCondition callback);

Set the callback for when a device emits a condition

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device emits a condition

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_global_interface_lock_acquired ()

dbus_bool_t
libhal_ctx_set_global_interface_lock_acquired
                               (LibHalContext *ctx,
                                LibHalGlobalInterfaceLockAcquired callback);

Set the callback for when a global interface lock is acquired.

Parameters

ctx

the context for the connection to hald

 

callback

the callback

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_global_interface_lock_released ()

dbus_bool_t
libhal_ctx_set_global_interface_lock_released
                               (LibHalContext *ctx,
                                LibHalGlobalInterfaceLockReleased callback);

Set the callback for when a global interface lock is released.

Parameters

ctx

the context for the connection to hald

 

callback

the callback

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_interface_lock_acquired ()

dbus_bool_t
libhal_ctx_set_interface_lock_acquired
                               (LibHalContext *ctx,
                                LibHalInterfaceLockAcquired callback);

Set the callback for when an interface lock is acquired.

Parameters

ctx

the context for the connection to hald

 

callback

the callback

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_interface_lock_released ()

dbus_bool_t
libhal_ctx_set_interface_lock_released
                               (LibHalContext *ctx,
                                LibHalInterfaceLockReleased callback);

Set the callback for when an interface lock is released.

Parameters

ctx

the context for the connection to hald

 

callback

the callback

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_singleton_device_added ()

dbus_bool_t
libhal_ctx_set_singleton_device_added (LibHalContext *ctx,
                                       LibHalSingletonDeviceAdded callback);

Set the callback for when a singleton should handle a new device

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device emits a condition

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_set_singleton_device_removed ()

dbus_bool_t
libhal_ctx_set_singleton_device_removed
                               (LibHalContext *ctx,
                                LibHalSingletonDeviceRemoved callback);

Set the callback for when a singleton should discard a device

Parameters

ctx

the context for the connection to hald

 

callback

the function to call when a device emits a condition

 

Returns

TRUE if callback was successfully set, FALSE otherwise


libhal_ctx_init ()

dbus_bool_t
libhal_ctx_init (LibHalContext *ctx,
                 DBusError *error);

Initialize the connection to hald.

Parameters

ctx

Context for connection to hald (D-BUS connection should be set with libhal_ctx_set_dbus_connection)

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if initialization succeeds, FALSE otherwise


libhal_ctx_shutdown ()

dbus_bool_t
libhal_ctx_shutdown (LibHalContext *ctx,
                     DBusError *error);

Shut down a connection to hald.

Parameters

ctx

the context for the connection to hald

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if connection successfully shut down, FALSE otherwise


libhal_ctx_free ()

dbus_bool_t
libhal_ctx_free (LibHalContext *ctx);

Free a LibHalContext resource.

Parameters

ctx

pointer to a LibHalContext

 

Returns

TRUE


libhal_ctx_init_direct ()

LibHalContext *
libhal_ctx_init_direct (DBusError *error);

Create an already initialized connection to hald. This function should only be used by HAL helpers.

Parameters

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

A pointer to an already initialized LibHalContext


libhal_get_all_devices ()

char **
libhal_get_all_devices (LibHalContext *ctx,
                        int *num_devices,
                        DBusError *error);

Get all devices in the Global Device List (GDL).

Parameters

ctx

the context for the connection to hald

 

num_devices

the number of devices will be stored here

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

An array of device identifiers terminated with NULL. It is the responsibility of the caller to free with libhal_free_string_array(). If an error occurs NULL is returned.


libhal_device_exists ()

dbus_bool_t
libhal_device_exists (LibHalContext *ctx,
                      const char *udi,
                      DBusError *error);

Determine if a device exists.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique device id.

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the device exists


libhal_device_print ()

dbus_bool_t
libhal_device_print (LibHalContext *ctx,
                     const char *udi,
                     DBusError *error);

Print a device to stdout; useful for debugging.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if device's information could be obtained, FALSE otherwise


libhal_device_property_exists ()

dbus_bool_t
libhal_device_property_exists (LibHalContext *ctx,
                               const char *udi,
                               const char *key,
                               DBusError *error);

Determine if a property on a device exists.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique device id.

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the device exists, FALSE otherwise


libhal_device_get_property_string ()

char *
libhal_device_get_property_string (LibHalContext *ctx,
                                   const char *udi,
                                   const char *key,
                                   DBusError *error);

Get the value of a property of type string.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

the name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

UTF8 nul-terminated string. The caller is responsible for freeing this string with the function libhal_free_string(). Returns NULL if the property didn't exist or we are OOM.


libhal_device_get_property_int ()

dbus_int32_t
libhal_device_get_property_int (LibHalContext *ctx,
                                const char *udi,
                                const char *key,
                                DBusError *error);

Get the value of a property of type integer.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Property value (32-bit signed integer)


libhal_device_get_property_uint64 ()

dbus_uint64_t
libhal_device_get_property_uint64 (LibHalContext *ctx,
                                   const char *udi,
                                   const char *key,
                                   DBusError *error);

Get the value of a property of type signed integer.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Property value (64-bit unsigned integer)


libhal_device_get_property_double ()

double
libhal_device_get_property_double (LibHalContext *ctx,
                                   const char *udi,
                                   const char *key,
                                   DBusError *error);

Get the value of a property of type double.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Property value (IEEE754 double precision float)


libhal_device_get_property_bool ()

dbus_bool_t
libhal_device_get_property_bool (LibHalContext *ctx,
                                 const char *udi,
                                 const char *key,
                                 DBusError *error);

Get the value of a property of type bool.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Property value (boolean)


libhal_device_get_property_strlist ()

char **
libhal_device_get_property_strlist (LibHalContext *ctx,
                                    const char *udi,
                                    const char *key,
                                    DBusError *error);

Get the value of a property of type string list.

Parameters

ctx

the context for the connection to hald

 

udi

unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Array of pointers to UTF8 nul-terminated strings terminated by NULL. The caller is responsible for freeing this string array with the function libhal_free_string_array(). Returns NULL if the property didn't exist or we are OOM


libhal_device_set_property_string ()

dbus_bool_t
libhal_device_set_property_string (LibHalContext *ctx,
                                   const char *udi,
                                   const char *key,
                                   const char *value,
                                   DBusError *error);

Set a property of type string.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value of the property; a UTF8 string

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the property was set, FALSE if the device didn't exist or the property had a different type.


libhal_device_set_property_int ()

dbus_bool_t
libhal_device_set_property_int (LibHalContext *ctx,
                                const char *udi,
                                const char *key,
                                dbus_int32_t value,
                                DBusError *error);

Set a property of type signed integer.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the property was set, FALSE if the device didn't exist or the property had a different type.


libhal_device_set_property_uint64 ()

dbus_bool_t
libhal_device_set_property_uint64 (LibHalContext *ctx,
                                   const char *udi,
                                   const char *key,
                                   dbus_uint64_t value,
                                   DBusError *error);

Set a property of type unsigned integer.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the property was set, FALSE if the device didn't exist or the property had a different type.


libhal_device_set_property_double ()

dbus_bool_t
libhal_device_set_property_double (LibHalContext *ctx,
                                   const char *udi,
                                   const char *key,
                                   double value,
                                   DBusError *error);

Set a property of type double.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the property was set, FALSE if the device didn't exist or the property had a different type.


libhal_device_set_property_bool ()

dbus_bool_t
libhal_device_set_property_bool (LibHalContext *ctx,
                                 const char *udi,
                                 const char *key,
                                 dbus_bool_t value,
                                 DBusError *error);

Set a property of type bool.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the property was set, FALSE if the device didn't exist or the property had a different type.


libhal_device_property_strlist_append ()

dbus_bool_t
libhal_device_property_strlist_append (LibHalContext *ctx,
                                       const char *udi,
                                       const char *key,
                                       const char *value,
                                       DBusError *error);

Append to a property of type strlist.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value to append to property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the value was appended, FALSE if the device didn't exist or the property had a different type.


libhal_device_property_strlist_prepend ()

dbus_bool_t
libhal_device_property_strlist_prepend
                               (LibHalContext *ctx,
                                const char *udi,
                                const char *key,
                                const char *value,
                                DBusError *error);

Prepend to a property of type strlist.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

value to prepend to property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the value was prepended, FALSE if the device didn't exist or the property had a different type.


libhal_device_property_strlist_remove_index ()

dbus_bool_t
libhal_device_property_strlist_remove_index
                               (LibHalContext *ctx,
                                const char *udi,
                                const char *key,
                                unsigned int idx,
                                DBusError *error);

Remove a specified string from a property of type strlist.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

idx

index of string to remove in the strlist

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the string was removed, FALSE if the device didn't exist or the property had a different type.


libhal_device_property_strlist_remove ()

dbus_bool_t
libhal_device_property_strlist_remove (LibHalContext *ctx,
                                       const char *udi,
                                       const char *key,
                                       const char *value,
                                       DBusError *error);

Remove a specified string from a property of type strlist.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

value

the string to remove

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the string was removed, FALSE if the device didn't exist or the property had a different type.


libhal_device_remove_property ()

dbus_bool_t
libhal_device_remove_property (LibHalContext *ctx,
                               const char *udi,
                               const char *key,
                               DBusError *error);

Remove a property.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the property was set, FALSE if the device didn't exist


libhal_device_get_property_type ()

LibHalPropertyType
libhal_device_get_property_type (LibHalContext *ctx,
                                 const char *udi,
                                 const char *key,
                                 DBusError *error);

Query a property type of a device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

key

name of the property

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

A LibHalPropertyType. LIBHAL_PROPERTY_TYPE_INVALID is return if the property doesn't exist.


libhal_device_new_changeset ()

LibHalChangeSet *
libhal_device_new_changeset (const char *udi);

Request a new changeset object. Used for changing multiple properties at once. Useful when performance is critical and also for atomically updating several properties.

Parameters

udi

unique device identifier

 

Returns

A new changeset object or NULL on error


libhal_changeset_set_property_string ()

dbus_bool_t
libhal_changeset_set_property_string (LibHalChangeSet *changeset,
                                      const char *key,
                                      const char *value);

Set a property.

Parameters

changeset

the changeset

 

key

key of property

 

value

the value to set

 

Returns

FALSE on OOM


libhal_changeset_set_property_int ()

dbus_bool_t
libhal_changeset_set_property_int (LibHalChangeSet *changeset,
                                   const char *key,
                                   dbus_int32_t value);

Set a property.

Parameters

changeset

the changeset

 

key

key of property

 

value

the value to set

 

Returns

FALSE on OOM


libhal_changeset_set_property_uint64 ()

dbus_bool_t
libhal_changeset_set_property_uint64 (LibHalChangeSet *changeset,
                                      const char *key,
                                      dbus_uint64_t value);

Set a property.

Parameters

changeset

the changeset

 

key

key of property

 

value

the value to set

 

Returns

FALSE on OOM


libhal_changeset_set_property_double ()

dbus_bool_t
libhal_changeset_set_property_double (LibHalChangeSet *changeset,
                                      const char *key,
                                      double value);

Set a property.

Parameters

changeset

the changeset

 

key

key of property

 

value

the value to set

 

Returns

FALSE on OOM


libhal_changeset_set_property_bool ()

dbus_bool_t
libhal_changeset_set_property_bool (LibHalChangeSet *changeset,
                                    const char *key,
                                    dbus_bool_t value);

Set a property.

Parameters

changeset

the changeset

 

key

key of property

 

value

the value to set

 

Returns

FALSE on OOM


libhal_changeset_set_property_strlist ()

dbus_bool_t
libhal_changeset_set_property_strlist (LibHalChangeSet *changeset,
                                       const char *key,
                                       const char **value);

Set a property.

Parameters

changeset

the changeset

 

key

key of property

 

value

the value to set - NULL terminated array of strings

 

Returns

FALSE on OOM


libhal_device_commit_changeset ()

dbus_bool_t
libhal_device_commit_changeset (LibHalContext *ctx,
                                LibHalChangeSet *changeset,
                                DBusError *error);

Commit a changeset to the daemon.

Parameters

ctx

the context for the connection to hald

 

changeset

the changeset to commit

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

True if the changeset was committed on the daemon side


libhal_device_free_changeset ()

void
libhal_device_free_changeset (LibHalChangeSet *changeset);

Free a changeset.

Parameters

changeset

the changeset to free

 

libhal_device_get_all_properties ()

LibHalPropertySet *
libhal_device_get_all_properties (LibHalContext *ctx,
                                  const char *udi,
                                  DBusError *error);

Retrieve all the properties on a device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

An object represent all properties. Must be freed with libhal_free_property_set().


libhal_get_all_devices_with_properties ()

dbus_bool_t
libhal_get_all_devices_with_properties
                               (LibHalContext *ctx,
                                int *out_num_devices,
                                char ***out_udi,
                                LibHalPropertySet ***out_properties,
                                DBusError *error);

Get all devices in the hal database as well as all properties for each device.

Return: TRUE if success; FALSE and error will be set.

Parameters

out_num_devices

Return location for number of devices

 

out_udi

Return location for array of of udi's. Caller should free this with libhal_free_string_array() when done with it.

 

out_properties

Return location for array of LibHalPropertySet objects. Caller should free each one of them with libhal_free_property_set() when done with it

 

error

Return location for error

 

Returns


libhal_property_set_sort ()

void
libhal_property_set_sort (LibHalPropertySet *set);

Sort all properties according to property name.

Parameters

set

property-set to sort

 

libhal_free_property_set ()

void
libhal_free_property_set (LibHalPropertySet *set);

Free a property set earlier obtained with libhal_device_get_all_properties().

Parameters

set

property-set to free

 

libhal_property_set_get_num_elems ()

unsigned int
libhal_property_set_get_num_elems (LibHalPropertySet *set);

Get the number of properties in a property set.

Parameters

set

property set to consider

 

Returns

number of properties in given property set


libhal_ps_get_type ()

LibHalPropertyType
libhal_ps_get_type (const LibHalPropertySet *set,
                    const char *key);

Get the type of a given property.

Parameters

set

property set

 

key

name of property to inspect

 

Returns

the LibHalPropertyType of the given property, LIBHAL_PROPERTY_TYPE_INVALID if property is not in the set


libhal_ps_get_string ()

const char *
libhal_ps_get_string (const LibHalPropertySet *set,
                      const char *key);

Get the value of a property of type string.

Parameters

set

property set

 

key

name of property to inspect

 

Returns

UTF8 nul-terminated string. This pointer is only valid until libhal_free_property_set() is invoked on the property set this property belongs to. NULL if property is not in the set or not a string


libhal_ps_get_int32 ()

dbus_int32_t
libhal_ps_get_int32 (const LibHalPropertySet *set,
                     const char *key);

Returns


libhal_ps_get_uint64 ()

dbus_uint64_t
libhal_ps_get_uint64 (const LibHalPropertySet *set,
                      const char *key);

Get the value of a property of type unsigned integer.

Parameters

set

property set

 

key

name of property to inspect

 

Returns

property value (64-bit unsigned integer)


libhal_ps_get_double ()

double
libhal_ps_get_double (const LibHalPropertySet *set,
                      const char *key);

Get the value of a property of type double.

Parameters

set

property set

 

key

name of property to inspect

 

Returns

property value (IEEE754 double precision float)


libhal_ps_get_bool ()

dbus_bool_t
libhal_ps_get_bool (const LibHalPropertySet *set,
                    const char *key);

Get the value of a property of type bool.

Parameters

set

property set

 

key

name of property to inspect

 

Returns

property value (bool)


libhal_psi_init ()

void
libhal_psi_init (LibHalPropertySetIterator *iter,
                 LibHalPropertySet *set);

Initialize a property set iterator.

Parameters

iter

iterator object

 

set

property set to iterate over

 

libhal_psi_has_more ()

dbus_bool_t
libhal_psi_has_more (LibHalPropertySetIterator *iter);

Determine whether there are more properties to iterate over.

Parameters

iter

iterator object

 

Returns

TRUE if there are more properties, FALSE otherwise.


libhal_psi_next ()

void
libhal_psi_next (LibHalPropertySetIterator *iter);

Advance iterator to next property.

Parameters

iter

iterator object

 

libhal_psi_get_type ()

LibHalPropertyType
libhal_psi_get_type (LibHalPropertySetIterator *iter);

Get type of property.

Parameters

iter

iterator object

 

Returns

the property type at the iterator's position


libhal_psi_get_key ()

char *
libhal_psi_get_key (LibHalPropertySetIterator *iter);

Get the key of a property.

Parameters

iter

iterator object

 

Returns

ASCII nul-terminated string. This pointer is only valid until libhal_free_property_set() is invoked on the property set this property belongs to.


libhal_psi_get_string ()

char *
libhal_psi_get_string (LibHalPropertySetIterator *iter);

Get the value of a property of type string.

Parameters

iter

iterator object

 

Returns

UTF8 nul-terminated string. This pointer is only valid until libhal_free_property_set() is invoked on the property set this property belongs to.


libhal_psi_get_int ()

dbus_int32_t
libhal_psi_get_int (LibHalPropertySetIterator *iter);

Get the value of a property of type signed integer.

Parameters

iter

iterator object

 

Returns

property value (32-bit signed integer)


libhal_psi_get_uint64 ()

dbus_uint64_t
libhal_psi_get_uint64 (LibHalPropertySetIterator *iter);

Get the value of a property of type unsigned integer.

Parameters

iter

iterator object

 

Returns

property value (64-bit unsigned integer)


libhal_psi_get_double ()

double
libhal_psi_get_double (LibHalPropertySetIterator *iter);

Get the value of a property of type double.

Parameters

iter

iterator object

 

Returns

property value (IEEE754 double precision float)


libhal_psi_get_bool ()

dbus_bool_t
libhal_psi_get_bool (LibHalPropertySetIterator *iter);

Get the value of a property of type bool.

Parameters

iter

iterator object

 

Returns

property value (bool)


libhal_psi_get_strlist ()

char **
libhal_psi_get_strlist (LibHalPropertySetIterator *iter);

Get the value of a property of type string list.

Parameters

iter

iterator object

 

Returns

pointer to array of strings


libhal_string_array_length ()

unsigned int
libhal_string_array_length (char **str_array);

Get the length of an array of strings.

Parameters

str_array

array of strings to consider

 

Returns

Number of strings in array


libhal_free_string_array ()

void
libhal_free_string_array (char **str_array);

Frees a NULL-terminated array of strings. If passed NULL, does nothing.

Parameters

str_array

the array to be freed

 

libhal_free_string ()

void
libhal_free_string (char *str);

Used to free strings returned by libhal.

Parameters

str

the nul-terminated sting to free

 

libhal_new_device ()

char *
libhal_new_device (LibHalContext *ctx,
                   DBusError *error);

Create a new device object which will be hidden from applications until the CommitToGdl(), ie. libhal_device_commit_to_gdl(), method is called. Note that the program invoking this method needs to run with super user privileges.

Parameters

ctx

the context for the connection to hald

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Temporary device unique id or NULL if there was a problem. This string must be freed by the caller.


libhal_device_commit_to_gdl ()

dbus_bool_t
libhal_device_commit_to_gdl (LibHalContext *ctx,
                             const char *temp_udi,
                             const char *udi,
                             DBusError *error);

When a hidden device has been built using the NewDevice method, ie. libhal_new_device(), and the org.freedesktop.Hal.Device interface this function will commit it to the global device list.

This means that the device object will be visible to applications and the HAL daemon will possibly attempt to boot the device (depending on the property RequireEnable).

Note that the program invoking this method needs to run with super user privileges.

Parameters

ctx

the context for the connection to hald

 

temp_udi

the temporary unique device id as returned by libhal_new_device()

 

udi

the new unique device id.

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

FALSE if the given unique device id is already in use.


libhal_remove_device ()

dbus_bool_t
libhal_remove_device (LibHalContext *ctx,
                      const char *udi,
                      DBusError *error);

This method can be invoked when a device is removed. The HAL daemon will shut down the device. Note that the device may still be in the device list if the Persistent property is set to true.

Note that the program invoking this method needs to run with super user privileges.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique device id.

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the device was removed, FALSE otherwise


libhal_merge_properties ()

dbus_bool_t
libhal_merge_properties (LibHalContext *ctx,
                         const char *target_udi,
                         const char *source_udi,
                         DBusError *error);

Merge properties from one device to another.

Parameters

ctx

the context for the connection to hald

 

target_udi

the Unique device id of target device to merge to

 

source_udi

the Unique device id of device to merge from

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the properties were merged, FALSE otherwise


libhal_device_matches ()

dbus_bool_t
libhal_device_matches (LibHalContext *ctx,
                       const char *udi1,
                       const char *udi2,
                       const char *property_namespace,
                       DBusError *error);

Check a set of properties for two devices matches.

Checks that all properties where keys, starting with a given value (namespace), of the first device is in the second device and that they got the same value and type.

Note that the other inclusion isn't tested, so there could be properties (from the given namespace) in the second device not present in the first device.

Parameters

ctx

the context for the connection to hald

 

udi1

the Unique Device Id for device 1

 

udi2

the Unique Device Id for device 2

 

property_namespace

the namespace for set of devices, e.g. "usb"

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if all properties starting with the given namespace parameter from one device is in the other and have the same value.


libhal_manager_find_device_string_match ()

char **
libhal_manager_find_device_string_match
                               (LibHalContext *ctx,
                                const char *key,
                                const char *value,
                                int *num_devices,
                                DBusError *error);

Find a device in the GDL where a single string property matches a given value.

Parameters

ctx

the context for the connection to hald

 

key

name of the property

 

value

the value to match

 

num_devices

pointer to store number of devices

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

UDI of devices; free with libhal_free_string_array()


libhal_device_add_capability ()

dbus_bool_t
libhal_device_add_capability (LibHalContext *ctx,
                              const char *udi,
                              const char *capability,
                              DBusError *error);

Assign a capability to a device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

capability

the capability name to add

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the capability was added, FALSE if the device didn't exist


libhal_device_query_capability ()

dbus_bool_t
libhal_device_query_capability (LibHalContext *ctx,
                                const char *udi,
                                const char *capability,
                                DBusError *error);

Check if a device has a capability. The result is undefined if the device doesn't exist.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

capability

the capability name

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the device has the capability, otherwise FALSE


libhal_find_device_by_capability ()

char **
libhal_find_device_by_capability (LibHalContext *ctx,
                                  const char *capability,
                                  int *num_devices,
                                  DBusError *error);

Find devices with a given capability.

Parameters

ctx

the context for the connection to hald

 

capability

the capability name

 

num_devices

pointer to store number of devices

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

UDI of devices; free with libhal_free_string_array()


libhal_device_property_watch_all ()

dbus_bool_t
libhal_device_property_watch_all (LibHalContext *ctx,
                                  DBusError *error);

Watch all devices, ie. the device_property_changed callback is invoked when the properties on any device changes.

Parameters

ctx

the context for the connection to hald

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE only if the operation succeeded


libhal_device_property_remove_watch_all ()

dbus_bool_t
libhal_device_property_remove_watch_all
                               (LibHalContext *ctx,
                                DBusError *error);

Returns


libhal_device_add_property_watch ()

dbus_bool_t
libhal_device_add_property_watch (LibHalContext *ctx,
                                  const char *udi,
                                  DBusError *error);

Add a watch on a device, so the device_property_changed callback is invoked when the properties on the given device changes.

The application itself is responsible for deleting the watch, using libhal_device_remove_property_watch, if the device is removed.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE only if the operation succeeded


libhal_device_remove_property_watch ()

dbus_bool_t
libhal_device_remove_property_watch (LibHalContext *ctx,
                                     const char *udi,
                                     DBusError *error);

Remove a watch on a device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE only if the operation succeeded


libhal_device_lock ()

dbus_bool_t
libhal_device_lock (LibHalContext *ctx,
                    const char *udi,
                    const char *reason_to_lock,
                    char **reason_why_locked,
                    DBusError *error);

Take an advisory lock on the device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

reason_to_lock

a user-presentable reason why the device is locked.

 

reason_why_locked

a pointer to store the reason why the device cannot be locked on failure, or NULL

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the lock was obtained, FALSE otherwise


libhal_device_unlock ()

dbus_bool_t
libhal_device_unlock (LibHalContext *ctx,
                      const char *udi,
                      DBusError *error);

Release an advisory lock on the device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the device was successfully unlocked, FALSE otherwise


libhal_device_rescan ()

dbus_bool_t
libhal_device_rescan (LibHalContext *ctx,
                      const char *udi,
                      DBusError *error);

TODO document me.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Whether the operation succeeded


libhal_device_reprobe ()

dbus_bool_t
libhal_device_reprobe (LibHalContext *ctx,
                       const char *udi,
                       DBusError *error);

TODO document me.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

Whether the operation succeeded


libhal_device_emit_condition ()

dbus_bool_t
libhal_device_emit_condition (LibHalContext *ctx,
                              const char *udi,
                              const char *condition_name,
                              const char *condition_details,
                              DBusError *error);

Emit a condition from a device. Can only be used from hald helpers.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

condition_name

user-readable name of condition

 

condition_details

user-readable details of condition

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if condition successfully emitted, FALSE otherwise


libhal_device_claim_interface ()

dbus_bool_t
libhal_device_claim_interface (LibHalContext *ctx,
                               const char *udi,
                               const char *interface_name,
                               const char *introspection_xml,
                               DBusError *error);

Claim an interface for a device. All messages to this interface will be forwarded to the helper. Can only be used from hald helpers.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id

 

interface_name

Name of interface to claim, e.g. org.freedesktop.Hal.Device.FoobarKindOfThing

 

introspection_xml

Introspection XML containing what would be inside the interface XML tag

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if interface was claimed, FALSE otherwise


libhal_device_addon_is_ready ()

dbus_bool_t
libhal_device_addon_is_ready (LibHalContext *ctx,
                              const char *udi,
                              DBusError *error);

HAL addon's must call this method when they are done initializing the device object. The HAL daemon will wait for all addon's to call this.

Can only be used from hald helpers.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique Device Id this addon is handling

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the HAL daemon received the message, FALSE otherwise


libhal_device_singleton_addon_is_ready ()

dbus_bool_t
libhal_device_singleton_addon_is_ready
                               (LibHalContext *ctx,
                                const char *command_line,
                                DBusError *error);

HAL singleton addon's must call this method when they are done initializing the device object. The HAL daemon will wait for all addon's to call this.

Can only be used from hald helpers.

Parameters

ctx

the context for the connection to hald

 

command_line

commandline singleton was started with

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

TRUE if the HAL daemon received the message, FALSE otherwise


libhal_device_acquire_interface_lock ()

dbus_bool_t
libhal_device_acquire_interface_lock (LibHalContext *ctx,
                                      const char *udi,
                                      const char *interface,
                                      dbus_bool_t exclusive,
                                      DBusError *error);

Releases a lock on an interface for a specific device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

interface

the intername name to lock

 

exclusive

whether the lock should be exclusive

 

error

pointer to an initialized dbus error object for returning errors

 

Returns

TRUE iff the lock was acquired


libhal_device_release_interface_lock ()

dbus_bool_t
libhal_device_release_interface_lock (LibHalContext *ctx,
                                      const char *udi,
                                      const char *interface,
                                      DBusError *error);

Acquires a lock on an interface for a specific device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

interface

the intername name to unlock

 

error

pointer to an initialized dbus error object for returning errors

 

Returns

TRUE iff the lock was released.


libhal_acquire_global_interface_lock ()

dbus_bool_t
libhal_acquire_global_interface_lock (LibHalContext *ctx,
                                      const char *interface,
                                      dbus_bool_t exclusive,
                                      DBusError *error);

Acquires a global lock on an interface.

Parameters

ctx

the context for the connection to hald

 

interface

the intername name to lock

 

exclusive

whether the lock should be exclusive

 

error

pointer to an initialized dbus error object for returning errors

 

Returns

TRUE iff the lock was acquired


libhal_release_global_interface_lock ()

dbus_bool_t
libhal_release_global_interface_lock (LibHalContext *ctx,
                                      const char *interface,
                                      DBusError *error);

Releases a global lock on an interface.

Parameters

ctx

the context for the connection to hald

 

interface

the intername name to unlock

 

error

pointer to an initialized dbus error object for returning errors

 

Returns

TRUE iff the lock was released


libhal_device_is_caller_locked_out ()

dbus_bool_t
libhal_device_is_caller_locked_out (LibHalContext *ctx,
                                    const char *udi,
                                    const char *interface,
                                    const char *caller,
                                    DBusError *error);

Determines whether a given process on the system message bus is locked out from an interface on a specific device. Only HAL helpers are privileged to use this method.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

interface

the intername name to check

 

caller

the caller to check for

 

error

pointer to an initialized dbus error object for returning errors

 

Returns

Whether the given caller is locked out


libhal_device_is_locked_by_others ()

dbus_bool_t
libhal_device_is_locked_by_others (LibHalContext *ctx,
                                   const char *udi,
                                   const char *interface,
                                   DBusError *error);

Determines whether a determines other processes than the caller holds a lock on the given device.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

interface

the intername name to check

 

error

pointer to an initialized dbus error object for returning errors or NULL

 

Returns

If another process is holding a lock on the device


libhal_device_is_caller_privileged ()

char *
libhal_device_is_caller_privileged (LibHalContext *ctx,
                                    const char *udi,
                                    const char *action,
                                    const char *caller,
                                    DBusError *error);

Determines if a given caller have a given privilege on a given device. Will always error out if HAL is not built with PolicyKit support.

Parameters

ctx

the context for the connection to hald

 

udi

the Unique id of device

 

action

the action to check for

 

caller

the caller to check for

 

error

pointer to an initialized dbus error object for returning errors

 

Returns

The textual reply from PolicyKit. See the PolicyKitResult enumeration in the PolicyKit documentation for details. The caller is responsible for freeing this string with the function libhal_free_string().

Types and Values

DBUS_API_SUBJECT_TO_CHANGE

#define DBUS_API_SUBJECT_TO_CHANGE 


LIBHAL_DEPRECATED

#define LIBHAL_DEPRECATED __attribute__ ((deprecated))  


enum LibHalPropertyType

Possible types for properties on hal device objects

Members

LIBHAL_PROPERTY_TYPE_INVALID

   

LIBHAL_PROPERTY_TYPE_INT32

   

LIBHAL_PROPERTY_TYPE_UINT64

   

LIBHAL_PROPERTY_TYPE_DOUBLE

   

LIBHAL_PROPERTY_TYPE_BOOLEAN

   

LIBHAL_PROPERTY_TYPE_STRING

   

LIBHAL_PROPERTY_TYPE_STRLIST

   

LibHalContext

typedef struct LibHalContext_s LibHalContext;

Context for connection to the HAL daemon. Opaque, use the libhal_ctx_*() family of functions to access it.


LibHalProperty

typedef struct LibHalProperty_s LibHalProperty;

Represents a property. Opaque.


LibHalPropertySet

typedef struct LibHalPropertySet_s LibHalPropertySet;

Represents a set of properties. Opaque; use the libhal_property_set_*() family of functions to access it.


struct LibHalChangeSet_s

struct LibHalChangeSet_s;


LibHalChangeSet

typedef struct LibHalChangeSet_s LibHalChangeSet;


LibHalPropertySetIterator

typedef struct LibHalPropertySetIterator_s LibHalPropertySetIterator;

Iterator for inspecting all properties. Do not access any members; use the libhal_psi_* family of functions instead.