You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
284 B

#!/usr/bin/python
import pyudev
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by(subsystem='block')
for action, device in monitor:
if action == 'add':
print device
for k, v in device.items():
print k.ljust(34), v
print "-" * 80