improved hid++ support

This commit is contained in:
Daniel Pavel 2012-12-08 00:41:43 +02:00
parent 33a9ca060d
commit d38bec39b6
3 changed files with 9 additions and 2 deletions

View File

@ -195,6 +195,7 @@ def read(device_handle, bytes_count, timeout_ms=-1):
if rlist:
assert rlist == [device_handle]
data = _os.read(device_handle, bytes_count)
assert data is not None
return data
else:
return b''

View File

@ -252,7 +252,7 @@ class Receiver(object):
return False
if enable:
# set all possible flags
ok = self.request(0x8000, 0xFF, 0xFF) # and self.request(0x8002, 0x02)
ok = self.request(0x8000, 0xFF, 0xFF, 0xFF)
else:
# clear out all possible flags
ok = self.request(0x8000)

View File

@ -193,9 +193,15 @@ class DeviceStatus(dict):
return True
if event.sub_id == 0x49:
# raw input event? just ignore it
# if event.address == 0x01, no idea what it is
# if event.address == 0x03, it's an actual input event
return True
if event.sub_id == 0x4B:
if event.address == 0x01:
_log.debug("device came online? %d", event.devnumber)
_log.debug("device came online %d", event.devnumber)
self._changed(alert=ALERT.LOW, reason='powered on')
else:
_log.warn("unknown event %s", event)