diff options
-rw-r--r-- | src/libmtp.c | 4 | ||||
-rw-r--r-- | src/libmtp.h.in | 15 | ||||
-rw-r--r-- | src/libusb-glue.c | 2 | ||||
-rw-r--r-- | src/libusb-glue.h | 4 | ||||
-rw-r--r-- | src/playlist-spl.c | 2 |
5 files changed, 21 insertions, 6 deletions
diff --git a/src/libmtp.c b/src/libmtp.c index e2d0408..ff7e76a 100644 --- a/src/libmtp.c +++ b/src/libmtp.c @@ -67,7 +67,7 @@ * 0x04 [0000 0100] : USB debug * 0x08 [0000 1000] : USB data debug */ -int LIBMTP_debug = 0; +int LIBMTP_debug = LIBMTP_DEBUG_NONE; /* @@ -1656,7 +1656,7 @@ __attribute__((__format__(printf,2,0))) #endif LIBMTP_ptp_debug(void *data, const char *format, va_list args) { - if ((LIBMTP_debug & 0x01) != 0) { + if ((LIBMTP_debug & LIBMTP_DEBUG_PTP) != 0) { vfprintf (stderr, format, args); fflush (stderr); } diff --git a/src/libmtp.h.in b/src/libmtp.h.in index f2f61f2..ce67d04 100644 --- a/src/libmtp.h.in +++ b/src/libmtp.h.in @@ -82,6 +82,21 @@ typedef unsigned __int64 uint64_t; /** * @defgroup types libmtp global type definitions * @{ + */ + +/** + * The debug flags defined here are the external flags used + * by the libmtp library interface. + */ +#define LIBMTP_DEBUG_NONE 0x00 +#define LIBMTP_DEBUG_PTP 0x01 +#define LIBMTP_DEBUG_PLST 0x02 +#define LIBMTP_DEBUG_USB 0x04 +#define LIBMTP_DEBUG_DATA 0x08 +#define LIBMTP_DEBUG_ALL 0xFF + + +/** * The filetypes defined here are the external types used * by the libmtp library interface. The types used internally * as PTP-defined enumerator types is something different. diff --git a/src/libusb-glue.c b/src/libusb-glue.c index 7dfd223..6006d04 100644 --- a/src/libusb-glue.c +++ b/src/libusb-glue.c @@ -136,7 +136,7 @@ static struct usb_bus* init_usb() * Some additional libusb debugging please. * We use the same level debug between MTP and USB. */ - if ((LIBMTP_debug & 0x04) != 0) + if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) usb_set_debug(9); usb_init(); diff --git a/src/libusb-glue.h b/src/libusb-glue.h index 862f72a..db41d83 100644 --- a/src/libusb-glue.h +++ b/src/libusb-glue.h @@ -45,13 +45,13 @@ extern "C" { */ #define LIBMTP_USB_DEBUG(format, args...) \ do { \ - if ((LIBMTP_debug & 0x04) != 0) \ + if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) \ fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \ } while (0) #define LIBMTP_USB_DATA(buffer, length, base) \ do { \ - if ((LIBMTP_debug & 0x08) != 0) \ + if ((LIBMTP_debug & LIBMTP_DEBUG_DATA) != 0) \ data_dump_ascii (stdout, buffer, length, base); \ } while (0) diff --git a/src/playlist-spl.c b/src/playlist-spl.c index e6e736c..d4d5be1 100644 --- a/src/playlist-spl.c +++ b/src/playlist-spl.c @@ -48,7 +48,7 @@ */ #define LIBMTP_PLST_DEBUG(format, args...) \ do { \ - if ((LIBMTP_debug & 0x02) != 0) \ + if ((LIBMTP_debug & LIBMTP_DEBUG_PLST) != 0) \ fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \ } while (0) |