chiark / gitweb /
systemd-activate: pass environment variables through
[elogind.git] / src / gudev / seed-example-enum.js
1 #!/usr/bin/env seed
2
3 const GLib = imports.gi.GLib;
4 const GUdev = imports.gi.GUdev;
5
6 function print_device(device) {
7   print("  initialized:            " + device.get_is_initialized());
8   print("  usec since initialized: " + device.get_usec_since_initialized());
9   print("  subsystem:              " + device.get_subsystem());
10   print("  devtype:                " + device.get_devtype());
11   print("  name:                   " + device.get_name());
12   print("  number:                 " + device.get_number());
13   print("  sysfs_path:             " + device.get_sysfs_path());
14   print("  driver:                 " + device.get_driver());
15   print("  action:                 " + device.get_action());
16   print("  seqnum:                 " + device.get_seqnum());
17   print("  device type:            " + device.get_device_type());
18   print("  device number:          " + device.get_device_number());
19   print("  device file:            " + device.get_device_file());
20   print("  device file symlinks:   " + device.get_device_file_symlinks());
21   print("  tags:                   " + device.get_tags());
22   var keys = device.get_property_keys();
23   for (var n = 0; n < keys.length; n++) {
24     print("    " + keys[n] + "=" + device.get_property(keys[n]));
25   }
26 }
27
28 var client = new GUdev.Client({subsystems: []});
29 var enumerator = new GUdev.Enumerator({client: client});
30 enumerator.add_match_subsystem('b*')
31
32 var devices = enumerator.execute();
33
34 for (var n=0; n < devices.length; n++) {
35     var device = devices[n];
36     print_device(device);
37     print("");
38 }