Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
klapro committed Oct 3, 2023
1 parent ccc3daf commit cacd90e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion nmxact/nmserial/serial_xport.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (sx *SerialXport) Tx(bytes []byte) error {
* carriage return (and possibly LF 2 bytes), */

/* all totaled, MTU-4 bytes bytes should work */
writeLen := util.Min(1024, totlen-written)
writeLen := util.Min(512, totlen-written)

writeBytes := base64Data[written : written+writeLen]
sx.txRaw(writeBytes)
Expand Down
16 changes: 8 additions & 8 deletions nmxact/xact/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ func findChunkLen(s sesn.Sesn, hash []byte, upgrade bool, data []byte,
// Encoded length is larger than MTU, we need to make chunk shorter
overflow := len(enc) - s.MtuOut()
chunklen -= overflow
}
//Ensure the chunk length is always aligned as bootloader expected
if chunklen > IMAGE_UPLOAD_CHUNK_ALIGNMENT {
remain_bytes := chunklen % IMAGE_UPLOAD_CHUNK_ALIGNMENT
if remain_bytes != 0 {
chunklen -= remain_bytes
}
}

return chunklen, nil
if chunklen > IMAGE_UPLOAD_CHUNK_ALIGNMENT {
remain_bytes := chunklen % IMAGE_UPLOAD_CHUNK_ALIGNMENT
if remain_bytes != 0 {
chunklen -= remain_bytes
}

return chunklen, nil
}

return chunklen, nil
}
Expand Down

0 comments on commit cacd90e

Please sign in to comment.