diff --git a/ChangeLog b/ChangeLog index 14f46334..3d9aaadb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-06-21 Rene Liebscher + + patch #8419 fix ftdi_syncbb hang with libftdi 1 + * ft245r.c: set pthread cancel type to asynchronous, reorder ftdi_usb_close/deinit + 2014-06-17 Rene Liebscher * avrftdi_private.h: added missing msg level for avrdude_message diff --git a/ft245r.c b/ft245r.c index b516fe59..323b6a2b 100644 --- a/ft245r.c +++ b/ft245r.c @@ -173,6 +173,7 @@ static void add_to_buf (unsigned char c) { } static void *reader (void *arg) { + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL); struct ftdi_context *handle = (struct ftdi_context *)(arg); unsigned char buf[0x1000]; int br, i; @@ -642,10 +643,10 @@ static void ft245r_close(PROGRAMMER * pgm) { // I think the switch to BB mode and back flushes the buffer. ftdi_set_bitmode(handle, 0, BITMODE_SYNCBB); // set Synchronous BitBang, all in puts ftdi_set_bitmode(handle, 0, BITMODE_RESET); // disable Synchronous BitBang + ftdi_usb_close(handle); + ftdi_deinit (handle); pthread_cancel(readerthread); pthread_join(readerthread, NULL); - ftdi_usb_close(handle); - ftdi_deinit (handle); // TODO this works with libftdi 0.20, but hangs with 1.0 free(handle); handle = NULL; }