summaryrefslogtreecommitdiff
path: root/examples/detect.c
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 /examples/detect.c
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 'examples/detect.c')
-rw-r--r--examples/detect.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/detect.c b/examples/detect.c
index 393fd2c..8dba1b4 100644
--- a/examples/detect.c
+++ b/examples/detect.c
@@ -64,6 +64,21 @@ int main (int argc, char **argv)
LIBMTP_error_number_t err;
int i;
+ int opt;
+ extern int optind;
+ extern char *optarg;
+
+ while ((opt = getopt(argc, argv, "d")) != -1 ) {
+ switch (opt) {
+ case 'd':
+ LIBMTP_Set_Debug(9);
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
LIBMTP_Init();
fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");