diff --git a/ckcc/client.py b/ckcc/client.py index e27c8fe..b54043a 100644 --- a/ckcc/client.py +++ b/ckcc/client.py @@ -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.