mirror of
https://github.com/shadps4-emu/ext-libusb.git
synced 2026-01-31 00:55:21 +01:00
core: Allow setting global log callback after first libusb_init()
When setting LIBUSB_OPTION_LOG_CB before the first libusb_init(), the global callback is set. However, after the first libusb_init() there is a default context, and setting LIBUSB_OPTION_LOG_CB would only set this default context, and not the global callback. There would be no way to set the global callback through libusb_set_option(). Change this so that the global log callback is set in addition to the default context (when libusb_set_option is called with NULL context). Closes #1397
This commit is contained in:
committed by
Tormod Volden
parent
d09d341f41
commit
a5483bc0f7
@@ -2327,16 +2327,14 @@ int API_EXPORTEDV libusb_set_option(libusb_context *ctx,
|
||||
default_context_options[option].arg.ival = arg;
|
||||
} else if (LIBUSB_OPTION_LOG_CB == option) {
|
||||
default_context_options[option].arg.log_cbval = log_cb;
|
||||
libusb_set_log_cb_internal(NULL, log_cb, LIBUSB_LOG_CB_GLOBAL);
|
||||
}
|
||||
usbi_mutex_static_unlock(&default_context_lock);
|
||||
}
|
||||
|
||||
ctx = usbi_get_context(ctx);
|
||||
if (NULL == ctx) {
|
||||
if (LIBUSB_OPTION_LOG_CB == option)
|
||||
libusb_set_log_cb_internal(NULL, log_cb, LIBUSB_LOG_CB_GLOBAL);
|
||||
if (NULL == ctx)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (option) {
|
||||
case LIBUSB_OPTION_LOG_LEVEL:
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 11875
|
||||
#define LIBUSB_NANO 11876
|
||||
|
||||
Reference in New Issue
Block a user