diff options
author | Maxim Devaev <[email protected]> | 2025-01-18 21:57:48 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2025-01-18 21:57:48 +0200 |
commit | 78557b0c47f1b2bd7fac30d319ce957892aa34e9 (patch) | |
tree | 68eecc23ca71e44bc33662b24133041d47c19239 /kvmd | |
parent | e1e360563008b1e1742e4c6bfbe85869320b7881 (diff) | |
parent | f042ed38e0926557f475f58e8b904ccb1a8beade (diff) |
Merge branch 'mic'
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/__init__.py | 5 | ||||
-rw-r--r-- | kvmd/apps/otg/__init__.py | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 091319ca..5ad38d90 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -611,6 +611,11 @@ def _get_config_scheme() -> dict: "kvm_mac": Option("", type=valid_mac, if_empty=""), }, + "audio": { + "enabled": Option(False, type=valid_bool), + "start": Option(True, type=valid_bool), + }, + "drives": { "enabled": Option(False, type=valid_bool), "start": Option(True, type=valid_bool), diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py index f21fdf4e..c50626c0 100644 --- a/kvmd/apps/otg/__init__.py +++ b/kvmd/apps/otg/__init__.py @@ -112,6 +112,18 @@ class _GadgetConfig: self.__msd_instance = 0 _mkdir(meta_path) + def add_audio_capture(self, start: bool) -> None: + eps = 2 + func = "uac2.usb0" + func_path = self.__create_function(func) + _write(join(func_path, "c_chmask"), 0) + _write(join(func_path, "p_chmask"), 0b11) + _write(join(func_path, "p_srate"), 48000) + _write(join(func_path, "p_ssize"), 2) + if start: + self.__start_function(func, eps) + self.__create_meta(func, "Audio Capture", eps) + def add_serial(self, start: bool) -> None: eps = 3 func = "acm.usb0" @@ -295,6 +307,10 @@ def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements, logger.info("===== Serial =====") gc.add_serial(cod.serial.start) + if cod.audio.enabled: + logger.info("===== Audio Capture =====") + gc.add_audio_capture(cod.audio.start) + logger.info("===== Preparing complete =====") logger.info("Enabling the gadget ...") |