SFT-5988: added counters to keypad display
What changed, and why it matters
This commit changes the on-screen keypad display to show a small counter next to each key label, tracking how many times the key has been released. It is a UI/debugging enhancement with no apparent security relevance.
No security action required; treat as a normal UI/debugging change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies ports/stm32/boards/Passport/modules/views/keypad.py. It removes the small=True argument from directional and action keys (u, d, l, r, x, y) and appends each key’s released counter to its label both at creation and during updates. The color logic based on released_count remains unchanged. There is no cryptographic, authentication, or access-control change.
Changed components
ports/stm32/boards/Passport/modules/views/keypad.pyInspect captured patch +17 / −6
diff --git a/ports/stm32/boards/Passport/modules/views/keypad.py b/ports/stm32/boards/Passport/modules/views/keypad.py
index 95553af..ad6534e 100644
--- a/ports/stm32/boards/Passport/modules/views/keypad.py
+++ b/ports/stm32/boards/Passport/modules/views/keypad.py
@@ -67,14 +67,14 @@ class Keypad(View):
}
y = TOP_MARGIN
- self.add_key('u', HALF_WIDTH - KEY_WIDTH // 4, y, small=True)
- self.add_key('d', HALF_WIDTH - KEY_WIDTH // 4, y + NUMKEY_VGAP + KEY_HEIGHT, small=True)
+ self.add_key('u', HALF_WIDTH - KEY_WIDTH // 4, y)
+ self.add_key('d', HALF_WIDTH - KEY_WIDTH // 4, y + NUMKEY_VGAP + KEY_HEIGHT)
self.add_key('l', HALF_WIDTH - KEY_WIDTH // 4 - NUMKEY_HGAP -
- KEY_WIDTH // 2, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2, small=True)
+ KEY_WIDTH // 2, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2)
self.add_key('r', HALF_WIDTH - KEY_WIDTH // 4 + NUMKEY_HGAP +
- KEY_WIDTH // 2, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2, small=True)
- self.add_key('x', SIDE_MARGIN, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2, small=True)
- self.add_key('y', WIDTH - SIDE_MARGIN - KEY_WIDTH // 2, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2, small=True)
+ KEY_WIDTH // 2, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2)
+ self.add_key('x', SIDE_MARGIN, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2)
+ self.add_key('y', WIDTH - SIDE_MARGIN - KEY_WIDTH // 2, y + (NUMKEY_VGAP + KEY_HEIGHT) // 2)
y += NUMKEY_VGAP + (NUMKEY_VGAP + KEY_HEIGHT) * 2
@@ -105,6 +105,8 @@ class Keypad(View):
label = '##'
else:
label = key
+
+ label = "{}: {}".format(label, self.key_state[key]['released'])
key_label = Label(text=label, color=TEXT_GREY)
with Stylize(key_label) as label:
label.align(lv.ALIGN.CENTER)
@@ -149,6 +151,15 @@ class Keypad(View):
key_label = key_state.get('label')
if key_label is not None:
released_count = key_state.get('released')
+
+ if key == '#':
+ label = '##'
+ else:
+ label = key
+
+ label = "{}: {}".format(label, released_count)
+ key_label.set_text(label)
+
with LocalStyle(key_label) as style:
# Adjust text color based on background
if released_count == 0:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.