Commit b3cf8e19 authored by Cristian Maglie's avatar Cristian Maglie Committed by Silvano Cerza

Allow upload without specifing port, even if the board requires 1200-bps-touch...

Allow upload without specifing port, even if the board requires 1200-bps-touch on the serial port (#1263)
parent 46c23166
...@@ -296,25 +296,25 @@ func runProgramAction(pm *packagemanager.PackageManager, ...@@ -296,25 +296,25 @@ func runProgramAction(pm *packagemanager.PackageManager,
// Perform reset via 1200bps touch if requested // Perform reset via 1200bps touch if requested
if uploadProperties.GetBoolean("upload.use_1200bps_touch") { if uploadProperties.GetBoolean("upload.use_1200bps_touch") {
if port == "" { if port == "" {
return fmt.Errorf("no upload port provided") outStream.Write([]byte(fmt.Sprintln("Skipping 1200-bps touch reset: no serial port selected!")))
} } else {
ports, err := serial.GetPortsList()
ports, err := serial.GetPortsList() if err != nil {
if err != nil { return fmt.Errorf("cannot get serial port list: %s", err)
return fmt.Errorf("cannot get serial port list: %s", err) }
} for _, p := range ports {
for _, p := range ports { if p == port {
if p == port { if verbose {
if verbose { outStream.Write([]byte(fmt.Sprintf("Performing 1200-bps touch reset on serial port %s", p)))
outStream.Write([]byte(fmt.Sprintf("Performing 1200-bps touch reset on serial port %s", p))) outStream.Write([]byte(fmt.Sprintln()))
outStream.Write([]byte(fmt.Sprintln())) }
} logrus.Infof("Touching port %s at 1200bps", port)
logrus.Infof("Touching port %s at 1200bps", port) if err := serialutils.TouchSerialPortAt1200bps(p); err != nil {
if err := serialutils.TouchSerialPortAt1200bps(p); err != nil { outStream.Write([]byte(fmt.Sprintf("Cannot perform port reset: %s", err)))
outStream.Write([]byte(fmt.Sprintf("Cannot perform port reset: %s", err))) outStream.Write([]byte(fmt.Sprintln()))
outStream.Write([]byte(fmt.Sprintln())) }
break
} }
break
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment