@@ -112,17 +112,25 @@ def __init__(self, gadget_path: str, profile_path: str, meta_path: str, eps: int
112
112
self .__msd_instance = 0
113
113
_mkdir (meta_path )
114
114
115
- def add_audio_mic (self , start : bool ) -> None :
115
+ def add_audio_devices (self , start : bool , enable_capture : bool ) -> None :
116
116
eps = 2
117
117
func = "uac2.usb0"
118
118
func_path = self .__create_function (func )
119
- _write (join (func_path , "c_chmask" ), 0 )
119
+
120
+ if enable_capture :
121
+ _write (join (func_path , "c_chmask" ), 0b11 )
122
+ _write (join (func_path , "c_srate" ), 48000 )
123
+ _write (join (func_path , "c_ssize" ), 2 )
124
+ else :
125
+ _write (join (func_path , "c_chmask" ), 0 )
126
+
120
127
_write (join (func_path , "p_chmask" ), 0b11 )
121
128
_write (join (func_path , "p_srate" ), 48000 )
122
129
_write (join (func_path , "p_ssize" ), 2 )
130
+
123
131
if start :
124
132
self .__start_function (func , eps )
125
- self .__create_meta (func , "Microphone " , eps )
133
+ self .__create_meta (func , "USB Audio " , eps )
126
134
127
135
def add_serial (self , start : bool ) -> None :
128
136
eps = 3
@@ -334,8 +342,8 @@ def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements,
334
342
gc .add_serial (cod .serial .start )
335
343
336
344
if cod .audio .enabled :
337
- logger .info ("===== Microphone =====" )
338
- gc .add_audio_mic (cod .audio .start )
345
+ logger .info ("===== Audio Devices =====" )
346
+ gc .add_audio_devices (cod .audio .start , cod . audio . enable_audio_capture )
339
347
340
348
logger .info ("===== Preparing complete =====" )
341
349
0 commit comments