Skip to content

Commit

Permalink
fix: improve forwards compatibility with spsdk 2.1+
Browse files Browse the repository at this point in the history
spsdk recently switched to the python-native Enum library and renamed
the `desc` method to `get_description` in the process.  By using
device.status_string instead, our code works with both versions.

Co-authored-by: Robin Krahl <[email protected]>
  • Loading branch information
kmohrf and robin-nitrokey committed Apr 17, 2024
1 parent 600527e commit e6d160c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pynitrokey/trussed/bootloader/lpc55.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ def path(self) -> str:
return self._path

@property
def status(self) -> Tuple[int, str]:
code = self.device.status_code
message = StatusCode.desc(code)
return (code, message)
def status(self) -> str:
return self.device.status_string

def close(self) -> None:
self.device.close()
Expand Down Expand Up @@ -103,10 +101,7 @@ def update(
if success:
self.reboot()
else:
(code, message) = self.status
raise Exception(
f"Firmware update failed with status code {code}: {message}"
)
raise Exception(f"Firmware update failed with status {self.status}")

@classmethod
def list_vid_pid(cls: type[T], vid: int, pid: int) -> list[T]:
Expand Down

0 comments on commit e6d160c

Please sign in to comment.