mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/sc_suit: aligh seq_no format with riotboot_hdr
This commit is contained in:
parent
e64b1bd764
commit
ee9bf559fe
4
dist/pythonlibs/riotctrl_shell/sys.py
vendored
4
dist/pythonlibs/riotctrl_shell/sys.py
vendored
@ -43,13 +43,13 @@ class Version(ShellInteraction):
|
||||
|
||||
class SUITSequenceNoParser(ShellInteractionParser):
|
||||
def __init__(self):
|
||||
self.c_seq_no = re.compile(r"seq_no: (?P<seq_no>\d+)$")
|
||||
self.c_seq_no = re.compile(r"seq_no: (?P<seq_no>0x[0-9a-fA-F:]+)$")
|
||||
|
||||
def parse(self, cmd_output):
|
||||
for line in cmd_output.splitlines():
|
||||
m = self.c_seq_no.search(line)
|
||||
if m is not None:
|
||||
return int(m.group("seq_no"))
|
||||
return int(m.group("seq_no"), 16)
|
||||
return None
|
||||
|
||||
|
||||
|
@ -44,11 +44,11 @@ def test_suit_fetch():
|
||||
def test_suit_sequence_no():
|
||||
rc = init_ctrl(
|
||||
output="""
|
||||
seq_no: 123456789
|
||||
seq_no: 0x12345678
|
||||
"""
|
||||
)
|
||||
si = riotctrl_shell.sys.SUIT(rc)
|
||||
res = si.suit_sequence_no()
|
||||
parser = riotctrl_shell.sys.SUITSequenceNoParser()
|
||||
# mock just returns last input
|
||||
assert parser.parse(res) == 123456789
|
||||
assert parser.parse(res) == 0x12345678
|
||||
|
@ -44,7 +44,7 @@ int _suit_handler(int argc, char **argv)
|
||||
else if (strcmp(argv[1], "seq_no") == 0) {
|
||||
uint32_t seq_no = 0;
|
||||
suit_storage_get_highest_seq_no(&seq_no);
|
||||
printf("seq_no: %" PRIu32 "\n", seq_no);
|
||||
printf("seq_no: 0x%08" PRIx32 "\n", seq_no);
|
||||
}
|
||||
else {
|
||||
_print_usage(argv);
|
||||
|
Loading…
Reference in New Issue
Block a user