File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -990,6 +990,8 @@ void ptt_init (struct audio_s *audio_config_p)
990
990
for (ot = 0 ; ot < NUM_OCTYPES ; ot ++ ) {
991
991
if (audio_config_p -> achan [ch ].octrl [ot ].ptt_method == PTT_METHOD_HAMLIB ) {
992
992
if (ot == OCTYPE_PTT ) {
993
+ int err = -1 ;
994
+ int tries = 0 ;
993
995
994
996
/* For "AUTO" model, try to guess what is out there. */
995
997
@@ -1054,13 +1056,24 @@ void ptt_init (struct audio_s *audio_config_p)
1054
1056
rig [ch ][ot ]-> state .rigport .parm .serial .parity = RIG_PARITY_NONE ;
1055
1057
rig [ch ][ot ]-> state .rigport .parm .serial .handshake = RIG_HANDSHAKE_NONE ;
1056
1058
}
1057
- int err = rig_open (rig [ch ][ot ]);
1059
+ tries = 0 ;
1060
+ do {
1061
+ // Try up to 5 times, Hamlib can take a moment to finish init
1062
+ err = rig_open (rig [ch ][ot ]);
1063
+ if (++ tries > 5 ) {
1064
+ break ;
1065
+ } else if (err != RIG_OK ) {
1066
+ text_color_set (DW_COLOR_INFO );
1067
+ dw_printf ("Retrying Hamlib Rig open...\n" );
1068
+ sleep (5 );
1069
+ }
1070
+ } while (err != RIG_OK );
1058
1071
if (err != RIG_OK ) {
1059
1072
text_color_set (DW_COLOR_ERROR );
1060
1073
dw_printf ("Hamlib Rig open error %d: %s\n" , err , rigerror (err ));
1061
1074
rig_cleanup (rig [ch ][ot ]);
1062
1075
rig [ch ][ot ] = NULL ;
1063
- continue ;
1076
+ exit ( 1 ) ;
1064
1077
}
1065
1078
1066
1079
/* Successful. Later code should check for rig[ch][ot] not NULL. */
You can’t perform that action at this time.
0 commit comments