@@ -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 *
0 commit comments