Hallo Antonio Borneo:
I wanted to remove configuration option --enable-verbose-usb-comms from
configure.ac and replace it with a new run-time option --verbose-usb-comms in
the openocd executable.
My first thought for options.c was (see HAVE_LIBUSB1 below):
static const struct option long_options[] = {
{"help", no_argument, &help_flag, 1},
{"version", no_argument, &version_flag, 1},
{"debug", optional_argument, NULL, 'd'},
{"file", required_argument, NULL, 'f'},
{"search", required_argument, NULL, 's'},
{"log_output", required_argument, NULL, 'l'},
{"command", required_argument, NULL, 'c'},
#ifdef HAVE_LIBUSB1
{"verbose-usb-comms", no_argument, &enable_verbose_usb_comms, 1},
#endif
{NULL, 0, NULL, 0}
};
Where should I place variable 'enable_verbose_usb_comms'? It should be
accessible from options.c and from these modules:
opendous.c
arm-jtag-ew.c
openjtag.c
ti_icdi_usb.c
ulink.c
My first though was to place it in libusb_helper.h, but that header file is not
easily accessible from options.c .
I was only planning to convert code as follows:
From:
#ifdef _DEBUG_USB_COMMS_
opendous_debug_buffer(buffer, (scan_size + 7) / 8);
#endif
To:
if ( enable_verbose_usb_comms )
{
opendous_debug_buffer(buffer, (scan_size + 7) / 8);
}
The refactoring into libusb_helper.h & .c you mentioned is too extensive for a
first step.
Best regards,
rdiez