Skip to content

Commit

Permalink
move import platform
Browse files Browse the repository at this point in the history
  • Loading branch information
luoja committed Nov 18, 2024
1 parent 7b0955b commit bdadff7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions can/interfaces/slcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from queue import Queue, Empty
import threading
from serial.tools import list_ports
import platform
from can import BusABC, CanProtocol, Message, typechecking

from ..exceptions import (
Expand Down Expand Up @@ -273,7 +272,7 @@ def _read_can(self) -> List[Message]:
# Due to accessing `serialPortOrig.in_waiting` too often will reduce the performance.
# We read the `serialPortOrig.in_waiting` only once here.
in_waiting = self.serialPortOrig.in_waiting
for _ in range(in_waiting):
for _ in range(max(1, in_waiting)):
new_byte = self.serialPortOrig.read(size=1)
if new_byte:
self._buffer.extend(new_byte)
Expand Down

0 comments on commit bdadff7

Please sign in to comment.