aboutsummaryrefslogtreecommitdiff
path: root/src/libmtp.h.in
diff options
context:
space:
mode:
authornicklas79 <nicklas79>2009-09-28 18:19:34 +0000
committernicklas79 <nicklas79>2009-09-28 18:19:34 +0000
commitdaadbf2e26eca84c9d250f0e09d9efbe2c70d77a (patch)
treee38fea9dffb0cc3dbfc999253d156cf73ca74762 /src/libmtp.h.in
parentaac4729a1797831465f3d45b840e22749fbf1095 (diff)
downloadlibmtp-daadbf2e26eca84c9d250f0e09d9efbe2c70d77a.tar.gz
Add a new function to API to enable debug mode
To avoid build and build only to enable (or disable) debug mode, we work now as the lib libusb :) As libusb, you can do : LIBMTP_Set_Debug(flags); or use an environnement variable : export LIBMTP_DEBUG=flags flags value details : * 0x00 [0000 0000] : no debug (default) * 0x01 [0000 0001] : PTP debug * 0x02 [0000 0010] : Playlist debug * 0x04 [0000 0100] : USB debug * 0x08 [0000 1000] : USB data debug
Diffstat (limited to 'src/libmtp.h.in')
-rw-r--r--src/libmtp.h.in26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libmtp.h.in b/src/libmtp.h.in
index 12f657d..f2f61f2 100644
--- a/src/libmtp.h.in
+++ b/src/libmtp.h.in
@@ -56,6 +56,29 @@ typedef unsigned __int64 uint64_t;
#include <usb.h>
#include <stdint.h>
+
+/**
+ * Info macro
+ */
+#define LIBMTP_INFO(format, args...) \
+ do { \
+ if (LIBMTP_debug != 0) \
+ fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
+ else \
+ fprintf(stdout, format, ##args); \
+ } while (0)
+
+/**
+ * Error macro
+ */
+#define LIBMTP_ERROR(format, args...) \
+ do { \
+ if (LIBMTP_debug != 0) \
+ fprintf(stderr, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
+ else \
+ fprintf(stderr, format, ##args); \
+ } while (0)
+
/**
* @defgroup types libmtp global type definitions
* @{
@@ -724,10 +747,13 @@ struct LIBMTP_devicestorage_struct {
extern "C" {
#endif
+extern int LIBMTP_debug;
+
/**
* @defgroup internals The libmtp internals API.
* @{
*/
+void LIBMTP_Set_Debug(int);
void LIBMTP_Init(void);
int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const);
/**