Skip to content

Commit 040c0d1

Browse files
committed
fix uniq check and strengthen
1 parent 2a7c726 commit 040c0d1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/hhd/controller/physical/evdev.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,13 @@ def list_evs(filter_valid: bool = False, fn: str = "/proc/bus/input/devices"):
199199
# we reverse it to little endian
200200
out["byte"][head.lower()] = bytes(reversed(arr))
201201
case "P":
202-
out["phys"] = line[len('P: Phys="') : -1]
202+
out["phys"] = line[len('P: Phys=') : ]
203203
case "S":
204204
if "Sysfs" in line:
205-
out["sysfs"] = line[len('S: Sysfs="') : -1]
205+
out["sysfs"] = line[len('S: Sysfs=') : ]
206+
case "U":
207+
if "Uniq" in line:
208+
out["uniq"] = line[len('U: Uniq=') :]
206209
case "H":
207210
if len(line) < len("H: Handlers=") + 1:
208211
continue

src/hhd/plugins/overlay/controllers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def find_devices(
257257
# Allow bluetooth controllers that contain uhid and phys, while
258258
# blocking hhd devices that contain uhid and a special mac address
259259
"uhid" in dev.get("sysfs", "")
260-
and "35:53:" in dev.get("uniq", "")
260+
and dev.get("uniq", "").startswith("35:53:")
261261
):
262262
continue
263263

@@ -610,7 +610,11 @@ def process_events(emit, dev, evs, allow_select=True):
610610
and ev.code in CONTROLLER_WAKE_BUTTON
611611
):
612612
process_ctrl(
613-
emit, dev["state_ctrl"], CONTROLLER_WAKE_BUTTON[ev.code], ev.value, allow_select=allow_select
613+
emit,
614+
dev["state_ctrl"],
615+
CONTROLLER_WAKE_BUTTON[ev.code],
616+
ev.value,
617+
allow_select=allow_select,
614618
)
615619

616620
if (

0 commit comments

Comments
 (0)