From bd8d061d0f63158b5b03814d77cb76fdf5a0abad Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 17 May 2013 03:27:20 -0700 Subject: libaltos: Build the linux library targets when doing a 'fat' build These are necessary for the fat release, so make sure they're built then. Signed-off-by: Keith Packard --- libaltos/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libaltos') diff --git a/libaltos/Makefile.am b/libaltos/Makefile.am index b5ab1ddb..41549558 100644 --- a/libaltos/Makefile.am +++ b/libaltos/Makefile.am @@ -42,7 +42,7 @@ MINGCC64=x86_64-w64-mingw32-gcc MINGFLAGS=-Wall -DWINDOWS -DBUILD_DLL -I$(JVM_INCLUDE) MINGLIBS=-lsetupapi -fat: altos.dll altos64.dll +fat: all altos.dll altos64.dll altos.dll: $(libaltos_la_SOURCES) $(MINGCC32) -o $@ $(MINGFLAGS) -shared $(libaltos_la_SOURCES) $(MINGLIBS) -- cgit v1.2.3 From 6735a391c2a1e3be01ac9e68b44ec0974592c11c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 17 May 2013 03:34:50 -0700 Subject: libaltos: use PurgeComm in Windows altos_close to abort in-progress ops Instead of manually signalling the related events, use PurgeComm which can then abort the operations itself. Also make sure all of the relevant handles are set to INVALID before closing them to avoid race conditions. Signed-off-by: Keith Packard --- libaltos/libaltos.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'libaltos') diff --git a/libaltos/libaltos.c b/libaltos/libaltos.c index fc949c70..4a6363ed 100644 --- a/libaltos/libaltos.c +++ b/libaltos/libaltos.c @@ -994,6 +994,11 @@ log_message(char *fmt, ...) if (!log) log = fopen("\\temp\\altos.txt", "w"); if (log) { + SYSTEMTIME time; + GetLocalTime(&time); + fprintf (log, "%4d-%02d-%02d %2d:%02d:%02d. ", + time.wYear, time.wMonth, time.wDay, + time.wHour, time.wMinute, time.wSecond); va_start(a, fmt); vfprintf(log, fmt, a); va_end(a); @@ -1339,6 +1344,7 @@ altos_open(struct altos_device *device) file->handle = open_serial(full_name); if (file->handle != INVALID_HANDLE_VALUE) break; + altos_set_last_windows_error(); Sleep(100); } @@ -1373,13 +1379,19 @@ altos_open(struct altos_device *device) PUBLIC void altos_close(struct altos_file *file) { - if (file->handle != INVALID_HANDLE_VALUE) { - CloseHandle(file->handle); + HANDLE handle = file->handle; + if (handle != INVALID_HANDLE_VALUE) { + HANDLE ov_read = file->ov_read.hEvent; + HANDLE ov_write = file->ov_write.hEvent; + file->handle = INVALID_HANDLE_VALUE; + file->ov_read.hEvent = INVALID_HANDLE_VALUE; + file->ov_write.hEvent = INVALID_HANDLE_VALUE; + PurgeComm(handle, PURGE_RXABORT|PURGE_RXCLEAR|PURGE_TXABORT|PURGE_TXCLEAR); + Sleep(100); + CloseHandle(handle); file->handle = INVALID_HANDLE_VALUE; - SetEvent(file->ov_read.hEvent); - SetEvent(file->ov_write.hEvent); - CloseHandle(file->ov_read.hEvent); - CloseHandle(file->ov_write.hEvent); + CloseHandle(ov_read); + CloseHandle(ov_write); } } -- cgit v1.2.3 From 6545a72012e94a50d185e1c4ecff3c3769d60acd Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 10 Dec 2013 00:54:32 -0800 Subject: java: Missed libaltos java compile flags from previous patch Signed-off-by: Keith Packard --- libaltos/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libaltos') diff --git a/libaltos/Makefile.am b/libaltos/Makefile.am index 41549558..831432fc 100644 --- a/libaltos/Makefile.am +++ b/libaltos/Makefile.am @@ -1,6 +1,6 @@ JAVAC=javac AM_CFLAGS=-DLINUX -DPOSIX_TTY -I$(JVM_INCLUDE) -AM_JAVACFLAGS=-encoding UTF-8 +AM_JAVACFLAGS=-target 1.6 -encoding UTF-8 -Xlint:deprecation -source 6 altoslibdir=$(libdir)/altos -- cgit v1.2.3 From e2635d07d0f0a91dd7d59f2c94765a40907d2732 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 11:08:11 -0800 Subject: Ignore .dll files in libaltos Signed-off-by: Keith Packard --- libaltos/.gitignore | 1 + 1 file changed, 1 insertion(+) (limited to 'libaltos') diff --git a/libaltos/.gitignore b/libaltos/.gitignore index c490e6f8..6d043d60 100644 --- a/libaltos/.gitignore +++ b/libaltos/.gitignore @@ -3,6 +3,7 @@ *.la *.java *.class +*.dll .libs/ classlibaltos.stamp libaltos_wrap.c -- cgit v1.2.3 From 36197a388a9ba1d1ee4acd96ac0079ad3af9d3d0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 12:15:22 -0800 Subject: libaltos: fix test harness main type Signed-off-by: Keith Packard --- libaltos/cjnitest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libaltos') diff --git a/libaltos/cjnitest.c b/libaltos/cjnitest.c index f0fe78f7..3a65c3d6 100644 --- a/libaltos/cjnitest.c +++ b/libaltos/cjnitest.c @@ -10,7 +10,8 @@ altos_puts(struct altos_file *file, char *string) altos_putchar(file, c); } -main () +int +main (int argc, char **argv) { struct altos_device device; struct altos_list *list; -- cgit v1.2.3 From 0484ca97828da0d56be7bf395fa4a4b09c591e02 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 12:15:54 -0800 Subject: libaltos: remove usb id filtering from darwin code Signed-off-by: Keith Packard --- libaltos/libaltos.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'libaltos') diff --git a/libaltos/libaltos.c b/libaltos/libaltos.c index 4a6363ed..a623d5ae 100644 --- a/libaltos/libaltos.c +++ b/libaltos/libaltos.c @@ -53,6 +53,8 @@ altos_get_last_error(struct altos_error *error) #ifdef DARWIN +#include + #undef USE_POLL /* Mac OS X don't have strndup even if _GNU_SOURCE is defined */ @@ -887,15 +889,6 @@ altos_list_next(struct altos_list *list, struct altos_device *device) if (!get_number (object, CFSTR(kUSBVendorID), &device->vendor) || !get_number (object, CFSTR(kUSBProductID), &device->product)) continue; - if (list->ftdi) { - if (device->vendor != 0x0403) - continue; - } else { - if (device->vendor != 0xfffe) - continue; - if (device->product < 0x000a || 0x0013 < device->product) - continue; - } if (get_string (object, CFSTR("IOCalloutDevice"), device->path, sizeof (device->path)) && get_string (object, CFSTR("USB Product Name"), device->name, sizeof (device->name)) && get_string (object, CFSTR("USB Serial Number"), serial_string, sizeof (serial_string))) { -- cgit v1.2.3 From f2e589c59ed0a4c586c5accca8772df15010c46a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 12:16:55 -0800 Subject: libaltos: Import newly build libaltos.dylib --- libaltos/libaltos.dylib | Bin 41596 -> 41596 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'libaltos') diff --git a/libaltos/libaltos.dylib b/libaltos/libaltos.dylib index cfbd3f54..8b491c58 100755 Binary files a/libaltos/libaltos.dylib and b/libaltos/libaltos.dylib differ -- cgit v1.2.3