aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-10-01 19:09:59 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-10-01 19:12:42 -0400
commit0fc52f94961110003700ac3de1026a37aff8a91e (patch)
treec0037bc791c068759da12a22ac916dbf1ebaf9d4
parentde38ef4290225a3178c3fb8bd31b2b100340db9f (diff)
downloadkutter-0fc52f94961110003700ac3de1026a37aff8a91e.tar.gz
kutter-0fc52f94961110003700ac3de1026a37aff8a91e.tar.xz
kutter-0fc52f94961110003700ac3de1026a37aff8a91e.zip
serialhdl: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/serialhdl.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py
index 147bb624..b4102c6a 100644
--- a/klippy/serialhdl.py
+++ b/klippy/serialhdl.py
@@ -62,7 +62,7 @@ class SerialReader:
raise error(self.warn_prefix + (msg % params))
def _get_identify_data(self, eventtime):
# Query the "data dictionary" from the micro-controller
- identify_data = ""
+ identify_data = b""
while 1:
msg = "identify offset=%d count=%d" % (len(identify_data), 40)
try:
@@ -77,7 +77,7 @@ class SerialReader:
# Done
return identify_data
identify_data += msgdata
- def _start_session(self, serial_dev, serial_fd_type='u', client_id=0):
+ def _start_session(self, serial_dev, serial_fd_type=b'u', client_id=0):
self.serial_dev = serial_dev
self.serialqueue = self.ffi_main.gc(
self.ffi_lib.serialqueue_alloc(serial_dev.fileno(),
@@ -141,7 +141,7 @@ class SerialReader:
self.reactor.pause(self.reactor.monotonic() + 5.)
continue
bus.close = bus.shutdown # XXX
- ret = self._start_session(bus, 'c', txid)
+ ret = self._start_session(bus, b'c', txid)
if not ret:
continue
# Verify correct canbus_nodeid to canbus_uuid mapping
@@ -198,7 +198,7 @@ class SerialReader:
self.serial_dev = debugoutput
self.msgparser.process_identify(dictionary, decompress=False)
self.serialqueue = self.ffi_main.gc(
- self.ffi_lib.serialqueue_alloc(self.serial_dev.fileno(), 'f', 0),
+ self.ffi_lib.serialqueue_alloc(self.serial_dev.fileno(), b'f', 0),
self.ffi_lib.serialqueue_free)
def set_clock_est(self, freq, conv_time, conv_clock, last_clock):
self.ffi_lib.serialqueue_set_clock_est(
@@ -220,7 +220,7 @@ class SerialReader:
return ""
self.ffi_lib.serialqueue_get_stats(
self.serialqueue, self.stats_buf, len(self.stats_buf))
- return self.ffi_main.string(self.stats_buf)
+ return self.ffi_main.string(self.stats_buf).decode()
def get_reactor(self):
return self.reactor
def get_msgparser(self):
@@ -338,7 +338,7 @@ def stk500v2_leave(ser, reactor):
ser.baudrate = 115200
reactor.pause(reactor.monotonic() + 0.100)
ser.read(4096)
- ser.write('\x1b\x01\x00\x01\x0e\x11\x04')
+ ser.write(b'\x1b\x01\x00\x01\x0e\x11\x04')
reactor.pause(reactor.monotonic() + 0.050)
res = ser.read(4096)
logging.debug("Got %s from stk500v2", repr(res))