Fix chamtool: upgrade command gives exception

(cherry picked from commit 592b851)
This commit is contained in:
chenzitai
2018-08-15 23:15:10 +01:00
parent 9e89f19353
commit 2be9b9e76e
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -251,4 +251,7 @@ class Device:
return self.getSetCmd(self.COMMAND_THRESHOLD, value)
def cmdUpgrade(self):
return self.execCmd(self.COMMAND_UPGRADE)
# Execute command
cmdLine = self.COMMAND_UPGRADE + self.LINE_ENDING
self.serial.write(cmdLine.encode('ascii'))
return 0
+4 -2
View File
@@ -143,8 +143,10 @@ def cmdThreshold(chameleon, arg):
return "Setting threshold failed: {}".format(arg, result['statusText'])
def cmdUpgrade(chameleon, arg):
result = chameleon.cmdUpgrade()
return ""
if(chameleon.cmdUpgrade() == 0):
print ("Device changed into Upgrade Mode")
exit(0)
# Custom class for argparse
class CmdListAction(argparse.Action):
def __init__(self, option_strings, dest, default=False, required=False,