Skip to content

Commit

Permalink
Merge pull request #147 from openxc/protobufStreamFix
Browse files Browse the repository at this point in the history
Fixed Binary translation for Protobuf response (as well as other mess…
  • Loading branch information
pjt0620 committed Mar 24, 2020
2 parents 533d8a2 + a89828b commit 0393ba9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openxc/sources/usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def _read(self, endpoint_address, timeout=None,
read_size=DEFAULT_READ_REQUEST_SIZE):
timeout = timeout or self.DEFAULT_READ_TIMEOUT
try:
return str(self.device.read(0x80 + endpoint_address,
read_size, self.DEFAULT_INTERFACE_NUMBER, timeout), 'ISO-8859-1')
raw_binary = self.device.read(0x80 + endpoint_address,read_size, self.DEFAULT_INTERFACE_NUMBER, timeout)
return str(raw_binary, 'utf-8', 'ignore') # Formerly - Causes byte tranlation str(temp, 'ISO-8859-1')
except (usb.core.USBError, AttributeError) as e:
if e.backend_error_code in [self.LIBUSB0_TIMEOUT_CODE, self.LIBUSB1_TIMEOUT_CODE, self.OPENUSB_TIMEOUT_CODE]:
# Timeout, it may just not be sending
Expand Down

0 comments on commit 0393ba9

Please sign in to comment.