Misc fixes
authorPete Batard <pete@akeo.ie>
Wed, 15 May 2013 15:34:01 +0000 (17:34 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 08:55:13 +0000 (10:55 +0200)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/core.c
libusb/os/darwin_usb.c
libusb/os/linux_usbfs.c
libusb/version_nano.h

index 93f5060..280bb21 100644 (file)
@@ -1074,7 +1074,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
 
        r = usbi_backend->open(_handle);
        if (r < 0) {
-               usbi_dbg("could not open device: %s", libusb_error_name(r));
+               usbi_dbg("open %d.%d returns %d", dev->bus_number, dev->device_address, r);
                libusb_unref_device(dev);
                usbi_mutex_destroy(&_handle->lock);
                free(_handle);
@@ -1163,7 +1163,7 @@ static void do_close(struct libusb_context *ctx,
        /* safe iteration because transfers may be being deleted */
        list_for_each_entry_safe(itransfer, tmp, &ctx->flying_transfers, list, struct usbi_transfer) {
                struct libusb_transfer *transfer =
-                       USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
+                       USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
 
                if (transfer->dev_handle != dev_handle)
                        continue;
@@ -1782,6 +1782,10 @@ int API_EXPORTED libusb_init(libusb_context **context)
 
        if (context) {
                *context = ctx;
+       } else if (!usbi_default_context) {
+               usbi_dbg("created default context");
+               usbi_default_context = ctx;
+               default_context_refcnt++;
        }
        usbi_mutex_static_unlock(&default_context_lock);
 
@@ -2023,7 +2027,7 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
 }
 
 /** \ingroup misc
- * Returns a constant NULL-terminated string with the ASCII name of a libusb
+ * Returns a constant NULL-terminated string with the ASCII name of a libusbx
  * error or transfer status code. The caller must not free() the returned
  * string.
  *
index cdc88a4..bbba3f2 100644 (file)
@@ -401,7 +401,7 @@ static void *darwin_event_thread_main (void *arg0) {
   darwin_clear_iterator (libusb_rem_device_iterator);
   darwin_clear_iterator (libusb_add_device_iterator);
 
-  usbi_dbg ("thread ready to receive events");
+  usbi_dbg ("darwin event thread ready to receive events");
 
   /* signal the main thread that the hotplug runloop has been created. */
   pthread_mutex_lock (&libusb_darwin_at_mutex);
@@ -412,7 +412,7 @@ static void *darwin_event_thread_main (void *arg0) {
   /* run the runloop */
   CFRunLoopRun();
 
-  usbi_dbg ("thread exiting");
+  usbi_dbg ("darwin event thread exiting");
 
   /* remove the notification cfsource */
   CFRunLoopRemoveSource(runloop, libusb_notification_cfsource, kCFRunLoopDefaultMode);
index b5a8499..5a71e09 100644 (file)
@@ -1851,7 +1851,8 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer,
                urb->type = urb_type;
                urb->endpoint = transfer->endpoint;
                urb->buffer = transfer->buffer + (i * bulk_buffer_len);
-               if (use_bulk_continuation && !is_out && (i != num_urbs - 1))
+               /* don't set the short not ok flag for the last URB */
+               if (use_bulk_continuation && !is_out && (i < num_urbs - 1))
                        urb->flags = USBFS_URB_SHORT_NOT_OK;
                if (i == num_urbs - 1 && last_urb_partial)
                        urb->buffer_length = transfer->length % bulk_buffer_len;
index a863160..1e793fa 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10668
+#define LIBUSB_NANO 10669