You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/05/17 21:05:04 UTC
[1/3] incubator-mynewt-newt git commit: LICENSE;
remore reference to sqlite, as that dependency is gone.
Repository: incubator-mynewt-newt
Updated Branches:
refs/heads/master f6ae9636f -> 3960627ba
LICENSE; remore reference to sqlite, as that dependency is gone.
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/cb5b1c01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/cb5b1c01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/cb5b1c01
Branch: refs/heads/master
Commit: cb5b1c013a2983d54515b3f88df6d9fc9e365dbf
Parents: f6ae963
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue May 3 12:05:57 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue May 3 12:05:57 2016 -0700
----------------------------------------------------------------------
LICENSE | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/cb5b1c01/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index a218bbd..88a6f68 100644
--- a/LICENSE
+++ b/LICENSE
@@ -206,9 +206,6 @@ details, see newt/vendor/github.com/kr/pretty/License
This product bundles kr/text, which is available under the MIT license. For
details, see newt/vendor/github.com/kr/text/License
-This product bundles go-sqlite3, which is available under the MIT license. For
-details, see newt/vendor/github.com/mattn/go-sqlite3/LICENSE
-
This product bundles mapstructure, which is available under the MIT license.
For details, see newt/vendor/github.com/mitchellh/mapstructure/LICENSE
[2/3] incubator-mynewt-newt git commit: newtmgr;
add sequence number to request header.
Posted by cc...@apache.org.
newtmgr; add sequence number to request header.
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/51d5ad14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/51d5ad14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/51d5ad14
Branch: refs/heads/master
Commit: 51d5ad1418041b8e4bde21a0cfc6e7a7f32e7106
Parents: cb5b1c0
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue May 3 15:36:33 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon May 9 08:30:38 2016 -0700
----------------------------------------------------------------------
newtmgr/protocol/nmgr.go | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/51d5ad14/newtmgr/protocol/nmgr.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/nmgr.go b/newtmgr/protocol/nmgr.go
index 4c60517..331c8b2 100644
--- a/newtmgr/protocol/nmgr.go
+++ b/newtmgr/protocol/nmgr.go
@@ -33,7 +33,8 @@ type NmgrReq struct {
Flags uint8
Len uint16
Group uint16
- Id uint16
+ Seq uint8
+ Id uint8
Data []byte
}
@@ -63,7 +64,8 @@ func DeserializeNmgrReq(data []byte) (*NmgrReq, error) {
nmr.Flags = uint8(data[1])
nmr.Len = binary.BigEndian.Uint16(data[2:4])
nmr.Group = binary.BigEndian.Uint16(data[4:6])
- nmr.Id = binary.BigEndian.Uint16(data[6:8])
+ nmr.Seq = uint8(data[6])
+ nmr.Id = uint8(data[7])
data = data[8:]
if int(nmr.Len) != len(data) {
@@ -74,6 +76,8 @@ func DeserializeNmgrReq(data []byte) (*NmgrReq, error) {
}
nmr.Data = data
+ log.Debugf("Deserialized response %+v", nmr)
+
return nmr, nil
}
@@ -90,8 +94,8 @@ func (nmr *NmgrReq) SerializeRequest(data []byte) ([]byte, error) {
binary.BigEndian.PutUint16(u16b, nmr.Group)
data = append(data, u16b...)
- binary.BigEndian.PutUint16(u16b, nmr.Id)
- data = append(data, u16b...)
+ data = append(data, byte(nmr.Seq))
+ data = append(data, byte(nmr.Id))
data = append(data, nmr.Data...)
[3/3] incubator-mynewt-newt git commit: connserial;
verify messages with CRC.
Posted by cc...@apache.org.
connserial; verify messages with CRC.
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/3960627b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/3960627b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/3960627b
Branch: refs/heads/master
Commit: 3960627ba85ca68198445d38126376edc35d8ace
Parents: 51d5ad1
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri May 6 13:55:17 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon May 9 08:30:46 2016 -0700
----------------------------------------------------------------------
newtmgr/transport/conn.go | 8 ++++++++
newtmgr/transport/connserial.go | 15 ++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/3960627b/newtmgr/transport/conn.go
----------------------------------------------------------------------
diff --git a/newtmgr/transport/conn.go b/newtmgr/transport/conn.go
index b7935ff..a774b38 100644
--- a/newtmgr/transport/conn.go
+++ b/newtmgr/transport/conn.go
@@ -59,6 +59,14 @@ func (pkt *Packet) GetBytes() []byte {
return pkt.buffer.Bytes()
}
+func (pkt *Packet) TrimEnd(count int) {
+
+ if pkt.buffer.Len() < count {
+ count = pkt.buffer.Len()
+ }
+ pkt.buffer.Truncate(pkt.buffer.Len() - count)
+}
+
func NewConn(cp config.NewtmgrConnProfile) (Conn, error) {
// Based on ConnProfile, instantiate the right type of conn object, that
// implements the conn interface.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/3960627b/newtmgr/transport/connserial.go
----------------------------------------------------------------------
diff --git a/newtmgr/transport/connserial.go b/newtmgr/transport/connserial.go
index 5e90f80..b221e77 100644
--- a/newtmgr/transport/connserial.go
+++ b/newtmgr/transport/connserial.go
@@ -26,6 +26,7 @@ import (
"fmt"
log "github.com/Sirupsen/logrus"
+ "github.com/joaojeronimo/go-crc16"
"github.com/tarm/serial"
"mynewt.apache.org/newt/newtmgr/config"
@@ -106,6 +107,14 @@ func (cs *ConnSerial) ReadPacket() (*Packet, error) {
full := cs.currentPacket.AddBytes(data)
if full {
+ if crc16.Crc16(cs.currentPacket.GetBytes()) != 0 {
+ return nil, util.NewNewtError("CRC error")
+ }
+
+ /*
+ * Trim away the 2 bytes of CRC
+ */
+ cs.currentPacket.TrimEnd(2)
pkt := cs.currentPacket
cs.currentPacket = nil
return pkt, nil
@@ -122,10 +131,14 @@ func (cs *ConnSerial) writeData(bytes []byte) {
func (cs *ConnSerial) WritePacket(pkt *Packet) error {
data := pkt.GetBytes()
- dLen := uint16(len(data))
pktData := make([]byte, 2)
+ crc := crc16.Crc16(data)
+ binary.BigEndian.PutUint16(pktData, crc)
+ data = append(data, pktData...)
+
+ dLen := uint16(len(data))
binary.BigEndian.PutUint16(pktData, dLen)
pktData = append(pktData, data...)