API for enumerating and introspecting local devices

udev.dart

libudev — API for enumerating and introspecting local devices

Querying devices

void main() {
  print(UdevDevice.fromSyspath('/sys/devices/<...>'));
  print(UdevDevice.fromDevnum('b', 66304));
  print(UdevDevice.fromSubsystemSysname('net', 'eth0'));
  print(UdevDevice.fromDeviceId('c128:1'));
}

Scanning devices

void main() {
  final context = UdevContext();

  final syspaths = context.scanDevices(subsystems: ['net']);
  for (final syspath in syspaths) {
    final device = UdevDevice.fromSyspath(syspath, context: context);
    print(device);
  }

  context.dispose();
}

Contributing to udev.dart

We welcome contributions! See the contribution guide for more details.

GitHub

View Github