Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c15c3ee

Browse files
committedNov 13, 2015
Tested TXINH, fixed it
1 parent 42a2398 commit c15c3ee

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
 

‎hdlc_rec.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include <unistd.h>
4949
#include <errno.h>
5050
#include <string.h>
51+
#include <stdlib.h>
5152
#endif
5253

5354

@@ -644,7 +645,7 @@ static void dcd_change (int chan, int subchan, int state)
644645
int hdlc_rec_data_detect_any (int chan)
645646
{
646647
int subchan;
647-
int busy;
648+
int busy = 0;
648649

649650
assert (chan >= 0 && chan < MAX_CHANS);
650651

@@ -668,22 +669,20 @@ int hdlc_rec_data_detect_any (int chan)
668669
return (busy != 1);
669670
}
670671

671-
if (read (fd, stemp, 1) != 1) {
672+
char vtemp[2];
673+
if (read (fd, vtemp, 1) != 1) {
672674
int e = errno;
673675
text_color_set(DW_COLOR_ERROR);
674676
dw_printf ("Error getting GPIO %d value for TXINH\n", save_audio_config_p->achan[chan].txinh.gpio);
675677
dw_printf ("%s\n", strerror(e));
676678
}
677679
close (fd);
678680

679-
char vtemp[2];
680-
sprintf (vtemp, "%d", save_audio_config_p->achan[chan].txinh.invert);
681-
682-
if (!strcmp (stemp, vtemp)) busy = 1;
681+
if (atoi(vtemp) == save_audio_config_p->achan[chan].txinh.invert) busy = 1;
683682
}
684683
#endif
685684

686-
return (busy != 1);
685+
return (busy != 0);
687686

688687
} /* end hdlc_rec_data_detect_any */
689688

0 commit comments

Comments
 (0)
Please sign in to comment.