Skip to content

Commit

Permalink
feat: drop DebugLinkShowText functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
matejcik committed Mar 18, 2021
1 parent 56ee7d3 commit cb71525
Show file tree
Hide file tree
Showing 18 changed files with 3 additions and 310 deletions.
26 changes: 0 additions & 26 deletions common/protob/messages-debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,6 @@ message DebugLinkRecordScreen {
optional string target_directory = 1; // empty or missing to stop recording
}

/**
* Request: Show text on the screen
* @start
* @next Success
*/
message DebugLinkShowText {
optional string header_text = 1; // screen header text
repeated DebugLinkShowTextItem body_text = 2; // body text segments
optional string header_icon = 3; // icon name in ui.style
optional string icon_color = 4; // color name in ui.style

message DebugLinkShowTextItem {
optional DebugLinkShowTextStyle style = 1;
optional string content = 2;
}

enum DebugLinkShowTextStyle {
NORMAL = 0;
BOLD = 1;
MONO = 2;
BR = 4;
BR_HALF = 5;
SET_COLOR = 6;
}
}

/**
* Request: Computer asks for device state
* @start
Expand Down
1 change: 0 additions & 1 deletion common/protob/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ enum MessageType {
MessageType_DebugLinkLayout = 9001 [(wire_debug_out) = true];
MessageType_DebugLinkReseedRandom = 9002 [(wire_debug_in) = true];
MessageType_DebugLinkRecordScreen = 9003 [(wire_debug_in) = true];
MessageType_DebugLinkShowText = 9004 [(wire_debug_in) = true];
MessageType_DebugLinkEraseSdCard = 9005 [(wire_debug_in) = true];
MessageType_DebugLinkWatchLayout = 9006 [(wire_debug_in) = true];

Expand Down
1 change: 1 addition & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Removed
- PIVX support
- dropped debug-only `DebugLinkShowText` functionality

### Fixed
- Path warning is not shown on `GetAddress(show_display=False)` call. [#1206]
Expand Down
1 change: 0 additions & 1 deletion core/src/apps/debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def boot() -> None:
config.wipe()

wire.add(MessageType.LoadDevice, __name__, "load_device")
wire.add(MessageType.DebugLinkShowText, __name__, "show_text")
wire.register(MessageType.DebugLinkDecision, dispatch_DebugLinkDecision) # type: ignore
wire.register(MessageType.DebugLinkGetState, dispatch_DebugLinkGetState)
wire.register(MessageType.DebugLinkReseedRandom, dispatch_DebugLinkReseedRandom)
Expand Down
49 changes: 0 additions & 49 deletions core/src/apps/debug/show_text.py

This file was deleted.

38 changes: 0 additions & 38 deletions core/src/trezor/messages/DebugLinkShowText.py

This file was deleted.

30 changes: 0 additions & 30 deletions core/src/trezor/messages/DebugLinkShowTextItem.py

This file was deleted.

14 changes: 0 additions & 14 deletions core/src/trezor/messages/DebugLinkShowTextStyle.py

This file was deleted.

1 change: 0 additions & 1 deletion core/src/trezor/messages/MessageType.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
DebugLinkLayout: Literal[9001] = 9001
DebugLinkReseedRandom: Literal[9002] = 9002
DebugLinkRecordScreen: Literal[9003] = 9003
DebugLinkShowText: Literal[9004] = 9004
DebugLinkEraseSdCard: Literal[9005] = 9005
DebugLinkWatchLayout: Literal[9006] = 9006
if not utils.BITCOIN_ONLY:
Expand Down
1 change: 1 addition & 0 deletions python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

- dropped Python 3.5 support [#810]
- dropped debug-only `trezorctl debug show-text` functionality


## [0.12.2] - 2020-08-27
Expand Down
49 changes: 1 addition & 48 deletions python/src/trezorlib/cli/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,14 @@

import click

from .. import debuglink, mapping, messages, protobuf
from ..messages import DebugLinkShowTextStyle as S
from . import with_client
from .. import mapping, messages, protobuf


@click.group(name="debug")
def cli():
"""Miscellaneous debug features."""


STYLES = {
"@@NORMAL": S.NORMAL,
"@@BOLD": S.BOLD,
"@@MONO": S.MONO,
"@@BR": S.BR,
"@@BR_HALF": S.BR_HALF,
}


@cli.command()
@click.option("-i", "--icon", help="Header icon name")
@click.option("-c", "--color", help="Header icon color")
@click.option("-h", "--header", help="Header text", default="Showing text")
@click.argument("body")
@with_client
def show_text(client, icon, color, header, body):
"""Show text on Trezor display.
For usage instructions, see:
https://github.com/trezor/trezor-firmware/blob/master/docs/python/show-text.md
"""
body = body.split()
body_text = []
words = []

def _flush():
if words:
body_text.append((None, " ".join(words)))
words.clear()

for word in body:
if word in STYLES:
_flush()
body_text.append((STYLES[word], None))
elif word.startswith("%%"):
_flush()
body_text.append((S.SET_COLOR, word[2:]))
else:
words.append(word)

_flush()

return debuglink.show_text(client, header, body_text, icon=icon, icon_color=color)


@cli.command()
@click.argument("message_name_or_type")
@click.argument("hex_data")
Expand Down
1 change: 0 additions & 1 deletion python/src/trezorlib/cli/trezorctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"sd-protect": device.sd_protect,
"load-device": device.load,
"self-test": device.self_test,
"show-text": debug.show_text,
"get-entropy": crypto.get_entropy,
"encrypt-keyvalue": crypto.encrypt_keyvalue,
"decrypt-keyvalue": crypto.decrypt_keyvalue,
Expand Down
15 changes: 0 additions & 15 deletions python/src/trezorlib/debuglink.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,18 +664,3 @@ def self_test(client):
payload=b"\x00\xFF\x55\xAA\x66\x99\x33\xCCABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\x00\xFF\x55\xAA\x66\x99\x33\xCC"
)
)


@expect(messages.Success, field="message")
def show_text(client, header_text, body_text, icon=None, icon_color=None):
body_text = [
messages.DebugLinkShowTextItem(style=style, content=content)
for style, content in body_text
]
msg = messages.DebugLinkShowText(
header_text=header_text,
body_text=body_text,
header_icon=icon,
icon_color=icon_color,
)
return client.call(msg)
38 changes: 0 additions & 38 deletions python/src/trezorlib/messages/DebugLinkShowText.py

This file was deleted.

30 changes: 0 additions & 30 deletions python/src/trezorlib/messages/DebugLinkShowTextItem.py

This file was deleted.

14 changes: 0 additions & 14 deletions python/src/trezorlib/messages/DebugLinkShowTextStyle.py

This file was deleted.

1 change: 0 additions & 1 deletion python/src/trezorlib/messages/MessageType.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
DebugLinkLayout: Literal[9001] = 9001
DebugLinkReseedRandom: Literal[9002] = 9002
DebugLinkRecordScreen: Literal[9003] = 9003
DebugLinkShowText: Literal[9004] = 9004
DebugLinkEraseSdCard: Literal[9005] = 9005
DebugLinkWatchLayout: Literal[9006] = 9006
EthereumGetPublicKey: Literal[450] = 450
Expand Down

0 comments on commit cb71525

Please sign in to comment.