2011-12-26 03:59:12 +01:00
|
|
|
#!/usr/bin/python
|
2012-01-16 22:35:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Copyright (C) 2011 Sebastian Lohff <seba@seba-geek.de>
|
|
|
|
# Licensed under GPL v3 or later
|
2011-12-26 03:59:12 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|