mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
uploader: ignore bad character encodings for older bootloaders
this prevents the uploader from throwing an exception with older bootloaders
This commit is contained in:
committed by
Lorenz Meier
parent
1ecd3e9291
commit
ec2197fd1b
+16
-12
@@ -389,18 +389,22 @@ class uploader(object):
|
|||||||
self.otp_pid = self.otp[12:8:-1]
|
self.otp_pid = self.otp[12:8:-1]
|
||||||
self.otp_coa = self.otp[32:160]
|
self.otp_coa = self.otp[32:160]
|
||||||
# show user:
|
# show user:
|
||||||
print("type: " + self.otp_id.decode('Latin-1'))
|
try:
|
||||||
print("idtype: " + binascii.b2a_qp(self.otp_idtype).decode('Latin-1'))
|
print("type: " + self.otp_id.decode('Latin-1'))
|
||||||
print("vid: " + binascii.hexlify(self.otp_vid).decode('Latin-1'))
|
print("idtype: " + binascii.b2a_qp(self.otp_idtype).decode('Latin-1'))
|
||||||
print("pid: "+ binascii.hexlify(self.otp_pid).decode('Latin-1'))
|
print("vid: " + binascii.hexlify(self.otp_vid).decode('Latin-1'))
|
||||||
print("coa: "+ binascii.b2a_base64(self.otp_coa).decode('Latin-1'))
|
print("pid: "+ binascii.hexlify(self.otp_pid).decode('Latin-1'))
|
||||||
print("sn: ", end='')
|
print("coa: "+ binascii.b2a_base64(self.otp_coa).decode('Latin-1'))
|
||||||
for byte in range(0,12,4):
|
print("sn: ", end='')
|
||||||
x = self.__getSN(byte)
|
for byte in range(0,12,4):
|
||||||
x = x[::-1] # reverse the bytes
|
x = self.__getSN(byte)
|
||||||
self.sn = self.sn + x
|
x = x[::-1] # reverse the bytes
|
||||||
print(binascii.hexlify(x).decode('Latin-1'), end='') # show user
|
self.sn = self.sn + x
|
||||||
print('')
|
print(binascii.hexlify(x).decode('Latin-1'), end='') # show user
|
||||||
|
print('')
|
||||||
|
except Exception:
|
||||||
|
# ignore bad character encodings
|
||||||
|
pass
|
||||||
print("erase...")
|
print("erase...")
|
||||||
self.__erase()
|
self.__erase()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user