Detect muOS board for keybindings
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user