@@ -197,6 +197,7 @@ int main (int argc, char *argv[])
197
197
char input_file [80 ];
198
198
char T_opt_timestamp [40 ];
199
199
200
+ int chan = 0 ; /* default audio chanel */
200
201
int t_opt = 1 ; /* Text color option. */
201
202
int a_opt = 0 ; /* "-a n" interval, in seconds, for audio statistics report. 0 for none. */
202
203
@@ -352,7 +353,7 @@ int main (int argc, char *argv[])
352
353
353
354
/* ':' following option character means arg is required. */
354
355
355
- c = getopt_long (argc , argv , "P:B:D:c:pxr :b:n:d:q:t:Ul:L:Sa:E:T:" ,
356
+ c = getopt_long (argc , argv , "P:B:D:c:pr :b:n:d:q:t:x :Ul:L:Sa:E:T:" ,
356
357
long_options , & option_index );
357
358
if (c == -1 )
358
359
break ;
@@ -422,7 +423,14 @@ int main (int argc, char *argv[])
422
423
423
424
case 'x' : /* -x for transmit calibration tones. */
424
425
425
- xmit_calibrate_option = 1 ;
426
+ chan = atoi (optarg );
427
+ if ( chan > 1 ) {
428
+ text_color_set (DW_COLOR_ERROR );
429
+ dw_printf ("-x option, audio chanel, is out of range.\n" );
430
+ exit (EXIT_FAILURE );
431
+ }
432
+ else
433
+ xmit_calibrate_option = 1 ;
426
434
break ;
427
435
428
436
case 'r' : /* -r audio samples/sec. e.g. 44100 */
@@ -760,13 +768,17 @@ int main (int argc, char *argv[])
760
768
*/
761
769
762
770
if (xmit_calibrate_option ) {
771
+ if (chan > audio_config .adev [0 ].num_channels - 1 ) {
772
+ text_color_set (DW_COLOR_ERROR );
773
+ dw_printf ("-x option, audio chanel %d, is out of range.\n" , chan );
774
+ exit (EXIT_FAILURE );
775
+ }
763
776
764
777
int max_duration = 60 ; /* seconds */
765
778
int n = audio_config .achan [0 ].baud * max_duration ;
766
- int chan = 0 ;
767
779
768
780
text_color_set (DW_COLOR_INFO );
769
- dw_printf ("\nSending transmit calibration tones. Press control-C to terminate.\n" );
781
+ dw_printf ("\nSending transmit calibration tones to channel %d . Press control-C to terminate.\n" , chan );
770
782
771
783
ptt_set (OCTYPE_PTT , chan , 1 );
772
784
while (n -- > 0 ) {
@@ -1280,7 +1292,7 @@ static void usage (char **argv)
1280
1292
#else
1281
1293
dw_printf (" -p Enable pseudo terminal for KISS protocol.\n" );
1282
1294
#endif
1283
- dw_printf (" -x Send Xmit level calibration tones.\n" );
1295
+ dw_printf (" -x n Send Xmit level calibration tones. Channel 1 or 0 \n" );
1284
1296
dw_printf (" -U Print UTF-8 test string and exit.\n" );
1285
1297
dw_printf (" -S Print symbol tables and exit.\n" );
1286
1298
dw_printf (" -T fmt Time stamp format for sent and received frames.\n" );
0 commit comments