@@ -112,17 +112,22 @@ 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
+ if enable_capture :
120
+ _write (join (func_path , "c_chmask" ), 0b11 )
121
+ _write (join (func_path , "c_srate" ), 48000 )
122
+ _write (join (func_path , "c_ssize" ), 2 )
123
+ else :
124
+ _write (join (func_path , "c_chmask" ), 0 )
120
125
_write (join (func_path , "p_chmask" ), 0b11 )
121
126
_write (join (func_path , "p_srate" ), 48000 )
122
127
_write (join (func_path , "p_ssize" ), 2 )
123
128
if start :
124
129
self .__start_function (func , eps )
125
- self .__create_meta (func , "Microphone " , eps )
130
+ self .__create_meta (func , "USB Audio " , eps )
126
131
127
132
def add_serial (self , start : bool ) -> None :
128
133
eps = 3
@@ -334,8 +339,8 @@ def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements,
334
339
gc .add_serial (cod .serial .start )
335
340
336
341
if cod .audio .enabled :
337
- logger .info ("===== Microphone =====" )
338
- gc .add_audio_mic (cod .audio .start )
342
+ logger .info ("===== Audio Devices =====" )
343
+ gc .add_audio_devices (cod .audio .start , cod . audio . enable_audio_capture )
339
344
340
345
logger .info ("===== Preparing complete =====" )
341
346
0 commit comments