diff --git a/libuuu/bmap.cpp b/libuuu/bmap.cpp index adf6446b..c2cbfdf4 100644 --- a/libuuu/bmap.cpp +++ b/libuuu/bmap.cpp @@ -6,8 +6,6 @@ #include "libcomm.h" #include "libuuu.h" -extern int g_verbose; - bmap_mode g_bmap_mode = bmap_mode::Default; bmap_mode uuu_get_bmap_mode() @@ -160,7 +158,7 @@ bool load_bmap(const std::string& filename, bmap_t& bmap) return -1; } - if (g_verbose) { + if (get_libuuu_debug_level() > LIBUUU_NORMAL) { auto info = std::string("\nUsing block map:") + "\n ImageSize: " + std::to_string(bmap.image_size()) + "\n BlockSize: " + std::to_string(bmap.block_size()) + diff --git a/libuuu/error.cpp b/libuuu/error.cpp index 6d8b567a..3c23a3a9 100644 --- a/libuuu/error.cpp +++ b/libuuu/error.cpp @@ -49,6 +49,11 @@ int get_libusb_debug_level() noexcept return g_debug_level & 0xFFFF; } +int get_libuuu_debug_level() noexcept +{ + return g_debug_level & 0xFFFF0000; +} + void uuu_set_debug_level(uint32_t mask) { g_debug_level = mask; diff --git a/libuuu/libcomm.h b/libuuu/libcomm.h index c9a9bd6b..5e5dacdc 100644 --- a/libuuu/libcomm.h +++ b/libuuu/libcomm.h @@ -46,6 +46,7 @@ void call_notify(struct uuu_notify nf); #define dbg printf int get_libusb_debug_level() noexcept; +int get_libuuu_debug_level() noexcept; class string_ex : public std::string { diff --git a/libuuu/libuuu.h b/libuuu/libuuu.h index 6f5a09f3..554f9d41 100644 --- a/libuuu/libuuu.h +++ b/libuuu/libuuu.h @@ -134,6 +134,12 @@ int uuu_set_wait_timeout(int timeout_in_seconds); int uuu_set_wait_next_timeout(int timeout_in_seconds); /*Set usb device polling period */ void uuu_set_poll_period(int period_in_milliseconds); + +enum LIBUUU_DEBUG_LEVEL +{ + LIBUUU_NORMAL = 0, + LIBUUU_DETAIL = 0x8 << 16, +}; /* * bit 0:15 for libusb * bit 16:31 for uuu diff --git a/uuu/uuu.cpp b/uuu/uuu.cpp index da716ef6..c1ad05af 100644 --- a/uuu/uuu.cpp +++ b/uuu/uuu.cpp @@ -960,11 +960,12 @@ int main(int argc, char **argv) else if (s == "-v") { g_verbose = 1; + uuu_set_debug_level(LIBUUU_DETAIL); } else if (s == "-V") { g_verbose = 1; - uuu_set_debug_level(2); + uuu_set_debug_level(LIBUUU_DETAIL | 2); }else if (s == "-dry") { dryrun = 1;