summaryrefslogtreecommitdiff
path: root/src/gudev/seed-example-enum.js
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-04-13 18:24:39 +0200
committerKay Sievers <kay@vrfy.org>2012-04-13 19:22:06 +0200
commitbb061708d5aa83579f213bdfb67253f7027217c3 (patch)
tree020b8c8e2831a8ce683fe847df98bc926ef7a39a /src/gudev/seed-example-enum.js
parent74afee9c18fe74035387e4e17ca60c6b51ee9af3 (diff)
udev: move libudev, gudev to src/; move gudev/docs/, udev/docs/ to to docs/
Diffstat (limited to 'src/gudev/seed-example-enum.js')
-rwxr-xr-xsrc/gudev/seed-example-enum.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gudev/seed-example-enum.js b/src/gudev/seed-example-enum.js
new file mode 100755
index 0000000000..66206ad806
--- /dev/null
+++ b/src/gudev/seed-example-enum.js
@@ -0,0 +1,38 @@
+#!/usr/bin/env seed
+
+const GLib = imports.gi.GLib;
+const GUdev = imports.gi.GUdev;
+
+function print_device(device) {
+ 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]));
+ }
+}
+
+var client = new GUdev.Client({subsystems: []});
+var enumerator = new GUdev.Enumerator({client: client});
+enumerator.add_match_subsystem('b*')
+
+var devices = enumerator.execute();
+
+for (var n=0; n < devices.length; n++) {
+ var device = devices[n];
+ print_device(device);
+ print("");
+}