Skip to content

Commit 0ed70e5

Browse files
committed
make rgb detection generic
1 parent b4851df commit 0ed70e5

File tree

1 file changed

+7
-5
lines changed
  • src/hhd/controller/physical

1 file changed

+7
-5
lines changed

src/hhd/controller/physical/rgb.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
from hhd.controller import Consumer
99
from hhd.controller.base import Event, RgbLedEvent
1010

11+
LED_BASE = "/sys/class/leds/"
1112
LED_PATHS = [
12-
"/sys/class/leds/multicolor:chassis/",
13-
"/sys/class/leds/ayaneo:rgb:joystick_rings/",
13+
"multicolor:chassis",
14+
":rgb:joystick_rings",
1415
]
1516

1617
logger = logging.getLogger(__name__)
@@ -33,9 +34,10 @@ def read_sysfs(dir: str, fn: str, default: str | None = None):
3334

3435

3536
def get_led_path():
36-
for p in LED_PATHS:
37-
if os.path.exists(p):
38-
return p
37+
for fn in os.listdir(LED_BASE):
38+
for p in LED_PATHS:
39+
if p in fn:
40+
return os.path.join(LED_BASE, fn)
3941
return None
4042

4143

0 commit comments

Comments
 (0)