问题
I’m wondering if libusb_set_debug() works. I can’t get any output from it. I can turn on debug logging if I configure and build with --enable-debug-log. Should I get about the same output as enable-debug-log if I set libusb_set_debug() to 3? I don’t have the LIBUSB_DEBUG env variable set. I assume I’m missing something simple. Thanks,
回答1:
The libusb debugging options don't work as documented. How they actually work is like this:
If you configure with --enable-debug-log
then, when compiling, you unconditionally activate all DEBUG, INFO, WARNING and ERROR messages for all contexts.
If you configure with --disable-log
then, when compiling, you unconditionally deactivate all logging messages at all levels.
With debug-log disabled, and logging enabled (the default) then you can use libusb_set_debug to request INFO, WARNING and ERROR messages for particular contexts, but it is NOT possible to request DEBUG level messages, despite there being a logging level for it.
The author of libusb seems to consider this broken behaviour to be a feature, and does not plan to change it. See this: http://libusb.6.n5.nabble.com/does-libusb-set-debug-work-td7638.html#a7641
来源:https://stackoverflow.com/questions/8480388/libusb-1-0-debug-informations