Finish basic UI, add type detection

This commit is contained in:
Marc Riera Irigoyen 2022-10-12 17:16:58 +02:00
parent 5a8522d05a
commit 25ba4cdbc0
6 changed files with 45 additions and 12 deletions

13
handlers/config.py Normal file
View file

@ -0,0 +1,13 @@
class ConfigHandler:
def __init__(self):
super().__init__()
def load():
return
def save():
return
def update():
return

View file

@ -1,3 +1,4 @@
from enum import Enum
from evdev import InputDevice, list_devices, ecodes as e, UInput, AbsInfo
class GamepadHandler:
@ -13,12 +14,24 @@ class GamepadHandler:
class Gamepad:
class GamepadType(Enum):
UNKNOWN = 0
CLASSIC = 1
NSWITCH = 2
def __init__(self, vid, pid, name):
super().__init__()
self.vid = vid
self.pid = pid
self.name = name
self.type = self.get_gamepad_type(vid, pid)
self.config = None
def get_gamepad_type(self, vid, pid):
match vid, pid:
case 0x0f0d, 0x00c1:
return self.GamepadType.NSWITCH
return self.GamepadType.UNKNOWN
""" cap = {
e.EV_KEY : [e.BTN_NORTH, e.BTN_SOUTH, e.BTN_EAST, e.BTN_WEST, e.BTN_SELECT, e.BTN_START],