Есть код на python который просто считывает данные с ком порта, код работает на виндовс но не работает на ubuntu
Ошибка:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/serial/serialposix.py", line 323, in _reconfigure_port
orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 5, in <module>
ser = serial.Serial(port='/dev/ttyS5', baudrate=9600)
File "/usr/local/lib/python3.8/dist-packages/serial/serialutil.py", line 240, in __init__
self.open()
File "/usr/local/lib/python3.8/dist-packages/serial/serialposix.py", line 272, in open
self._reconfigure_port(force_update=True)
File "/usr/local/lib/python3.8/dist-packages/serial/serialposix.py", line 326, in _reconfigure_port
raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')
Код:
import time
import serial
import datetime
ser = serial.Serial(port='/dev/ttyS5', baudrate=9600)
received = []
ser.write(b'begin\n')
time.sleep(5)
ser.write(b'hello')
line = ser.readline()
print(line.decode())