PX4/Bootloader — pull request #10 by davidbuzz (2014-02-09 04:26:45+00:00)
Title: utf-8 does not handle 0xFF characters.

- 0xff appear in boards with no OTP or COA programmed.
- using Latin-1 encoding handles this better.

before:
Loaded firmware for 14,0, waiting for the bootloader...
Found board 14,0 bootloader rev 4 on /dev/cu.usbmodem1
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff Traceback (most recent call last):
File "/Users/buzz/UAV/Bootloader/px_uploader.py", line 507, in
up.upload(fw)
File "/Users/buzz/UAV/Bootloader/px_uploader.py", line 392, in upload
print("type: " + self.otp_id.decode('utf-8'))
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte

after:
Loaded firmware for 14,0, waiting for the bootloader...
Found board 14,0 bootloader rev 4 on /dev/cu.usbmodem1
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff type: ÿÿÿÿ
idtype: =FF
vid: ffffffff
pid: ffffffff
coa: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8=
sn: 0012345678901234567890
erase...
program...
verify...
done, rebooting.

I tested this on both 2.7 and 3.0 pythons on OSX.