Skip to content

Commit 4198182

Browse files
pbatardjwrdegoede
authored andcommitted
Misc fixes
Signed-off-by: Hans de Goede <[email protected]>
1 parent a1b0ae5 commit 4198182

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

libusb/core.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
10741074

10751075
r = usbi_backend->open(_handle);
10761076
if (r < 0) {
1077-
usbi_dbg("could not open device: %s", libusb_error_name(r));
1077+
usbi_dbg("open %d.%d returns %d", dev->bus_number, dev->device_address, r);
10781078
libusb_unref_device(dev);
10791079
usbi_mutex_destroy(&_handle->lock);
10801080
free(_handle);
@@ -1163,7 +1163,7 @@ static void do_close(struct libusb_context *ctx,
11631163
/* safe iteration because transfers may be being deleted */
11641164
list_for_each_entry_safe(itransfer, tmp, &ctx->flying_transfers, list, struct usbi_transfer) {
11651165
struct libusb_transfer *transfer =
1166-
USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1166+
USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
11671167

11681168
if (transfer->dev_handle != dev_handle)
11691169
continue;
@@ -1782,6 +1782,10 @@ int API_EXPORTED libusb_init(libusb_context **context)
17821782

17831783
if (context) {
17841784
*context = ctx;
1785+
} else if (!usbi_default_context) {
1786+
usbi_dbg("created default context");
1787+
usbi_default_context = ctx;
1788+
default_context_refcnt++;
17851789
}
17861790
usbi_mutex_static_unlock(&default_context_lock);
17871791

@@ -2023,7 +2027,7 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
20232027
}
20242028

20252029
/** \ingroup misc
2026-
* Returns a constant NULL-terminated string with the ASCII name of a libusb
2030+
* Returns a constant NULL-terminated string with the ASCII name of a libusbx
20272031
* error or transfer status code. The caller must not free() the returned
20282032
* string.
20292033
*

libusb/os/darwin_usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static void *darwin_event_thread_main (void *arg0) {
401401
darwin_clear_iterator (libusb_rem_device_iterator);
402402
darwin_clear_iterator (libusb_add_device_iterator);
403403

404-
usbi_dbg ("thread ready to receive events");
404+
usbi_dbg ("darwin event thread ready to receive events");
405405

406406
/* signal the main thread that the hotplug runloop has been created. */
407407
pthread_mutex_lock (&libusb_darwin_at_mutex);
@@ -412,7 +412,7 @@ static void *darwin_event_thread_main (void *arg0) {
412412
/* run the runloop */
413413
CFRunLoopRun();
414414

415-
usbi_dbg ("thread exiting");
415+
usbi_dbg ("darwin event thread exiting");
416416

417417
/* remove the notification cfsource */
418418
CFRunLoopRemoveSource(runloop, libusb_notification_cfsource, kCFRunLoopDefaultMode);

libusb/os/linux_usbfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,8 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer,
18511851
urb->type = urb_type;
18521852
urb->endpoint = transfer->endpoint;
18531853
urb->buffer = transfer->buffer + (i * bulk_buffer_len);
1854-
if (use_bulk_continuation && !is_out && (i != num_urbs - 1))
1854+
/* don't set the short not ok flag for the last URB */
1855+
if (use_bulk_continuation && !is_out && (i < num_urbs - 1))
18551856
urb->flags = USBFS_URB_SHORT_NOT_OK;
18561857
if (i == num_urbs - 1 && last_urb_partial)
18571858
urb->buffer_length = transfer->length % bulk_buffer_len;

libusb/version_nano.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define LIBUSB_NANO 10668
1+
#define LIBUSB_NANO 10669

0 commit comments

Comments
 (0)