diff -up ./src/ccid_usb.c.max_cpu_bug ./src/ccid_usb.c --- ./src/ccid_usb.c.max_cpu_bug 2012-06-22 00:25:20.000000000 -0700 +++ ./src/ccid_usb.c 2016-06-29 17:17:11.284337349 -0700 @@ -154,6 +154,36 @@ status_t OpenUSB(unsigned int reader_ind } /* OpenUSB */ + /***************************************************************************** + * + * close_libusb_if_needed + * (pulled from upstream ccid_usb) + * + ****************************************************************************/ + static void close_libusb_if_needed(void) + { + int i, to_exit = TRUE; + + if (NULL == ctx) + return; + + /* if at least 1 reader is still in use we do not exit libusb */ + for (i=0; i