mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-02 22:01:50 +00:00
Replace usb_set_debug() in utils by new group in LIBNFC_LOG_LEVEL
To use it: (NFC_LOG_PRIORITY_DEBUG * 2 ^ NFC_LOG_GROUP_LIBUSB) LIBUSB_LOG_LEVEL=12288
This commit is contained in:
@@ -38,6 +38,16 @@ int usb_prepare(void)
|
||||
if (usb_initialized) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ENVVARS
|
||||
char *env_log_level = getenv("LIBNFC_LOG_LEVEL");
|
||||
// Set libusb debug only if asked explicitely:
|
||||
// LIBUSB_LOG_LEVEL=12288 (= NFC_LOG_PRIORITY_DEBUG * 2 ^ NFC_LOG_GROUP_LIBUSB)
|
||||
if (env_log_level && (((atoi(env_log_level) >> (NFC_LOG_GROUP_LIBUSB * 2)) & 0x00000003) >= NFC_LOG_PRIORITY_DEBUG)) {
|
||||
setenv("USB_DEBUG", "255", 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
usb_init();
|
||||
usb_initialized = true;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define NFC_LOG_GROUP_CHIP 3
|
||||
#define NFC_LOG_GROUP_DRIVER 4
|
||||
#define NFC_LOG_GROUP_COM 5
|
||||
#define NFC_LOG_GROUP_LIBUSB 6
|
||||
|
||||
/*
|
||||
To enable log only for one (or more) group, you can use this formula:
|
||||
|
||||
Reference in New Issue
Block a user