From 128db1cdf6698aba09915bb7c044404f713755ef Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Fri, 12 May 2023 02:24:14 -0400 Subject: Install the package `sof-firmware` if required (#1811) --- archinstall/lib/hardware.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'archinstall/lib/hardware.py') diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index b95301f9..8d0fb74f 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -1,7 +1,7 @@ import os from functools import cached_property from pathlib import Path -from typing import Optional, Dict +from typing import Optional, Dict, List from .general import SysCommand from .networking import list_interfaces, enrich_iface_types @@ -169,3 +169,22 @@ class SysInfo: debug(f"System is not running in a VM: {err}") return False + + @staticmethod + def _loaded_modules() -> List[str]: + """ + Returns loaded kernel modules + """ + modules_path = Path('/proc/modules') + modules: List[str] = [] + + with modules_path.open() as file: + for line in file: + module = line.split(maxsplit=1)[0] + modules.append(module) + + return modules + + @staticmethod + def requires_sof() -> bool: + return 'snd_sof' in SysInfo._loaded_modules() -- cgit v1.2.3-54-g00ecf