aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-04-04 13:02:44 +1100
committerLorenz Meier <lm@inf.ethz.ch>2014-04-05 12:07:27 +0200
commitec2197fd1b228d8eb4855c49d5f9b1365685d01c (patch)
tree5bfb91d0156f479b1da0108fa659f0ca3ee535ed /Tools
parent1ecd3e9291216a7b9847e1387521527a0b6d3bb2 (diff)
downloadpx4-firmware-ec2197fd1b228d8eb4855c49d5f9b1365685d01c.tar.gz
px4-firmware-ec2197fd1b228d8eb4855c49d5f9b1365685d01c.tar.bz2
px4-firmware-ec2197fd1b228d8eb4855c49d5f9b1365685d01c.zip
uploader: ignore bad character encodings for older bootloaders
this prevents the uploader from throwing an exception with older bootloaders
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/px_uploader.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py
index e4a8b3c05..985e6ffd9 100755
--- a/Tools/px_uploader.py
+++ b/Tools/px_uploader.py
@@ -389,18 +389,22 @@ class uploader(object):
self.otp_pid = self.otp[12:8:-1]
self.otp_coa = self.otp[32:160]
# show user:
- print("type: " + self.otp_id.decode('Latin-1'))
- print("idtype: " + binascii.b2a_qp(self.otp_idtype).decode('Latin-1'))
- print("vid: " + binascii.hexlify(self.otp_vid).decode('Latin-1'))
- print("pid: "+ binascii.hexlify(self.otp_pid).decode('Latin-1'))
- print("coa: "+ binascii.b2a_base64(self.otp_coa).decode('Latin-1'))
- print("sn: ", end='')
- for byte in range(0,12,4):
- x = self.__getSN(byte)
- x = x[::-1] # reverse the bytes
- self.sn = self.sn + x
- print(binascii.hexlify(x).decode('Latin-1'), end='') # show user
- print('')
+ try:
+ print("type: " + self.otp_id.decode('Latin-1'))
+ print("idtype: " + binascii.b2a_qp(self.otp_idtype).decode('Latin-1'))
+ print("vid: " + binascii.hexlify(self.otp_vid).decode('Latin-1'))
+ print("pid: "+ binascii.hexlify(self.otp_pid).decode('Latin-1'))
+ print("coa: "+ binascii.b2a_base64(self.otp_coa).decode('Latin-1'))
+ print("sn: ", end='')
+ for byte in range(0,12,4):
+ x = self.__getSN(byte)
+ x = x[::-1] # reverse the bytes
+ self.sn = self.sn + x
+ print(binascii.hexlify(x).decode('Latin-1'), end='') # show user
+ print('')
+ except Exception:
+ # ignore bad character encodings
+ pass
print("erase...")
self.__erase()