LINUX.ORG.RU
решено ФорумAdmin

[ttyS*][com*] Ком порты...


0

1

Есть у меня устройства Alentis UniPing-RS232

Хочется использовать их компорт для управления. Мне это удалось с помощью socat:

socat -d -d READLINE,history=$HOME/.netping_history,raw,echo=0,escape=0x0f UDP4:10.8.29.3:29003,bind=:29003,crnl

Теперь захотелось с их помощью управлять APC Smart-UPS 1000VA USB & Serial 230V (http://www.apc.com/products/resource/include/techspec_index.cfm?base_sku=SUA1... купить нормальную плату управления по SNMP нет денег)

Вот столкнулся с такой проблемой: Протокол ком порта мне не известен.. И подключится к APC Smart-UPS 1000VA USB & Serial 230V никак не могу...

Есть sys-power/apcupsd который управляет этим упсом по /dev/ttyS* Но мне никак не удаётся перенаправить ввод/вывод с socat в /dev/ttyS*

Вот пробую перенаправить вывод в /dev/ttyS1:

socat -d -d /dev/ttyS1,crnl,raw,echo=0,escape=0x0f UDP4:10.8.29.3:29003,bind=:29003,crnl

но когда я запускаю minicom на /dev/ttyS1 то конекта к устройству нет..

В вантузе есть прога для создания эмуляторов ком порта http://www.netping.ru/view.aspx?id=21, как такое сделать в линуксе?

благодарю за помощь.


Ответ на: комментарий от AITap

Не помогает,так с ходу...

$ sudo socat -d -d /dev/ttyS1,crnl,raw,echo=0,escape=0x0f UDP4:10.8.29.3:29003,bind=:29003,crnl,pty
2011/08/10 15:24:20 socat[11931] N opening character device "/dev/ttyS1" for reading and writing
2011/08/10 15:24:20 socat[11931] E parseopts(): option "pty" not supported with this address type 2011/08/10 15:24:20 socat[11931] N exit(1)

$ sudo socat -d -d /dev/ttyS1,crnl,raw,echo=0,escape=0x0f,pty UDP4:10.8.29.3:29003,bind=:29003,crnl
2011/08/10 15:24:40 socat[11935] E parseopts(): option "pty" not supported with this address type
2011/08/10 15:24:40 socat[11935] N exit(1)

sdh
() автор топика
Ответ на: комментарий от sdh

> Не помогает,так с ходу...
Не совсем понял, что именно Вы пытаетесь сделать.
Я имел в виду вот это:

PTY Generates a pseudo terminal (pty) and uses its master side. Another process may open the pty's slave side using it like a serial line or terminal.
(example). If both the ptmx and the openpty mechanisms are available, ptmx is used (POSIX).
Option groups: FD,NAMED,PTY,TERMIOS
Useful options: link, openpty, wait-slave, mode, user, group
See also: UNIX-LISTEN, PIPE, EXEC, SYSTEM

AITap ★★★★★
()
Ответ на: комментарий от sdh

Заработало!

$ sudo socat -d -d PTY:crnl,raw,echo=0,escape=0x0f UDP4:10.8.29.3:29003,bind=:29003,crnl
2011/08/10 15:35:32 socat[12005] N PTY is /dev/pts/15
2011/08/10 15:35:32 socat[12005] N opening connection to AF=2 192.168.29.3:29003
2011/08/10 15:35:32 socat[12005] N successfully connected from local address AF=2 192.168.4.19:29003
2011/08/10 15:35:32 socat[12005] N starting data transfer loop with FDs [3,3] and [5,5]

в minicom подключился на /dev/pts/15 УРА!

sdh
() автор топика
Ответ на: комментарий от sdh

А ещё можно указать параметр link=... и подключаться на указанный файл.

link=<filename>
Generates a symbolic link that points to the actual pseudo terminal (pty). This might help to solve the problem that ptys are generated with more or
less unpredictable names, making it difficult to directly access the socat generated pty automatically. With this option, the user can specify a «fix»
point in the file hierarchy that helps him to access the actual pty (example). Beginning with socat version 1.4.3, the symbolic link is removed when
the address is closed (but see option unlink-close).

AITap ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.