remote-evdev-python/test-evdev.py

36 lines
655 B
Python
Raw Permalink Normal View History

2022-07-21 18:56:54 +00:00
#!/usr/bin/env python3
import evdev
import sys
2022-07-21 19:23:47 +00:00
import glob
2022-07-21 18:56:54 +00:00
def test_uinput():
2022-07-21 19:23:47 +00:00
_uinput = evdev.UInput({}, name="test")
2022-07-21 18:56:54 +00:00
def test_input_device():
2022-07-21 19:23:47 +00:00
possible_devices = glob.glob("/dev/input/event*")
devices = evdev.list_devices()
for device in possible_devices:
if device not in devices:
print(f"Missing permissions for {device}")
2022-07-21 18:56:54 +00:00
def main():
args = sys.argv
args.append("")
match args[1]:
case "host":
test_input_device()
case "guest":
test_uinput()
case _:
test_input_device()
test_uinput()
if __name__ == "__main__":
main()