|
|
@ -55,19 +55,29 @@ class TypingPool(Bureau):
|
|
|
|
|
|
|
|
|
|
|
|
def run_io(self):
|
|
|
|
def run_io(self):
|
|
|
|
val = ""
|
|
|
|
val = ""
|
|
|
|
|
|
|
|
upper = 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()
|
|
|
|
|
|
|
|
# TODO: this is a bit messy / complex. break into one more function.
|
|
|
|
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:
|
|
|
|
if data.scancode == 28:
|
|
|
|
if data.scancode == 28:
|
|
|
|
print("sending barcode:", val)
|
|
|
|
print("sending barcode:", val)
|
|
|
|
|
|
|
|
self.send(val[0:2], val[2:])
|
|
|
|
val = ""
|
|
|
|
val = ""
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
val += KEYS[data.scancode]
|
|
|
|
new_key = KEYS[data.scancode]
|
|
|
|
|
|
|
|
if new_key == "LSHFT" or new_key == "RSHFT":
|
|
|
|
|
|
|
|
upper = True
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if upper:
|
|
|
|
|
|
|
|
new_key = new_key.upper()
|
|
|
|
|
|
|
|
upper = False
|
|
|
|
|
|
|
|
val += new_key
|
|
|
|
except KeyError:
|
|
|
|
except KeyError:
|
|
|
|
print("Error invalid keycode:", data.scancode)
|
|
|
|
print("Error invalid keycode:", data.scancode)
|
|
|
|
|
|
|
|
|
|
|
|