From 7bbcd99d53f8d804323a1f3f1a19fb8a23e77eeb Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 28 Jan 2018 11:24:50 +0100 Subject: [PATCH] tools: add vtrust parsing to binctl --- tools/binctl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/binctl b/tools/binctl index 16250f403b..7819062ce1 100755 --- a/tools/binctl +++ b/tools/binctl @@ -18,7 +18,18 @@ def format_sigmask(sigmask): def format_vtrust(vtrust): bits = [str(b) if vtrust & (1 << b) == 0 else '.' for b in range(16)] - return '%d = [%s]' % (vtrust, ' '.join(bits)) + # see docs/bootloader.md for vtrust constants + desc = '' + wait = (vtrust & 0x000F) ^ 0x000F + if wait > 0: + desc = 'WAIT_%d' % wait + if vtrust & 0x0010 == 0: + desc += ' RED' + if vtrust & 0x0020 == 0: + desc += ' CLICK' + if vtrust & 0x0040 == 0: + desc += ' STRING' + return '%d = [%s] = [%s]' % (vtrust, ' '.join(bits), desc) # bootloader/firmware headers specification: https://github.com/trezor/trezor-core/blob/master/docs/bootloader.md