Corresponds to the standard #dev_t type as defined by POSIX (Until
bug 584517 is resolved this work-around is needed).
#GUdevClient is used to query information about devices on a Linux
system from the Linux kernel and the udev device
manager.
Device information is retrieved from the kernel (through the
<literal>sysfs</literal> filesystem) and the udev daemon (through a
<literal>tmpfs</literal> filesystem) and presented through
#GUdevDevice objects. This means that no blocking IO ever happens
(in both cases, we are essentially just reading data from kernel
memory) and as such there are no asynchronous versions of the
provided methods.
To get #GUdevDevice objects, use
g_udev_client_query_by_subsystem(),
g_udev_client_query_by_device_number(),
g_udev_client_query_by_device_file(),
g_udev_client_query_by_sysfs_path(),
g_udev_client_query_by_subsystem_and_name()
or the #GUdevEnumerator type.
To listen to uevents, connect to the #GUdevClient::uevent signal.
Constructs a #GUdevClient object that can be used to query
information about devices. Connect to the #GUdevClient::uevent
signal to listen for uevents. Note that signals are emitted in the
<link linkend="g-main-context-push-thread-default">thread-default main loop</link>
of the thread that you call this constructor from.
A new #GUdevClient object. Free with g_object_unref().
A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter.
Signal class handler for the #GUdevClient::uevent signal.
Looks up a device for a device file.
A #GUdevDevice object or %NULL
if the device was not found. Free with g_object_unref().
A #GUdevClient.
A device file.
Looks up a device for a type and device number.
A #GUdevDevice object or %NULL
if the device was not found. Free with g_object_unref().
A #GUdevClient.
A value from the #GUdevDeviceType enumeration.
A device number.
Gets all devices belonging to @subsystem.
A
list of #GUdevDevice objects. The caller should free the result by
using g_object_unref() on each element in the list and then
g_list_free() on the list.
A #GUdevClient.
The subsystem to get devices for or %NULL to get all devices.
Looks up a device for a subsystem and name.
A #GUdevDevice object or %NULL
if the device was not found. Free with g_object_unref().
A #GUdevClient.
A subsystem name.
The name of the device.
Looks up a device for a sysfs path.
A #GUdevDevice object or %NULL
if the device was not found. Free with g_object_unref().
A #GUdevClient.
A sysfs path.
The subsystems to listen for uevents on.
To listen for only a specific DEVTYPE for a given SUBSYSTEM, use
"subsystem/devtype". For example, to only listen for uevents
where SUBSYSTEM is usb and DEVTYPE is usb_interface, use
"usb/usb_interface".
If this property is %NULL, then no events will be reported. If
it's the empty array, events from all subsystems will be
reported.
Emitted when @client receives an uevent.
Note that while you'll have access to all the device's properties and attributes
for the majority of actions, only the sysfs path will be available when the device
is removed.
Also note that the action is an arbitrary string, controlled by device drivers. Other
values than those listed is possible, but unlikely.
This signal is emitted in the
<link linkend="g-main-context-push-thread-default">thread-default main loop</link>
of the thread that @client was created in.
The action for the uevent e.g. "add", "remove", "change", "move",
"online" or "offline"
Details about the #GUdevDevice the event is for.
Class structure for #GUdevClient.
Parent class.
Signal class handler for the #GUdevClient::uevent signal.
The #GUdevDevice class is used to get information about a specific
device. Note that you cannot instantiate a #GUdevDevice object
yourself. Instead you must use #GUdevClient to obtain #GUdevDevice
objects.
To get basic information about a device, use
g_udev_device_get_subsystem(), g_udev_device_get_devtype(),
g_udev_device_get_name(), g_udev_device_get_number(),
g_udev_device_get_sysfs_path(), g_udev_device_get_driver(),
g_udev_device_get_action(), g_udev_device_get_seqnum(),
g_udev_device_get_device_type(), g_udev_device_get_device_number(),
g_udev_device_get_device_file(),
g_udev_device_get_device_file_symlinks().
To navigate the device tree, use g_udev_device_get_parent() and
g_udev_device_get_parent_with_subsystem().
To access udev properties for the device, use
g_udev_device_get_property_keys(),
g_udev_device_has_property(),
g_udev_device_get_property(),
g_udev_device_get_property_as_int(),
g_udev_device_get_property_as_uint64(),
g_udev_device_get_property_as_double(),
g_udev_device_get_property_as_boolean() and
g_udev_device_get_property_as_strv().
To access sysfs attributes for the device, use
g_udev_device_get_sysfs_attr_keys(),
g_udev_device_has_sysfs_attr(),
g_udev_device_get_sysfs_attr(),
g_udev_device_get_sysfs_attr_as_int(),
g_udev_device_get_sysfs_attr_as_uint64(),
g_udev_device_get_sysfs_attr_as_double(),
g_udev_device_get_sysfs_attr_as_boolean() and
g_udev_device_get_sysfs_attr_as_strv().
Note that all getters on #GUdevDevice are non-reffing – returned
values are owned by the object, should not be freed and are only
valid as long as the object is alive.
By design, #GUdevDevice will not react to changes for a device – it
only contains a snapshot of information when the #GUdevDevice
object was created. To work with changes, you typically connect to
the #GUdevClient::uevent signal on a #GUdevClient and get a new
#GUdevDevice whenever an event happens.
Gets the most recent action (e.g. "add", "remove", "change", etc.) for @device.
An action string.
A #GUdevDevice.
Gets all current tags for @device.
https://www.freedesktop.org/software/systemd/man/udev_device_has_current_tag.html
A %NULL terminated string array of current tags. This array is owned by @device and should not be freed by the caller.
A #GUdevDevice.
Gets the device file for @device.
The device file for @device or %NULL if no
device file exists.
A #GUdevDevice.
Gets a list of symlinks (in <literal>/dev</literal>) that points to
the device file for @device.
A %NULL terminated string array of symlinks. This array is owned by @device and should not be freed by the caller.
A #GUdevDevice.
Gets the device number, if any, for @device.
The device number for @device or 0 if unknown.
A #GUdevDevice.
Gets the type of the device file, if any, for @device.
The device number for @device or #G_UDEV_DEVICE_TYPE_NONE if the device does not have a device file.
A #GUdevDevice.
Gets the device type for @device.
The devtype for @device.
A #GUdevDevice.
Gets the name of the driver used for @device.
The name of the driver for @device or %NULL if
unknown.
A #GUdevDevice.
Gets whether @device has been initialized.
Whether @device has been initialized.
A #GUdevDevice.
Gets the name of @device, e.g. "sda3".
The name of @device.
A #GUdevDevice.
Gets the number of @device, e.g. "3" if g_udev_device_get_name() returns "sda3".
The number of @device.
A #GUdevDevice.
Gets the immediate parent of @device, if any.
A #GUdevDevice or %NULL if
@device has no parent. Free with g_object_unref().
A #GUdevDevice.
Walks up the chain of parents of @device and returns the first
device encountered where @subsystem and @devtype matches, if any.
A #GUdevDevice or %NULL if
@device has no parent with @subsystem and @devtype. Free with
g_object_unref().
A #GUdevDevice.
The subsystem of the parent to get.
The devtype of the parent to get or %NULL.
Look up the value for @key on @device.
The value for @key or %NULL if @key doesn't
exist on @device. Do not free this string, it is owned by @device.
A #GUdevDevice.
Name of property.
Look up the value for @key on @device and convert it to an
boolean. This is done by doing a case-insensitive string comparison
on the string value against "1" and "true".
The value for @key or %FALSE if @key doesn't exist or
isn't a #gboolean.
A #GUdevDevice.
Name of property.
Look up the value for @key on @device and convert it to a double
precision floating point number using g_ascii_strtod().
The value for @key or 0.0 if @key doesn't exist or isn't a
#gdouble.
A #GUdevDevice.
Name of property.
Look up the value for @key on @device and convert it to an integer
using strtol().
The value for @key or 0 if @key doesn't exist or
isn't an integer.
A #GUdevDevice.
Name of property.
Look up the value for @key on @device and return the result of
splitting it into non-empty tokens split at white space (only space
(' '), form-feed ('\f'), newline ('\n'), carriage return ('\r'),
horizontal tab ('\t'), and vertical tab ('\v') are considered; the
locale is not taken into account).
The value of @key on @device split into tokens or %NULL if @key
doesn't exist. This array is owned by @device and should not be
freed by the caller.
A #GUdevDevice.
Name of property.
Look up the value for @key on @device and convert it to an unsigned
64-bit integer using g_ascii_strtoull().
The value for @key or 0 if @key doesn't exist or isn't a
#guint64.
A #GUdevDevice.
Name of property.
Gets all keys for properties on @device.
A %NULL terminated string array of property keys. This array is owned by @device and should not be freed by the caller.
A #GUdevDevice.
Gets the most recent sequence number for @device.
A sequence number.
A #GUdevDevice.
Gets the subsystem for @device.
The subsystem for @device.
A #GUdevDevice.
Look up the sysfs attribute with @name on @device. The retrieved value
is cached in the device. Repeated calls will return the same value and
not open the attribute again, unless updated through one of the
"uncached" functions.
The value of the sysfs attribute or %NULL if
there is no such attribute. Do not free this string, it is owned by
@device.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to an
boolean. This is done by doing a case-insensitive string comparison
on the string value against "1", "true", "Y" and "y". The retrieved value is
cached in the device. Repeated calls will return the same value and
not open the attribute again, unless updated through one of the
"uncached" functions.
The value of the sysfs attribute or %FALSE if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to an
boolean. This is done by doing a case-insensitive string comparison
on the string value against "1", "true", "Y" and "y". This function does
blocking I/O, and updates the sysfs attributes cache.
Before version 238 the uncached getters would not strip trailing newlines.
The value of the sysfs attribute or %FALSE if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to a double
precision floating point number using g_ascii_strtod(). The retrieved value is cached
in the device. Repeated calls will return the same value and not open the
attribute again, unless updated through one of the "uncached" functions.
The value of the sysfs attribute or 0.0 if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to a double
precision floating point number using g_ascii_strtod(). This function does blocking
I/O, and updates the sysfs attributes cache.
Before version 238 the uncached getters would not strip trailing newlines.
The value of the sysfs attribute or 0.0 if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to an integer
using strtol(). The retrieved value is cached in the device. Repeated calls
will return the same value and not open the attribute again, unless updated
through one of the "uncached" functions.
The value of the sysfs attribute or 0 if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to an integer
using strtol(). This function does blocking I/O, and updates the sysfs
attributes cache.
Before version 238 the uncached getters would not strip trailing newlines.
The value of the sysfs attribute or 0 if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and return the result of
splitting it into non-empty tokens split at white space (only space (' '),
form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal
tab ('\t'), and vertical tab ('\v') are considered; the locale is
not taken into account).
The retrieved value is cached in the device. Repeated calls will return
the same value and not open the attribute again, unless updated through
one of the "uncached" functions.
The value of the sysfs attribute split into tokens or %NULL if
there is no such attribute. This array is owned by @device and
should not be freed by the caller.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and return the result of
splitting it into non-empty tokens split at white space (only space (' '),
form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal
tab ('\t'), and vertical tab ('\v') are considered; the locale is
not taken into account).
This function does blocking I/O, and updates the sysfs attributes cache.
The value of the sysfs attribute split into tokens or %NULL if
there is no such attribute. This array is owned by @device and
should not be freed by the caller.
Before version 238 the uncached getters would not strip trailing newlines.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to an unsigned
64-bit integer using g_ascii_strtoull(). The retrieved value is cached in the
device. Repeated calls will return the same value and not open the attribute
again, unless updated through one of the "uncached" functions.
The value of the sysfs attribute or 0 if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Look up the sysfs attribute with @name on @device and convert it to an unsigned
64-bit integer using g_ascii_strtoull(). This function does blocking I/O, and
updates the sysfs attributes cache.
Before version 238 the uncached getters would not strip trailing newlines.
The value of the sysfs attribute or 0 if there is no such
attribute.
A #GUdevDevice.
Name of the sysfs attribute.
Gets all keys for sysfs attributes on @device.
A %NULL terminated string array of sysfs attribute keys. This array is owned by @device and should not be freed by the caller.
A #GUdevDevice.
Look up the sysfs attribute with @name on @device. This function does
blocking I/O, and updates the sysfs attributes cache.
Before version 238 the uncached getters would not strip trailing newlines.
The value of the sysfs attribute or %NULL if
there is no such attribute. Do not free this string, it is owned by
@device.
A #GUdevDevice.
Name of the sysfs attribute.
Gets the sysfs path for @device.
The sysfs path for @device.
A #GUdevDevice.
Gets all tags for @device.
A %NULL terminated string array of tags. This array is owned by @device and should not be freed by the caller.
A #GUdevDevice.
Gets number of micro-seconds since @device was initialized.
This only works for devices with properties in the udev
database. All other devices return 0.
Number of micro-seconds since @device was initialized or 0 if unknown.
A #GUdevDevice.
Check if a the property with the given key exists.
%TRUE only if the value for @key exist.
A #GUdevDevice.
Name of property.
Check if a the sysfs attribute with the given key exists. The
retrieved value is cached in the device. Repeated calls will
return the same result and not check for the presence of the
attribute again, unless updated through one of the "uncached"
functions.
%TRUE only if the value for @key exist.
A #GUdevDevice.
Name of sysfs attribute.
Check if a the sysfs attribute with the given key exists. The
retrieved value is cached in the device. Repeated calls will
return the same result and not check for the presence of the
attribute again, unless updated through one of the "uncached"
functions.
%TRUE only if the value for @key exist.
A #GUdevDevice.
Name of sysfs attribute.
Class structure for #GUdevDevice.
Parent class.
Enumeration used to specify a the type of a device.
Device does not have a device file.
Device is a block device.
Device is a character device.
#GUdevEnumerator is used to lookup and sort devices.
Constructs a #GUdevEnumerator object that can be used to enumerate
and sort devices. Use the add_match_*() and add_nomatch_*() methods
and execute the query to get a list of devices with
g_udev_enumerator_execute().
A new #GUdevEnumerator object. Free with g_object_unref().
A #GUdevClient to enumerate devices from.
All returned devices will be initialized.
The passed in @enumerator.
A #GUdevEnumerator.
All returned devices will match the given @name.
The passed in @enumerator.
A #GUdevEnumerator.
Wildcard filter for kernel name e.g. "sda*".
All returned devices will have a property matching the given @name and @value.
The passed in @enumerator.
A #GUdevEnumerator.
Wildcard filter for property name.
Wildcard filter for property value.
All returned devices will match the given @subsystem.
The passed in @enumerator.
A #GUdevEnumerator.
Wildcard for subsystem name e.g. 'scsi' or 'a*'.
All returned devices will have a sysfs attribute matching the given @name and @value.
The passed in @enumerator.
A #GUdevEnumerator.
Wildcard filter for sysfs attribute key.
Wildcard filter for sysfs attribute value.
All returned devices will match the given @tag.
The passed in @enumerator.
A #GUdevEnumerator.
A udev tag e.g. "udev-acl".
All returned devices will not match the given @subsystem.
The passed in @enumerator.
A #GUdevEnumerator.
Wildcard for subsystem name e.g. 'scsi' or 'a*'.
All returned devices will not have a sysfs attribute matching the given @name and @value.
The passed in @enumerator.
A #GUdevEnumerator.
Wildcard filter for sysfs attribute key.
Wildcard filter for sysfs attribute value.
Add a device to the list of devices, to retrieve it back sorted in dependency order.
The passed in @enumerator.
A #GUdevEnumerator.
A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda"
Executes the query in @enumerator.
A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list.
A #GUdevEnumerator.
The #GUdevClient to enumerate devices from.
Class structure for #GUdevEnumerator.
Parent class.