Blame scripts/seed-example-enum.js

rpm-build 07bc2b
#!/usr/bin/env seed
rpm-build 07bc2b
rpm-build 07bc2b
const GLib = imports.gi.GLib;
rpm-build 07bc2b
const GUdev = imports.gi.GUdev;
rpm-build 07bc2b
rpm-build 07bc2b
function print_device(device) {
rpm-build 07bc2b
  print("  initialized:            " + device.get_is_initialized());
rpm-build 07bc2b
  print("  usec since initialized: " + device.get_usec_since_initialized());
rpm-build 07bc2b
  print("  subsystem:              " + device.get_subsystem());
rpm-build 07bc2b
  print("  devtype:                " + device.get_devtype());
rpm-build 07bc2b
  print("  name:                   " + device.get_name());
rpm-build 07bc2b
  print("  number:                 " + device.get_number());
rpm-build 07bc2b
  print("  sysfs_path:             " + device.get_sysfs_path());
rpm-build 07bc2b
  print("  driver:                 " + device.get_driver());
rpm-build 07bc2b
  print("  action:                 " + device.get_action());
rpm-build 07bc2b
  print("  seqnum:                 " + device.get_seqnum());
rpm-build 07bc2b
  print("  device type:            " + device.get_device_type());
rpm-build 07bc2b
  print("  device number:          " + device.get_device_number());
rpm-build 07bc2b
  print("  device file:            " + device.get_device_file());
rpm-build 07bc2b
  print("  device file symlinks:   " + device.get_device_file_symlinks());
rpm-build 07bc2b
  print("  tags:                   " + device.get_tags());
rpm-build 07bc2b
  var keys = device.get_property_keys();
rpm-build 07bc2b
  for (var n = 0; n < keys.length; n++) {
rpm-build 07bc2b
    print("    " + keys[n] + "=" + device.get_property(keys[n]));
rpm-build 07bc2b
  }
rpm-build 07bc2b
}
rpm-build 07bc2b
rpm-build 07bc2b
var client = new GUdev.Client({subsystems: []});
rpm-build 07bc2b
var enumerator = new GUdev.Enumerator({client: client});
rpm-build 07bc2b
enumerator.add_match_subsystem('b*')
rpm-build 07bc2b
rpm-build 07bc2b
var devices = enumerator.execute();
rpm-build 07bc2b
rpm-build 07bc2b
for (var n=0; n < devices.length; n++) {
rpm-build 07bc2b
    var device = devices[n];
rpm-build 07bc2b
    print_device(device);
rpm-build 07bc2b
    print("");
rpm-build 07bc2b
}