Skip to content

Commit

Permalink
Fallback to minimal protocol for unknown bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba2k2 committed Dec 8, 2023
1 parent 3293d92 commit 44adc06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion bk7231tools/serial/cmd_chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def read_chip_info(self) -> str:
self.chip_info, _ = CHIP_BY_CRC[crc]
# read the protocol here already - it might not support BootVersion
self.protocol_type = PROTOCOLS.get(self.chip_info, ProtocolType.UNKNOWN)
else:
# unknown bootloader version - assume minimal protocol support
self.protocol_type = ProtocolType.BASIC_DEFAULT

# try BK7231S chip info command
command = BkBootVersionCmnd()
Expand All @@ -89,7 +92,7 @@ def read_chip_info(self) -> str:
default = ProtocolType.FULL
else:
self.chip_info = response.version.decode().strip("\x00\x20")
default = ProtocolType.BASIC_DEFAULT
default = ProtocolType.BASIC_TUYA

# get protocol by chip info or SCTRL_CHIP_ID
# if not set, use `default`
Expand Down
2 changes: 1 addition & 1 deletion bk7231tools/serial/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ProtocolType(Enum):
(0x09, LONG), # CMD_FlashRead4K
(0x0F, LONG), # CMD_FlashErase
]
BASIC_DEFAULT = BASIC_TUYA
BASIC_DEFAULT = BASIC_BEKEN


# list of protocols with verified command support
Expand Down

0 comments on commit 44adc06

Please sign in to comment.