31 lines
998 B
Markdown
31 lines
998 B
Markdown
Создаем пару виртуальных портов:
|
||
|
||
$ socat -d -d pty,rawer,echo=0 pty,rawer,echo=0
|
||
2023/10/01 03:18:39 socat[965194] N PTY is /dev/pts/16
|
||
2023/10/01 03:18:39 socat[965194] N PTY is /dev/pts/19
|
||
|
||
Запускаем писателя на другой консоли:
|
||
|
||
$ ./writer.py
|
||
Write: GET_A
|
||
Write: GET_B
|
||
Write: GET_C
|
||
Write: GET_NORESP
|
||
Write: INVALID_CMD
|
||
...
|
||
|
||
На следующей консоли за пускаем парсер:
|
||
|
||
$ ./reader.py
|
||
01-10-2023 15:17:07 DEBUG:read: GET_B
|
||
01-10-2023 15:17:07 INFO:response_str: B_5V
|
||
01-10-2023 15:17:09 DEBUG:read: GET_C
|
||
01-10-2023 15:17:09 INFO:response_str: C_15A
|
||
01-10-2023 15:17:11 DEBUG:read: GET_NORESP
|
||
01-10-2023 15:17:11 WARNING:No value for sensor: NORESP
|
||
01-10-2023 15:17:13 DEBUG:read: INVALID_CMD
|
||
01-10-2023 15:17:13 WARNING:Command parser error: Unknown command: INVALID
|
||
01-10-2023 15:17:15 DEBUG:read: GET_A
|
||
...
|
||
|
||
|