[Pcsclite-cvs-commit] r5077 - /trunk/Drivers/ccid/src/ccid_usb.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Jul 29 10:06:10 UTC 2010
Author: rousseau
Date: Thu Jul 29 10:06:02 2010
New Revision: 5077
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5077
Log:
libusb <= 1.0.8 does not implement a reference counter in
libusb_init()/libusb_exit() for the default context.
We then use our own and unique libusb context.
Modified:
trunk/Drivers/ccid/src/ccid_usb.c
Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=5077&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Thu Jul 29 10:06:02 2010
@@ -57,8 +57,10 @@
#define BUS_DEVICE_STRSIZE 32
-/* we use the default libusb context */
-#define ctx NULL
+/* Using the default libusb context */
+/* does not work for libusb <= 1.0.8 */
+/* #define ctx NULL */
+libusb_context *ctx = NULL;
typedef struct
{
@@ -272,7 +274,8 @@
for (; vendorID--;)
alias ^= keyValue[vendorID];
- libusb_init(ctx);
+ if (NULL == ctx)
+ libusb_init(&ctx);
cnt = libusb_get_device_list(ctx, &devs);
if (cnt < 0)
@@ -566,7 +569,8 @@
end:
if (usbDevice[reader_index].dev_handle == NULL)
{
- libusb_exit(ctx);
+ /* does not work for libusb <= 1.0.8 */
+ /* libusb_exit(ctx); */
return STATUS_NO_SUCH_DEVICE;
}
@@ -713,7 +717,8 @@
usbDevice[reader_index].interface);
(void)libusb_close(usbDevice[reader_index].dev_handle);
- libusb_exit(ctx);
+ /* does not work for libusb <= 1.0.8 */
+ /* libusb_exit(ctx); */
}
/* mark the resource unused */
More information about the Pcsclite-cvs-commit
mailing list