只需直接监视udev(通过libudev,通过pyudev)。
import pyudevcontext = pyudev.Context()monitor = pyudev.Monitor.from_netlink(context)observer = pyudev.pygtk.GUDevMonitorObserver(monitor)observer.connect('device-added', device_added_callback)observer.connect('device-changed', device_changed_callback)monitor.enable_receiving()mainloop = gobject.MainLoop()mainloop.run()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)