relay: report only missing keys
This commit is contained in:
parent
79a4e534d6
commit
4eddc80cd0
6
relay.py
6
relay.py
@ -198,7 +198,6 @@ if __name__ == '__main__':
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
data = evdev.categorize(event)
|
data = evdev.categorize(event)
|
||||||
print("Got key", data.scancode)
|
|
||||||
|
|
||||||
modifier = modifiers.get(data.scancode, None)
|
modifier = modifiers.get(data.scancode, None)
|
||||||
if modifier:
|
if modifier:
|
||||||
@ -209,18 +208,16 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
code = scan_to_hid.get(data.scancode, None)
|
code = scan_to_hid.get(data.scancode, None)
|
||||||
if code is None:
|
if code is None:
|
||||||
print("Ignoring unknown key")
|
print("Ignoring unknown key", data)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if data.keystate == data.key_down:
|
if data.keystate == data.key_down:
|
||||||
if len(keys_down) >= 6:
|
if len(keys_down) >= 6:
|
||||||
print("Ignoring key due to rollover")
|
print("Ignoring key due to rollover")
|
||||||
continue
|
continue
|
||||||
print("Adding key")
|
|
||||||
keys_down.add(code)
|
keys_down.add(code)
|
||||||
|
|
||||||
if data.keystate == data.key_up:
|
if data.keystate == data.key_up:
|
||||||
print("Removing key")
|
|
||||||
keys_down.remove(code)
|
keys_down.remove(code)
|
||||||
|
|
||||||
# Build the packet
|
# Build the packet
|
||||||
@ -229,5 +226,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
assert(len(packet) == 8)
|
assert(len(packet) == 8)
|
||||||
|
|
||||||
print("Sending", packet)
|
|
||||||
os.write(dst, bytes(packet))
|
os.write(dst, bytes(packet))
|
||||||
|
Loading…
Reference in New Issue
Block a user