add convenience functions to client object to get firmware version

This commit is contained in:
scgbckbone 2025-09-08 10:52:26 +02:00 committed by doc-hex
parent f87d30f220
commit c9ddf5d2a8

View File

@ -334,6 +334,18 @@ class ColdcardDevice:
return pbkdf2_hmac('sha256' if v3 else 'sha512', text_password, salt, PBKDF2_ITER_COUNT)[:32]
def firmware_version(self):
return self.send_recv(CCProtocolPacker.version()).split("\n")[1]
def is_edge(self):
# returns True if device is running EDGE firmware version
if self.is_simulator:
cmd = "import version; RV.write(str(int(getattr(version, 'is_edge', 0))))"
rv = self.send_recv(b'EXEC' + cmd.encode('utf-8'), timeout=60000, encrypt=False)
return rv == b"1"
return self.firmware_version()[-1] == "X"
class UnixSimulatorPipe:
# Use a UNIX pipe to the simulator instead of a real USB connection.