Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152983355
D51224.id158212.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D51224.id158212.diff
View Options
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c
--- a/lib/libusb/libusb10.c
+++ b/lib/libusb/libusb10.c
@@ -177,24 +177,28 @@
*/
ctx->debug = 0;
}
- } else {
- /*
- * If the LIBUSB_OPTION_LOG_LEVEL is set, honor that.
- */
- for (int i = 0; i != num_options; i++) {
- if (option[i].option != LIBUSB_OPTION_LOG_LEVEL)
- continue;
+ }
- ctx->debug = (int)option[i].value.ival;
- if ((int64_t)ctx->debug == option[i].value.ival) {
- ctx->debug_fixed = 1;
- } else {
- free(ctx);
- return (LIBUSB_ERROR_INVALID_PARAM);
- }
- }
+ /*
+ * Set the default from default context then override by options
+ */
+ if (usbi_default_context) {
+ CTX_LOCK(usbi_default_context);
+ libusb_set_option(ctx, LIBUSB_OPTION_NO_DEVICE_DISCOVERY,
+ usbi_default_context->no_discovery);
+ /* libusb_set_option will check the if debug is fixed by
+ environment variable. If it is fixed, the override will not
+ take effect */
+ libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL,
+ usbi_default_context->debug);
+ libusb_set_option(ctx, LIBUSB_OPTION_LOG_CB,
+ usbi_default_context->log_cb);
+ CTX_UNLOCK(usbi_default_context);
}
+ for (int i = 0; i < num_options; i++)
+ libusb_set_option(ctx, option[i].option, option[i].value);
+
TAILQ_INIT(&ctx->pollfds);
TAILQ_INIT(&ctx->tr_done);
TAILQ_INIT(&ctx->hotplug_cbh);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 11:35 AM (10 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31765944
Default Alt Text
D51224.id158212.diff (1 KB)
Attached To
Mode
D51224: libusb: refactor the process of setting option when init the context.
Attached
Detach File
Event Timeline
Log In to Comment