evdev test

This commit is contained in:
dekuNukem
2025-08-23 13:07:28 +01:00
parent a6650c4393
commit 23b9b8f972
4 changed files with 27 additions and 6 deletions

View File

Binary file not shown.

View File

@@ -1,3 +1,9 @@
# print(this_device.name)
# print(this_cap)
# print(check_is_gamepad(this_cap))
# print("!!!!!!!!!!!!!!!!!!!!!!")
ABS_Z = 0x02
ABS_RX = 0x03
ABS_RY = 0x04

View File

@@ -32,7 +32,6 @@ SPI_MISO_MSG_TYPE_KB_LED_REQUEST = 129
SPI_MOSI_MAGIC = 0xde
SPI_MISO_MAGIC = 0xcd
PCARD_BUSY_PIN = 20
SLAVE_REQ_PIN = 16
@@ -109,5 +108,25 @@ PID_GENERIC_GAMEPORT_GAMEPAD = 7
PID_BBC_MICRO_JOYSTICK = 14
PID_RAW_USB_GAMEPAD = 127
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
print("hello world!")
for device in devices:
print(device.path, device.name, device.phys)
# import asyncio, evdev
# mouse = evdev.InputDevice('/dev/input/event0')
# keybd = evdev.InputDevice('/dev/input/event6')
# async def print_events(device):
# async for event in device.async_read_loop():
# empty = list(keyboard_event_spi_msg_template)
# xfer_when_not_busy(empty)
# print(device.path, evdev.categorize(event), sep=': ')
# for device in mouse, keybd:
# asyncio.ensure_future(print_events(device))
# loop = asyncio.get_event_loop()
# loop.run_forever()

View File

@@ -911,10 +911,6 @@ def get_input_devices():
dev_dict['is_mouse'] = True
if 'KEY_ENTER' in cap_str and "KEY_Y" in cap_str:
dev_dict['is_kb'] = True
# print(this_device.name)
# print(this_cap)
# print(check_is_gamepad(this_cap))
# print("!!!!!!!!!!!!!!!!!!!!!!")
if check_is_gamepad(this_cap):
dev_dict['is_gp'] = True
try: