fix solaar-cli to handle the new Receiver.open() api

This commit is contained in:
Daniel Pavel 2013-05-01 15:51:12 +02:00
parent c829304e31
commit 8fc45e5590
1 changed files with 10 additions and 7 deletions

View File

@ -33,13 +33,16 @@ def _require(module, os_package):
def _receiver():
from logitech.unifying_receiver import Receiver
try:
r = Receiver.open()
except Exception as e:
_fail(str(e))
if r is None:
_fail("Logitech Unifying Receiver not found")
return r
from logitech.unifying_receiver.base import receivers
for dev_info in receivers():
try:
r = Receiver.open(dev_info.path)
if r:
return r
except Exception as e:
_fail(str(e))
return r
_fail("Logitech receiver not found")
def _find_device(receiver, name, may_be_receiver=False):