|
|
@ -28,12 +28,16 @@ class TypingPool(Bureau):
|
|
|
|
|
|
|
|
|
|
|
|
self.devices = []
|
|
|
|
self.devices = []
|
|
|
|
self.active_devices = []
|
|
|
|
self.active_devices = []
|
|
|
|
|
|
|
|
devindex = {}
|
|
|
|
|
|
|
|
|
|
|
|
# add anything that smells like a keyboard
|
|
|
|
# add anything that smells like a keyboard
|
|
|
|
for dev in devices:
|
|
|
|
for dev in devices:
|
|
|
|
|
|
|
|
devkey = format(dev.info.vendor, '04x') + ":" +\
|
|
|
|
|
|
|
|
format(dev.info.product, '04x')
|
|
|
|
|
|
|
|
devindex[devkey] = dev
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if evdev.ecodes.KEY_A in dev.capabilities()[evdev.ecodes.EV_KEY]:
|
|
|
|
if evdev.ecodes.KEY_A in dev.capabilities()[evdev.ecodes.EV_KEY]:
|
|
|
|
print(dir(dev))
|
|
|
|
print("usb device:", dev.info)
|
|
|
|
print(dev.fn)
|
|
|
|
print(dev.fn)
|
|
|
|
self.devices.append(dev)
|
|
|
|
self.devices.append(dev)
|
|
|
|
except KeyError as err:
|
|
|
|
except KeyError as err:
|
|
|
@ -41,16 +45,24 @@ class TypingPool(Bureau):
|
|
|
|
|
|
|
|
|
|
|
|
# if we don't have any active KB so tell the user to config one
|
|
|
|
# if we don't have any active KB so tell the user to config one
|
|
|
|
if "active" in self.config:
|
|
|
|
if "active" in self.config:
|
|
|
|
# TODO: better error handling here
|
|
|
|
# self.active_devices = list(map(evdev.InputDevice,
|
|
|
|
self.active_devices = list(map(evdev.InputDevice,
|
|
|
|
# self.config["active"]["devices"].split()))
|
|
|
|
self.config["active"]["devices"].split()))
|
|
|
|
cfg_devs = self.config["active"]["devices"].split()
|
|
|
|
|
|
|
|
print("trying to grab keyboard devs:", cfg_devs)
|
|
|
|
|
|
|
|
print("device index", devindex)
|
|
|
|
|
|
|
|
for dev in cfg_devs:
|
|
|
|
|
|
|
|
if dev in devindex:
|
|
|
|
|
|
|
|
self.active_devices.append(devindex[dev])
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print("you need to configure input hardware!")
|
|
|
|
print("you need to configure input hardware!")
|
|
|
|
print("add one of the following devices to TY.ini under [active]")
|
|
|
|
print("add one of the following devices to TY.ini under [active]")
|
|
|
|
print(" devices = /dev/usb/kb1 /dev/input/whatever")
|
|
|
|
print(" devices = 0c45:7403 ")
|
|
|
|
print("available keyboard devices:")
|
|
|
|
print("available keyboard devices:")
|
|
|
|
for dev in self.devices:
|
|
|
|
for dev in self.devices:
|
|
|
|
print(dev.fn, ":", dev.name, dev.info)
|
|
|
|
print(dev.fn, ":", dev.name,
|
|
|
|
|
|
|
|
format(dev.info.vendor, '04x') + ":" +
|
|
|
|
|
|
|
|
format(dev.info.product, '04x'))
|
|
|
|
|
|
|
|
|
|
|
|
def run_io(self):
|
|
|
|
def run_io(self):
|
|
|
|
val = ""
|
|
|
|
val = ""
|
|
|
|