This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


The following commit(s) were added to refs/heads/master by this push:
     new 7fecd3b  Allow setting the UART MTU from input to utilize larger 
serial packet.
7fecd3b is described below

commit 7fecd3b1cc62768a7d2f17f48e704d5f7a1b296e
Author: Jakob Krantz <jakob.kra...@u-blox.com>
AuthorDate: Thu Feb 2 10:10:05 2023 +0100

    Allow setting the UART MTU from input to utilize larger serial packet.
    
    This allows to speed up flashing by using larger UART buffer without the 
need to
    recompile newtmgr.
    
    Default setting is not changed, but now the mtu argument to 
--connstring=COM55,baud=1000000,mtu=512 will be used.
---
 nmxact/nmserial/serial_xport.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nmxact/nmserial/serial_xport.go b/nmxact/nmserial/serial_xport.go
index 1c97fc0..a0368e7 100644
--- a/nmxact/nmserial/serial_xport.go
+++ b/nmxact/nmserial/serial_xport.go
@@ -50,7 +50,7 @@ var errTimeout error = errors.New("Timeout reading from 
serial connection")
 func NewXportCfg() *XportCfg {
        return &XportCfg{
                ReadTimeout: 10 * time.Second,
-               Mtu:         512,
+               Mtu:         128,
        }
 }
 
@@ -286,8 +286,8 @@ func (sx *SerialXport) Tx(bytes []byte) error {
                 * we need to save room for the header (2 byte) and
                 * carriage return (and possibly LF 2 bytes), */
 
-               /* all totaled, 124 bytes should work */
-               writeLen := util.Min(124, totlen-written)
+               /* all totaled, MTU-4 bytes bytes should work */
+               writeLen := util.Min(sx.cfg.Mtu - 4, totlen-written)
 
                writeBytes := base64Data[written : written+writeLen]
                sx.txRaw(writeBytes)

Reply via email to