Detect muOS board for keybindings

This commit is contained in:
2026-05-07 19:38:05 +02:00
parent 486fea38e7
commit 5233294b26
2 changed files with 79 additions and 4 deletions
+15
View File
@@ -1,5 +1,6 @@
# This file contains the Controls class, which is responsible for handling user input.
import configparser
import json
import os
from pathlib import Path
@@ -79,6 +80,20 @@ def _profile_candidates(profile_name):
def _detect_linux_hardware_profile():
muos_config_path = Path("/opt/muos/device/current/config.ini")
if muos_config_path.exists():
parser = configparser.ConfigParser()
try:
parser.read(muos_config_path, encoding="utf-8")
board_name = parser.get("board", "name", fallback="").strip().casefold()
except (configparser.Error, OSError):
board_name = ""
if "rg40xx" in board_name:
return "rg40xx", f"muos:{board_name}"
if "r36s" in board_name:
return "r36s", f"muos:{board_name}"
hints = []
for path_like in [
"/proc/device-tree/model",