Beispiel #1
0
    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
Beispiel #2
0
    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
Beispiel #3
0
    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
Beispiel #4
0
 def __init__(self):
     plugin.DaemonPlugin.__init__(self)
     self.devices = util.list_usb_devices()
     self.poll_interval = 100  # 1 second
Beispiel #5
0
 def __init__(self):
     plugin.DaemonPlugin.__init__(self)
     self.devices = util.list_usb_devices()
     self.poll_interval = 1 # 1 second