You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/01/07 20:08:07 UTC

[2/4] incubator-mynewt-newt git commit: Ignore carriage returns in the beginning of packet.

Ignore carriage returns in the beginning of packet.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/7b5a07e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/7b5a07e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/7b5a07e3

Branch: refs/heads/master
Commit: 7b5a07e3c2f0bdaed6ff304e3f6ce252f07a74ab
Parents: 2a677a1
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Jan 7 11:05:40 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Jan 7 11:05:40 2016 -0800

----------------------------------------------------------------------
 newtmgr/transport/connserial.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7b5a07e3/newtmgr/transport/connserial.go
----------------------------------------------------------------------
diff --git a/newtmgr/transport/connserial.go b/newtmgr/transport/connserial.go
index 26a193f..b0e51ee 100644
--- a/newtmgr/transport/connserial.go
+++ b/newtmgr/transport/connserial.go
@@ -40,7 +40,7 @@ func (cs *ConnSerial) Open(cp *cli.ConnProfile) error {
 
 	c := &serial.Config{
 		Name: cp.ConnString,
-		Baud: 9600,
+		Baud: 115200,
 	}
 
 	cs.serialChannel, err = serial.OpenPort(c)
@@ -61,6 +61,13 @@ func (cs *ConnSerial) ReadPacket() (*Packet, error) {
 	for scanner.Scan() {
 		line := []byte(scanner.Text())
 
+		for {
+			if len(line) > 1 && line[0] == '\r' {
+				line = line[1:]
+			} else {
+				break
+			}
+		}
 		if len(line) < 2 || ((line[0] != 4 || line[1] != 20) &&
 			(line[0] != 6 || line[1] != 9)) {
 			continue