diff --git a/device.h b/device.h index f2cc8c5..2b11be2 100644 --- a/device.h +++ b/device.h @@ -59,6 +59,7 @@ struct device_breakpoint { #define DEVICE_FLAG_JTAG 0x01 /* default is SBW */ #define DEVICE_FLAG_LONG_PW 0x02 #define DEVICE_FLAG_TTY 0x04 /* default is USB */ +#define DEVICE_FLAG_FORCE_RESET 0x08 struct device_args { int flags; diff --git a/fet.c b/fet.c index 77933ac..f411096 100644 --- a/fet.c +++ b/fet.c @@ -978,7 +978,7 @@ int try_open(struct fet_device *dev, const struct device_args *args, if (do_configure(dev, args) < 0) return -1; - if (send_reset) { + if (send_reset || args->flags & DEVICE_FLAG_FORCE_RESET) { printc_dbg("Sending reset...\n"); if (xfer(dev, C_RESET, NULL, 0, 3, FET_RESET_ALL, 0, 0) < 0) printc_err("warning: fet: reset failed\n"); diff --git a/main.c b/main.c index ee6aefb..b2953b7 100644 --- a/main.c +++ b/main.c @@ -102,6 +102,8 @@ static void usage(const char *progname) " Override the device ID returned by the FET.\n" " --usb-list\n" " Show a list of available USB devices.\n" +" --force-reset\n" +" Force target reset in initialization sequence.\n" " --version\n" " Show copyright and version information.\n" "\n" @@ -169,6 +171,7 @@ static int parse_cmdline_args(int argc, char **argv, {"usb-list", 0, 0, 'I'}, {"version", 0, 0, 'V'}, {"long-password", 0, 0, 'P'}, + {"force-reset", 0, 0, 'R'}, {NULL, 0, 0, 0} }; int want_usb = 0; @@ -234,6 +237,10 @@ static int parse_cmdline_args(int argc, char **argv, args->devarg.flags |= DEVICE_FLAG_LONG_PW; break; + case 'R': + args->devarg.flags |= DEVICE_FLAG_FORCE_RESET; + break; + case '?': printc_err("Try --help for usage information.\n"); return -1;