apache / mynewt-mcumgr

Apache mynewt
https://mynewt.apache.org/
99 stars 76 forks source link

protocol definition out of date #167

Open Frank-Buss opened 1 year ago

Frank-Buss commented 1 year ago

The example at https://github.com/zephyrproject-rtos/mcumgr/blob/master/protocol.md is wrong. The latest version encodes it additionally with base64 (which IMHO doesn't make sense, any modern channel should support arbitrary 8 bit binary data).

Example for the image list command:

DEBU[2023-03-22 12:49:36.471] Using connection profile: name=unnamed type=serial connstring=dev=/dev/ttyACM0 
DEBU[2023-03-22 12:49:36.471] {add-nmp-listener} [serial_sesn.go:213] seq=66 
DEBU[2023-03-22 12:49:36.471] Encoded &{NmpBase:{hdr:{Op:0 Flags:0 Len:0 Group:1 Seq:66 Id:0}}} to:
00000000  a0                                                |.| 
DEBU[2023-03-22 12:49:36.471] Encoded:
00000000  00 00 00 01 00 01 42 00  a0                       |......B..| 
DEBU[2023-03-22 12:49:36.471] Tx NMP request: 00000000  00 00 00 01 00 01 42 00  a0                       |......B..| 
DEBU[2023-03-22 12:49:36.471] Base64 encoding request:
00000000  00 00 00 01 00 01 42 00  a0                       |......B..| 
DEBU[2023-03-22 12:49:36.472] Tx serial
00000000  06 09                                             |..| 
DEBU[2023-03-22 12:49:36.472] Tx serial
00000000  41 41 73 41 41 41 41 42  41 41 46 43 41 4b 44 31  |AAsAAAABAAFCAKD1|
00000010  4d 77 3d 3d                                       |Mw==| 
DEBU[2023-03-22 12:49:36.472] Tx serial
00000000  0a                                                |.| 
DEBU[2023-03-22 12:49:36.544] Rx serial:
00000000  06 09 41 43 30 42 41 41  41 6a 41 41 46 43 41 4c  |..AC0BAAAjAAFCAL|
00000010  39 6d 61 57 31 68 5a 32  56 7a 6e 37 39 6b 63 32  |9maW1hZ2Vzn79kc2|
00000020  78 76 64 41 42 6e 64 6d  56 79 63 32 6c 76 62 6d  |xvdABndmVyc2lvbm|
00000030  63 77 4c 6a 41 75 4d 43  34 77 2f 2f 2f 2f 6e 79  |cwLjAuMC4w////ny|
00000040  30 3d                                             |0=| 
DEBU[2023-03-22 12:49:36.544] Decoded input:
00000000  01 00 00 23 00 01 42 00  bf 66 69 6d 61 67 65 73  |...#..B..fimages|
00000010  9f bf 64 73 6c 6f 74 00  67 76 65 72 73 69 6f 6e  |..dslot.gversion|
00000020  67 30 2e 30 2e 30 2e 30  ff ff ff                 |g0.0.0.0...| 
DEBU[2023-03-22 12:49:36.544] rx nmp response: 00000000  01 00 00 23 00 01 42 00  bf 66 69 6d 61 67 65 73  |...#..B..fimages|
00000010  9f bf 64 73 6c 6f 74 00  67 76 65 72 73 69 6f 6e  |..dslot.gversion|
00000020  67 30 2e 30 2e 30 2e 30  ff ff ff                 |g0.0.0.0...| 
DEBU[2023-03-22 12:49:36.545] Received nmp rsp: &{NmpBase:{hdr:{Op:1 Flags:0 Len:35 Group:1 Seq:66 Id:0}} Rc:0 Images:[{NmpBase:{hdr:{Op:0 Flags:0 Len:0 Group:0 Seq:0 Id:0}} Image:0 Slot:0 Version:0.0.0.0 Hash:[] Bootable:false Pending:false Confirmed:false Active:false Permanent:false}] SplitStatus:N/A} 
DEBU[2023-03-22 12:49:36.545] {remove-nmp-listener} [serial_sesn.go:213] seq=66 
Images:
 image=0 slot=0
    version: 0.0.0.0
    bootable: false
    flags: 
    hash: Unavailable
Split status: N/A (0)