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, ...)
-l, --log-dir=<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);
}
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++;
case 'r':
debug_raw_data++;
break;
+ case 'u':
+ debug_usb++;
+ break;
default:
usage();
}
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)