Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not read build string without first checking XNCP feature bitmap #660

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bellows/ezsp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ async def get_board_info(
patch, ver_info_bytes = t.uint8_t.deserialize(ver_info_bytes)
special, ver_info_bytes = t.uint8_t.deserialize(ver_info_bytes)
version = f"{major}.{minor}.{patch}.{special} build {build}"
build_string = None

try:
build_string = await self.xncp_get_build_string()
except InvalidCommandError:
build_string = None
if FirmwareFeatures.BUILD_STRING in self._xncp_features:
with contextlib.suppress(InvalidCommandError):
build_string = await self.xncp_get_build_string()

if build_string:
version = f"{version} ({build_string})"
Expand Down
3 changes: 3 additions & 0 deletions tests/test_ezsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ async def replacement(command_name, tokenId=None, valueId=None):

return replacement

if not isinstance(xncp_build_string, InvalidCommandError):
ezsp_f._xncp_features |= xncp.FirmwareFeatures.BUILD_STRING

with patch.object(
ezsp_f,
"_command",
Expand Down
Loading