Skip to content

Commit

Permalink
III.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 9, 2023
1 parent 2e464b7 commit 46333ef
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions pymodbus/transport/transport_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,25 +152,23 @@ def _write_ready(self):
except serial.SerialException as exc:
self.close(exc=exc)

if os.name == "nt":

def _poll_read(self):
if self._has_reader:
try:
self._has_reader = self.async_loop.call_later(
self._poll_wait_time, self._poll_read
)
if self.sync_serial.in_waiting:
self._read_ready()
except serial.SerialException as exc:
self.close(exc=exc)

def _poll_write(self):
if self._has_writer:
self._has_writer = self.async_loop.call_later(
self._poll_wait_time, self._poll_write
def _poll_read(self):
if self._has_reader:
try:
self._has_reader = self.async_loop.call_later(
self._poll_wait_time, self._poll_read
)
self._write_ready()
if self.sync_serial.in_waiting:
self._read_ready()
except serial.SerialException as exc:
self.close(exc=exc)

def _poll_write(self):
if self._has_writer:
self._has_writer = self.async_loop.call_later(
self._poll_wait_time, self._poll_write
)
self._write_ready()


async def create_serial_connection(loop, protocol_factory, *args, **kwargs):
Expand Down

0 comments on commit 46333ef

Please sign in to comment.