diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 349729c4..3e0c9b71 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -6,6 +6,11 @@ * src/tap/cable/usbblaster.c: Convert from libftdx helpers to libusb helpers. * src/tap/cable/ice100.c: Drop local help stub and use common libusb one. + + * src/tap/cable/generic_usbconn.h: Split help text out so sub-libusb drivers + can avoid manual string duplication. + * src/tap/cable/generic_usbconn.c: Use new libusb help string defines. + * src/tap/cable/ft2232.c: Likewise. 2010-06-24 Mike Frysinger diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index 1eaa88fb..1e4ba060 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -1944,12 +1944,14 @@ ft2232_usbcable_help (urj_log_level_t ll, const char *cablename) found: urj_log (ll, - _("Usage: cable %s [vid=VID] [pid=PID] [desc=DESC] [driver=DRIVER]\n" - "\n" "VID vendor ID (hex), defaults to %04X\n" - "PID product ID (hex), defaults to %04X\n" - "DESC Some string to match in description or serial no.\n" + _("Usage: cable %s %s [driver=DRIVER]\n" + "\n" "%s" "DRIVER usbconn driver, either ftdi-mpsse or ftd2xx-mpsse\n" - " defaults to %s if not specified\n" "\n"), cablename, + "\n" + "Default: vid=%x pid=%x driver=%s\n" + "\n"), + cablename, URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT, + URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC, conn->vid, conn->pid, DEFAULT_DRIVER); } diff --git a/urjtag/src/tap/cable/generic_usbconn.c b/urjtag/src/tap/cable/generic_usbconn.c index 60cfbac8..22141b26 100644 --- a/urjtag/src/tap/cable/generic_usbconn.c +++ b/urjtag/src/tap/cable/generic_usbconn.c @@ -166,12 +166,10 @@ void urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *cablename) { urj_log (ll, - _("Usage: cable %s [vid=VID] [pid=PID] [desc=DESC] [...]\n" - "\n" - "VID USB Device Vendor ID (hex, e.g. 0abc)\n" - "PID USB Device Product ID (hex, e.g. 0abc)\n" - "DESC Some string to match in description or serial no.\n" - "\n"), cablename); + _("Usage: cable %s %s\n" "\n%s\n"), + cablename, + URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT, + URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC); } int diff --git a/urjtag/src/tap/cable/generic_usbconn.h b/urjtag/src/tap/cable/generic_usbconn.h index 8dfc5ce5..8a0ddffd 100644 --- a/urjtag/src/tap/cable/generic_usbconn.h +++ b/urjtag/src/tap/cable/generic_usbconn.h @@ -37,9 +37,16 @@ int urj_tap_cable_generic_usbconn_connect (urj_cable_t *cable, const urj_param_t *params[]); void urj_tap_cable_generic_usbconn_done (urj_cable_t *cable); -void urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *name); void urj_tap_cable_generic_usbconn_free (urj_cable_t *cable); +void urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *name); +#define URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT \ + "[vid=VID] [pid=PID] [desc=DESC]" +#define URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC \ + "VID USB Device Vendor ID (hex, e.g. 0abc)\n" \ + "PID USB Device Product ID (hex, e.g. 0abc)\n" \ + "DESC Some string to match in description or serial no.\n" + #define URJ_DECLARE_USBCONN_CABLE(vid, pid, driver, name, cable) \ const urj_usbconn_cable_t urj_tap_cable_usbconn_##cable = { name, NULL, driver, vid, pid };