def poll(self, menuw=None, arg=None): """ poll to check for devices """ changes = False current_devices = util.list_usb_devices() for d in current_devices: try: self.devices.remove(d) except ValueError: _debug_('new device %s' % (d)) for device, message, action in config.USB_HOTPLUG: if d == device: pop = PopupBox(text=message) pop.show() os.system(action) pop.destroy() break else: changes = True for d in self.devices: changes = True _debug_('removed device %s' % (d)) if changes: rc.post_event(plugin.event('USB')) self.devices = current_devices
def poll(self, menuw=None, arg=None): """ poll to check for devices """ changes = False current_devices = util.list_usb_devices() for d in current_devices: try: self.devices.remove(d) except ValueError: logger.debug('new device %s', d) for device, message, action in config.USB_HOTPLUG: if d == device: pop = dialog.show_working_indicator(message) os.system(action) pop.hide() break else: changes = True for d in self.devices: changes = True logger.debug('removed device %s', d) if changes: rc.post_event(plugin.event('USB')) self.devices = current_devices
def __init__(self): plugin.DaemonPlugin.__init__(self) self.devices = util.list_usb_devices() self.poll_interval = 100 # 1 second
def __init__(self): plugin.DaemonPlugin.__init__(self) self.devices = util.list_usb_devices() self.poll_interval = 1 # 1 second