]> err.no Git - systemd/commitdiff
gudev: Add Device.get_usec_since_initialized
authorDavid Zeuthen <davidz@redhat.com>
Wed, 15 Dec 2010 15:46:34 +0000 (10:46 -0500)
committerDavid Zeuthen <davidz@redhat.com>
Wed, 15 Dec 2010 15:46:34 +0000 (10:46 -0500)
Signed-off-by: David Zeuthen <davidz@redhat.com>
extras/gudev/docs/gudev-sections.txt
extras/gudev/gudevdevice.c
extras/gudev/gudevdevice.h
extras/gudev/seed-example-enum.js

index 4119ae4920e6107075bae50af9aee6e52ff987a9..181870fb5a99f8f58b5f6f435fe24903fda2c66f 100644 (file)
@@ -42,6 +42,7 @@ g_udev_device_get_parent
 g_udev_device_get_parent_with_subsystem
 g_udev_device_get_tags
 g_udev_device_get_is_initialized
+g_udev_device_get_usec_since_initialized
 g_udev_device_get_property_keys
 g_udev_device_has_property
 g_udev_device_get_property
index 8909178e4b0cf5a87cef91053fdeea95151b6de4..6f30d12d075fe6f748dbfb448002075fe6bd8a0f 100644 (file)
@@ -941,3 +941,24 @@ g_udev_device_get_is_initialized (GUdevDevice  *device)
   g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
   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);
+}
+
index 1ca2b48a04ef904a64374ea1a5e33000a296f30a..ab22371ded1ed6d82920903c0447c569d45497e8 100644 (file)
@@ -77,6 +77,7 @@ struct _GUdevDeviceClass
 
 GType               g_udev_device_get_type                  (void) G_GNUC_CONST;
 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_devtype               (GUdevDevice  *device);
 const gchar        *g_udev_device_get_name                  (GUdevDevice  *device);
index 32200a42f91e133fc62a7d65d5264df1aa4a8029..66206ad8067ca488fa107f2a1858e13d14d059fa 100755 (executable)
@@ -4,20 +4,21 @@ const GLib = imports.gi.GLib;
 const GUdev = imports.gi.GUdev;
 
 function print_device(device) {
-  print("  initialized:           " + device.get_is_initialized());
-  print("  subsystem:             " + device.get_subsystem());
-  print("  devtype:               " + device.get_devtype());
-  print("  name:                  " + device.get_name());
-  print("  number:                " + device.get_number());
-  print("  sysfs_path:            " + device.get_sysfs_path());
-  print("  driver:                " + device.get_driver());
-  print("  action:                " + device.get_action());
-  print("  seqnum:                " + device.get_seqnum());
-  print("  device type:           " + device.get_device_type());
-  print("  device number:         " + device.get_device_number());
-  print("  device file:           " + device.get_device_file());
-  print("  device file symlinks:  " + device.get_device_file_symlinks());
-  print("  tags:                  " + device.get_tags());
+  print("  initialized:            " + device.get_is_initialized());
+  print("  usec since initialized: " + device.get_usec_since_initialized());
+  print("  subsystem:              " + device.get_subsystem());
+  print("  devtype:                " + device.get_devtype());
+  print("  name:                   " + device.get_name());
+  print("  number:                 " + device.get_number());
+  print("  sysfs_path:             " + device.get_sysfs_path());
+  print("  driver:                 " + device.get_driver());
+  print("  action:                 " + device.get_action());
+  print("  seqnum:                 " + device.get_seqnum());
+  print("  device type:            " + device.get_device_type());
+  print("  device number:          " + device.get_device_number());
+  print("  device file:            " + device.get_device_file());
+  print("  device file symlinks:   " + device.get_device_file_symlinks());
+  print("  tags:                   " + device.get_tags());
   var keys = device.get_property_keys();
   for (var n = 0; n < keys.length; n++) {
     print("    " + keys[n] + "=" + device.get_property(keys[n]));