Skip to content

Commit 0393ba9

Browse files
authored
Merge pull request #147 from openxc/protobufStreamFix
Fixed Binary translation for Protobuf response (as well as other mess…
2 parents 533d8a2 + a89828b commit 0393ba9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

openxc/sources/usb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def _read(self, endpoint_address, timeout=None,
8585
read_size=DEFAULT_READ_REQUEST_SIZE):
8686
timeout = timeout or self.DEFAULT_READ_TIMEOUT
8787
try:
88-
return str(self.device.read(0x80 + endpoint_address,
89-
read_size, self.DEFAULT_INTERFACE_NUMBER, timeout), 'ISO-8859-1')
88+
raw_binary = self.device.read(0x80 + endpoint_address,read_size, self.DEFAULT_INTERFACE_NUMBER, timeout)
89+
return str(raw_binary, 'utf-8', 'ignore') # Formerly - Causes byte tranlation str(temp, 'ISO-8859-1')
9090
except (usb.core.USBError, AttributeError) as e:
9191
if e.backend_error_code in [self.LIBUSB0_TIMEOUT_CODE, self.LIBUSB1_TIMEOUT_CODE, self.OPENUSB_TIMEOUT_CODE]:
9292
# Timeout, it may just not be sending

0 commit comments

Comments
 (0)