|
|
@ -67,6 +67,7 @@ class TypingPool(Bureau):
|
|
|
|
def run_io(self):
|
|
|
|
def run_io(self):
|
|
|
|
val = ""
|
|
|
|
val = ""
|
|
|
|
upper = False
|
|
|
|
upper = False
|
|
|
|
|
|
|
|
ctrl = False
|
|
|
|
#TODO: this is crap, needs to be multi-threaded and have one
|
|
|
|
#TODO: this is crap, needs to be multi-threaded and have one
|
|
|
|
# such loop for each active device
|
|
|
|
# such loop for each active device
|
|
|
|
self.active_devices[0].grab()
|
|
|
|
self.active_devices[0].grab()
|
|
|
@ -74,7 +75,7 @@ class TypingPool(Bureau):
|
|
|
|
for ev in self.active_devices[0].read_loop():
|
|
|
|
for ev in self.active_devices[0].read_loop():
|
|
|
|
if ev.type == evdev.ecodes.EV_KEY:
|
|
|
|
if ev.type == evdev.ecodes.EV_KEY:
|
|
|
|
data = evdev.categorize(ev)
|
|
|
|
data = evdev.categorize(ev)
|
|
|
|
if data.keystate == 1:
|
|
|
|
if data.keystate == 1: # key-down
|
|
|
|
if data.scancode == 28:
|
|
|
|
if data.scancode == 28:
|
|
|
|
print("sending barcode:", val)
|
|
|
|
print("sending barcode:", val)
|
|
|
|
self.send(val[0:2], val[2:])
|
|
|
|
self.send(val[0:2], val[2:])
|
|
|
@ -82,15 +83,27 @@ class TypingPool(Bureau):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
new_key = KEYS[data.scancode]
|
|
|
|
new_key = KEYS[data.scancode]
|
|
|
|
if new_key == "LSHFT" or new_key == "RSHFT":
|
|
|
|
if ctrl and (new_key == "j"):
|
|
|
|
|
|
|
|
self.log.debug("ignoring line-feed")
|
|
|
|
|
|
|
|
elif new_key == "LSHFT" or new_key == "RSHFT":
|
|
|
|
upper = True
|
|
|
|
upper = True
|
|
|
|
|
|
|
|
elif new_key == "LCTRL" or new_key == "RCTRL":
|
|
|
|
|
|
|
|
ctrl = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if upper:
|
|
|
|
if upper:
|
|
|
|
new_key = new_key.upper()
|
|
|
|
new_key = new_key.upper()
|
|
|
|
upper = False
|
|
|
|
|
|
|
|
val += new_key
|
|
|
|
val += new_key
|
|
|
|
except KeyError:
|
|
|
|
except KeyError:
|
|
|
|
print("Error invalid keycode:", data.scancode)
|
|
|
|
print("Error invalid keycode:", data.scancode)
|
|
|
|
|
|
|
|
if data.keystate == 0: # key-up for mod-keys
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
new_key = KEYS[data.scancode]
|
|
|
|
|
|
|
|
if new_key == "LSHFT" or new_key == "RSHFT":
|
|
|
|
|
|
|
|
upper = False
|
|
|
|
|
|
|
|
if new_key == "LCTRL" or new_key == "RCTRL":
|
|
|
|
|
|
|
|
ctrl = False
|
|
|
|
|
|
|
|
except KeyError:
|
|
|
|
|
|
|
|
print("Error invalid keycode:", data.scancode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|