@@ -154,8 +154,8 @@ static void g_bus_name_lost(GDBusConnection *conn, const char *name, void *userd
154
154
int main (int argc , char * * argv ) {
155
155
156
156
int opt ;
157
- const char * opts = "hVSB:i:p:c:" ;
158
- const struct option longopts [] = {
157
+ static const char * opts = "hVSB:i:p:c:" ;
158
+ static const struct option longopts [] = {
159
159
{ "help" , no_argument , NULL , 'h' },
160
160
{ "version" , no_argument , NULL , 'V' },
161
161
{ "syslog" , no_argument , NULL , 'S' },
@@ -164,6 +164,7 @@ int main(int argc, char **argv) {
164
164
{ "device" , required_argument , NULL , 'i' },
165
165
{ "profile" , required_argument , NULL , 'p' },
166
166
{ "codec" , required_argument , NULL , 'c' },
167
+ { "all-codecs" , no_argument , NULL , 25 },
167
168
{ "initial-volume" , required_argument , NULL , 17 },
168
169
{ "keep-alive" , required_argument , NULL , 8 },
169
170
{ "io-rt-priority" , required_argument , NULL , 3 },
@@ -200,6 +201,19 @@ int main(int argc, char **argv) {
200
201
{ 0 , 0 , 0 , 0 },
201
202
};
202
203
204
+ static const struct {
205
+ uint32_t codec_id ;
206
+ bool * ptr ;
207
+ } hfp_codecs [] = {
208
+ { HFP_CODEC_CVSD , & config .hfp .codecs .cvsd },
209
+ #if ENABLE_MSBC
210
+ { HFP_CODEC_MSBC , & config .hfp .codecs .msbc },
211
+ #endif
212
+ #if ENABLE_LC3_SWB
213
+ { HFP_CODEC_LC3_SWB , & config .hfp .codecs .lc3_swb },
214
+ #endif
215
+ };
216
+
203
217
bool syslog = false;
204
218
char dbus_service [32 ] = BLUEALSA_SERVICE ;
205
219
@@ -221,6 +235,7 @@ int main(int argc, char **argv) {
221
235
" -i, --device=hciX\t\tHCI device(s) to use\n"
222
236
" -p, --profile=NAME\t\tset enabled BT profiles\n"
223
237
" -c, --codec=NAME\t\tset enabled BT audio codecs\n"
238
+ " --all-codecs\t\t\tenable all available BT audio codecs\n"
224
239
" --initial-volume=NUM\t\tinitial volume level [0-100]\n"
225
240
" --keep-alive=SEC\t\tkeep Bluetooth transport alive\n"
226
241
" --io-rt-priority=NUM\t\treal-time priority for IO threads\n"
@@ -375,19 +390,6 @@ int main(int argc, char **argv) {
375
390
376
391
case 'c' /* --codec=NAME */ : {
377
392
378
- static const struct {
379
- uint32_t codec_id ;
380
- bool * ptr ;
381
- } hfp_codecs [] = {
382
- { HFP_CODEC_CVSD , & config .hfp .codecs .cvsd },
383
- #if ENABLE_MSBC
384
- { HFP_CODEC_MSBC , & config .hfp .codecs .msbc },
385
- #endif
386
- #if ENABLE_LC3_SWB
387
- { HFP_CODEC_LC3_SWB , & config .hfp .codecs .lc3_swb },
388
- #endif
389
- };
390
-
391
393
bool enable = true;
392
394
bool matched = false;
393
395
if (optarg [0 ] == '+' || optarg [0 ] == '-' ) {
@@ -418,6 +420,15 @@ int main(int argc, char **argv) {
418
420
break ;
419
421
}
420
422
423
+ case 25 /* --all-codecs */ : {
424
+ struct a2dp_sep * const * seps = a2dp_seps ;
425
+ for (struct a2dp_sep * sep = * seps ; sep != NULL ; sep = * ++ seps )
426
+ sep -> enabled = true;
427
+ for (size_t i = 0 ; i < ARRAYSIZE (hfp_codecs ); i ++ )
428
+ * hfp_codecs [i ].ptr = true;
429
+ break ;
430
+ }
431
+
421
432
case 17 /* --initial-volume=NUM */ : {
422
433
unsigned int vol = atoi (optarg );
423
434
if (vol > 100 ) {
0 commit comments