From 9429fa22411636727d5609cb95ef4b05856348a5 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 13 Feb 2012 16:57:29 +0100 Subject: [PATCH] Added --debug-usb switch --- arexxd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arexxd.c b/arexxd.c index 00a36f8..ffd1b4c 100644 --- a/arexxd.c +++ b/arexxd.c @@ -29,6 +29,7 @@ static int use_syslog; static int debug_mode; static int debug_packets; static int debug_raw_data; +static int debug_usb; static char *log_dir = DEFAULT_LOG_DIR; static void die(char *fmt, ...) @@ -522,6 +523,7 @@ Options:\n\ -l, --log-dir= Directory where all received data should be stored\n\ -p, --debug-packets Log all packets sent and received\n\ -r, --debug-raw Log conversion from raw values\n\ +-u, --debug-usb Enable libusb debug messages (to stdout/stderr)\n\ "); exit(1); } @@ -529,7 +531,7 @@ Options:\n\ int main(int argc, char **argv) { int opt; - while ((opt = getopt_long(argc, argv, "dl:pr", long_options, NULL)) >= 0) + while ((opt = getopt_long(argc, argv, "dl:pru", long_options, NULL)) >= 0) switch (opt) { case 'd': debug_mode++; @@ -543,6 +545,9 @@ int main(int argc, char **argv) case 'r': debug_raw_data++; break; + case 'u': + debug_usb++; + break; default: usage(); } @@ -552,7 +557,8 @@ int main(int argc, char **argv) int err; if (err = libusb_init(&usb_ctxt)) die("Cannot initialize libusb: error %d", err); - // libusb_set_debug(usb_ctxt, 3); + if (debug_usb) + libusb_set_debug(usb_ctxt, 3); if (!debug_mode) { if (chdir(log_dir) < 0) -- 2.39.5