First sorry for my english !
my environement :
python : 2.7.3
wxwidgets : 2.9.4-1
wxpython : 2.9.4-1
ubuntu : 12.04
context :
I have to detect when an usb hard-drive is plugged or unplugged and do some action on it.
For example when a disk is plugged i wan to get the mount point (ex:/media/usb0) and the system point (ex:/dev/sdb1). I need both two path and i do not want made a system call like (subprocess : mount -l).
I have tried several ways :
- pyudev : only get the system path on EVT_DEVICE_ADDED (like /dev/sdb1)
- Gio (gi.repository) : get the mount point with 'mount-added' (like /media/usb0) and the system point in an second event 'volume-added' but i have problems with Gio add and remove event fail or have suspect behavior depends on computer i have tried my application on it
- DBusGMainLoop (dbus.mainloop.glib) : Works but depends on computer i tried it (all on the same configuration) launch 2 event 'DeviceAdded', and sometime one DeviceChanged but sometime not when a disk is plugged.
Do you know a way (maybe one of the 3 i exposed, i have done something bad) to detect when an usb disk is plugged, call a method and in this method get the 2 path i need ?
Thanks in advance.
Aurélien.