We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b0955b commit bdadff7Copy full SHA for bdadff7
can/interfaces/slcan.py
@@ -9,7 +9,6 @@
9
from queue import Queue, Empty
10
import threading
11
from serial.tools import list_ports
12
-import platform
13
from can import BusABC, CanProtocol, Message, typechecking
14
15
from ..exceptions import (
@@ -273,7 +272,7 @@ def _read_can(self) -> List[Message]:
273
272
# Due to accessing `serialPortOrig.in_waiting` too often will reduce the performance.
274
# We read the `serialPortOrig.in_waiting` only once here.
275
in_waiting = self.serialPortOrig.in_waiting
276
- for _ in range(in_waiting):
+ for _ in range(max(1, in_waiting)):
277
new_byte = self.serialPortOrig.read(size=1)
278
if new_byte:
279
self._buffer.extend(new_byte)
0 commit comments