Merge branch 'la5nta-fix/kissattach_issue' into dev

This commit is contained in:
WB2OSZ 2016-03-20 22:32:30 -04:00
commit 8162648e57
1 changed files with 13 additions and 10 deletions

23
kiss.c
View File

@ -884,25 +884,28 @@ static int kiss_get (/* MYFDTYPE fd*/ void )
#else /* Linux/Cygwin version */ #else /* Linux/Cygwin version */
int n = 0; int n = 0;
fd_set fd_in;
int rc;
while ( n == 0 ) { while ( n == 0 ) {
/* Reading from master fd of the pty before the client has connected leads to trouble with kissattach. */
/* Use select to check if the slave has sent any data before trying to read from it. */
FD_ZERO(&fd_in);
rc = select(pt_master_fd + 1, &fd_in, NULL, &fd_in, NULL);
n = read(pt_master_fd, &ch, (size_t)1); if (rc == 0)
{
continue;
}
if (n != 1) { if (rc == MYFDERROR
|| (n = read(pt_master_fd, &ch, (size_t)1)) != 1)
{
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("\nError receiving kiss message from client application. Closing %s.\n\n", pt_slave_name); dw_printf ("\nError receiving kiss message from client application. Closing %s.\n\n", pt_slave_name);
perror (""); perror ("");
/* Message added between 1.1 beta test and final version 1.1 */
/* TODO: Determine root cause and find proper solution. */
dw_printf ("This is a known problem that sometimes shows up when using with kissattach.\n");
dw_printf ("There are a couple work-arounds described in the Dire Wolf User Guide\n");
dw_printf ("and the Raspberry Pi APRS documents.\n");
close (pt_master_fd); close (pt_master_fd);
pt_master_fd = MYFDERROR; pt_master_fd = MYFDERROR;