gudev: Add Device.get_usec_since_initialized
Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
2363d33e10
commit
d4c2307cc2
|
@ -42,6 +42,7 @@ g_udev_device_get_parent
|
||||||
g_udev_device_get_parent_with_subsystem
|
g_udev_device_get_parent_with_subsystem
|
||||||
g_udev_device_get_tags
|
g_udev_device_get_tags
|
||||||
g_udev_device_get_is_initialized
|
g_udev_device_get_is_initialized
|
||||||
|
g_udev_device_get_usec_since_initialized
|
||||||
g_udev_device_get_property_keys
|
g_udev_device_get_property_keys
|
||||||
g_udev_device_has_property
|
g_udev_device_has_property
|
||||||
g_udev_device_get_property
|
g_udev_device_get_property
|
||||||
|
|
|
@ -941,3 +941,24 @@ g_udev_device_get_is_initialized (GUdevDevice *device)
|
||||||
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
|
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
|
||||||
return udev_device_get_is_initialized (device->priv->udevice);
|
return udev_device_get_is_initialized (device->priv->udevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_udev_device_get_usec_since_initialized:
|
||||||
|
* @device: 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.
|
||||||
|
*
|
||||||
|
* Returns: Number of micro-seconds since @device was initialized or 0 if unknown.
|
||||||
|
*
|
||||||
|
* Since: 165
|
||||||
|
*/
|
||||||
|
guint64
|
||||||
|
g_udev_device_get_usec_since_initialized (GUdevDevice *device)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0);
|
||||||
|
return udev_device_get_usec_since_initialized (device->priv->udevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct _GUdevDeviceClass
|
||||||
|
|
||||||
GType g_udev_device_get_type (void) G_GNUC_CONST;
|
GType g_udev_device_get_type (void) G_GNUC_CONST;
|
||||||
gboolean g_udev_device_get_is_initialized (GUdevDevice *device);
|
gboolean g_udev_device_get_is_initialized (GUdevDevice *device);
|
||||||
|
guint64 g_udev_device_get_usec_since_initialized (GUdevDevice *device);
|
||||||
const gchar *g_udev_device_get_subsystem (GUdevDevice *device);
|
const gchar *g_udev_device_get_subsystem (GUdevDevice *device);
|
||||||
const gchar *g_udev_device_get_devtype (GUdevDevice *device);
|
const gchar *g_udev_device_get_devtype (GUdevDevice *device);
|
||||||
const gchar *g_udev_device_get_name (GUdevDevice *device);
|
const gchar *g_udev_device_get_name (GUdevDevice *device);
|
||||||
|
|
|
@ -4,20 +4,21 @@ const GLib = imports.gi.GLib;
|
||||||
const GUdev = imports.gi.GUdev;
|
const GUdev = imports.gi.GUdev;
|
||||||
|
|
||||||
function print_device(device) {
|
function print_device(device) {
|
||||||
print(" initialized: " + device.get_is_initialized());
|
print(" initialized: " + device.get_is_initialized());
|
||||||
print(" subsystem: " + device.get_subsystem());
|
print(" usec since initialized: " + device.get_usec_since_initialized());
|
||||||
print(" devtype: " + device.get_devtype());
|
print(" subsystem: " + device.get_subsystem());
|
||||||
print(" name: " + device.get_name());
|
print(" devtype: " + device.get_devtype());
|
||||||
print(" number: " + device.get_number());
|
print(" name: " + device.get_name());
|
||||||
print(" sysfs_path: " + device.get_sysfs_path());
|
print(" number: " + device.get_number());
|
||||||
print(" driver: " + device.get_driver());
|
print(" sysfs_path: " + device.get_sysfs_path());
|
||||||
print(" action: " + device.get_action());
|
print(" driver: " + device.get_driver());
|
||||||
print(" seqnum: " + device.get_seqnum());
|
print(" action: " + device.get_action());
|
||||||
print(" device type: " + device.get_device_type());
|
print(" seqnum: " + device.get_seqnum());
|
||||||
print(" device number: " + device.get_device_number());
|
print(" device type: " + device.get_device_type());
|
||||||
print(" device file: " + device.get_device_file());
|
print(" device number: " + device.get_device_number());
|
||||||
print(" device file symlinks: " + device.get_device_file_symlinks());
|
print(" device file: " + device.get_device_file());
|
||||||
print(" tags: " + device.get_tags());
|
print(" device file symlinks: " + device.get_device_file_symlinks());
|
||||||
|
print(" tags: " + device.get_tags());
|
||||||
var keys = device.get_property_keys();
|
var keys = device.get_property_keys();
|
||||||
for (var n = 0; n < keys.length; n++) {
|
for (var n = 0; n < keys.length; n++) {
|
||||||
print(" " + keys[n] + "=" + device.get_property(keys[n]));
|
print(" " + keys[n] + "=" + device.get_property(keys[n]));
|
||||||
|
|
Loading…
Reference in New Issue