diff --git a/src/main.c b/src/main.c index f80ee2e8f..94d03eba4 100644 --- a/src/main.c +++ b/src/main.c @@ -1171,6 +1171,7 @@ int main(int argc, char * argv []) // 3) -P usb:[usbvid]:[usbpid] // 4) -P usb:[usbvid]:[usbpid]:[sernum] bool print_ports = true; + SERIALADAPTER *ser = NULL; if (pgm->conntype == CONNTYPE_SERIAL) { char *portdup = cfg_strdup(__func__, port); char *port_tok[4]; @@ -1188,7 +1189,7 @@ int main(int argc, char * argv []) // Use libserialport to find the actual serial port const char *seradapter; - SERIALADAPTER *ser = locate_programmer_set(programmers, port_tok[0], &seradapter); + ser = locate_programmer_set(programmers, port_tok[0], &seradapter); if (is_serialadapter(ser)) { int rv = setport_from_serialadapter(&port, ser, port_tok[1]); if (rv == -1) { @@ -1240,14 +1241,17 @@ int main(int argc, char * argv []) imsg_notice("Overriding Baud Rate : %d\n", baudrate); pgm->baudrate = baudrate; } - + else if (ser->baudrate) { + imsg_notice("Default Baud Rate : %d\n", ser->baudrate); + pgm->baudrate = ser->baudrate; + } if (bitclock != 0.0) { imsg_notice("Setting bit clk period : %.1f\n", bitclock); pgm->bitclock = bitclock * 1e-6; } if (ispdelay != 0) { - imsg_notice("Setting isp clock delay : %3i\n", ispdelay); + imsg_notice("Setting isp clock delay : %3i\n", ispdelay); pgm->ispdelay = ispdelay; }