Skip to content

mo10/pyudev-zero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyudev-zero

A pure Python implementation of libudev-zero

Usages

List all devices

import json

for dev in udev_enumerate_scan_devices():
    print(f'Device {dev}: {json.dumps(dev.properties, indent=4)}')

List all USB tty devices

import json

for dev in udev_enumerate_scan_devices(lambda d: d.subsystem == 'tty'):
    parent = dev.get_parent_filter(lambda d: d.subsystem == 'usb')
    if parent:
        print(f'Device {dev}: {json.dumps(dev.properties, indent=4)}')
        print(f'Parent {parent}: {json.dumps(parent.properties, indent=4)}')

Not support

Udev netlink monitoring is currently not supported.

Thanks

This library is rewritten from libudev-zero.

About

A pure Python implementation of libudev-zero

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages