Example #1
0
def start_all():
    # just in case this it called twice in a row...
    stop_all()

    if _log.isEnabledFor(_INFO):
        _log.info('starting receiver listening threads')
    for device_info in _base.receivers():
        _process_receiver_event('add', device_info)
    for device_info in _base.wired_devices():
        _process_receiver_event('add', device_info)
Example #2
0
def _wired_devices(dev_path=None):
    from logitech_receiver import Device
    from logitech_receiver.base import wired_devices
    for dev_info in wired_devices():
        if dev_path is not None and dev_path != dev_info.path:
            continue
        try:
            d = Device(None, 0, info=dev_info)
            if _log.isEnabledFor(_DEBUG):
                _log.debug('[%s] => %s', dev_info.path, d)
            if d is not None:
                yield d
        except Exception as e:
            _log.exception('opening ' + str(dev_info))
            _sys.exit('%s: error: %s' % (NAME, str(e)))