@@ -40,7 +40,7 @@ pub fn get_serial_port_info(
4040 } else if let Some ( serial) = & config. connection . serial {
4141 find_serial_port ( & ports, serial)
4242 } else {
43- let ( port, matches) = select_serial_port ( ports, config) ?;
43+ let ( port, matches) = select_serial_port ( ports, config, matches . confirm_port ) ?;
4444
4545 match & port. port_type {
4646 SerialPortType :: UsbPort ( usb_info) if !matches => {
@@ -202,6 +202,7 @@ const KNOWN_DEVICES: &[UsbDevice] = &[
202202fn select_serial_port (
203203 mut ports : Vec < SerialPortInfo > ,
204204 config : & Config ,
205+ force_confirm_port : bool ,
205206) -> Result < ( SerialPortInfo , bool ) , Error > {
206207 // Does this port match a known one?
207208 let matches = |port : & SerialPortInfo | match & port. port_type {
@@ -220,8 +221,12 @@ fn select_serial_port(
220221 . as_slice ( )
221222 {
222223 // There is a unique recognized device.
223- Ok ( ( ( * port) . to_owned ( ) , true ) )
224- } else if ports. len ( ) > 1 {
224+ if !force_confirm_port {
225+ return Ok ( ( ( * port) . to_owned ( ) , true ) ) ;
226+ }
227+ }
228+
229+ if ports. len ( ) > 1 {
225230 // Multiple serial ports detected.
226231 info ! ( "Detected {} serial ports" , ports. len( ) ) ;
227232 info ! ( "Ports which match a known common dev board are highlighted" ) ;
0 commit comments