From 103ad64aa927fbcf42465399de413cfc1f942700 Mon Sep 17 00:00:00 2001 From: idgay Date: Wed, 6 Jun 2007 16:17:42 +0000 Subject: [PATCH] some C sdk bug fixes + Mac OS X support --- support/sdk/c/autoconf.h | 2 +- support/sdk/c/serialsource.c | 6 ++++-- support/sdk/c/sf.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/support/sdk/c/autoconf.h b/support/sdk/c/autoconf.h index 6c207b1f..82855083 100644 --- a/support/sdk/c/autoconf.h +++ b/support/sdk/c/autoconf.h @@ -1,4 +1,4 @@ -/* autoconf.h. Generated by configure. */ +/* autoconf.h. Generated from autoconf.h.in by configure. */ /* autoconf.h.in. Generated from configure.ac by autoheader. */ /* Name of package */ diff --git a/support/sdk/c/serialsource.c b/support/sdk/c/serialsource.c index 5f777f30..1b892b79 100644 --- a/support/sdk/c/serialsource.c +++ b/support/sdk/c/serialsource.c @@ -193,7 +193,9 @@ static void message(serial_source src, serial_source_msg msg) } /* Work around buggy usb serial driver (returns 0 when no data is - available, independent of the blocking/non-blocking mode) */ + available, independent of the blocking/non-blocking mode). + Mac OS X seems to like to do this too (at least with a Keyspan 49WG) +*/ static int buggyread(serial_source src, void *buffer, int n) { fd_set fds; @@ -206,7 +208,6 @@ static int buggyread(serial_source src, void *buffer, int n) { cnt = -1; errno = EAGAIN; - printf("foo\n"); } return cnt; } @@ -590,6 +591,7 @@ static void read_and_process(serial_source src) else { message(src, msg_bad_crc); + free(received); /* We don't lose sync here. If we did, garbage on the line at startup will cause loss of the first packet. */ continue; diff --git a/support/sdk/c/sf.c b/support/sdk/c/sf.c index b104c7d6..ada9bc5b 100644 --- a/support/sdk/c/sf.c +++ b/support/sdk/c/sf.c @@ -87,6 +87,7 @@ void rem_client(struct client_list **c) void new_client(int fd) { + fcntl(fd, F_SETFL, 0); if (init_sf_source(fd) < 0) close(fd); else -- 2.39.2