Erlang 串行 IO [英] Erlang serial IO
问题描述
我想用 erlang 和我的调制解调器通话.它被挂载为/dev/ttyUSB 并且完全理解 AT 命令.
I want to talk to my modem with erlang. It is mounted as /dev/ttyUSB and perfectly understands AT-commands.
我可以用标准文件模块在设备上读写吗?
Can I read and write from the device with the standard file module?
波特率、字节大小、奇偶校验、RTS/CTS、DSR/DTR等怎么样?
How about baudrate, bytesize, parity, RTS/CTS, DSR/DTR and the like?
你有任何使用 tonyg-erlang-serial-1.0 的经验吗?(我不太相信这个包,因为它在自述文件中说:这是一个带有 erlang 驱动程序的端口程序,用于串行通信,最初由 Johan Bevemyr 于 1996 年编写,偶尔出现从 2007 年起由 Tony Garnock-Jones 维护."
Have you any experiences with tonyg-erlang-serial-1.0? (I am not too convinced of this package as it says in the readme: "This is a port program with erlang driver for serial communication, originally written by Johan Bevemyr in 1996 and sporadically maintained by Tony Garnock-Jones from 2007 onwards."
erlang 中串行 I/O 的常见做法是什么?
What is the common practice for serial I/O in erlang?
推荐答案
所以显然erlang没有串口通信库.我现在不得不再次挖掘 python,使用 pyserial,从 erlang 生成 python 线程并通过标准输入进行通信.
So there is apparently no serial communication library for erlang. I now had to dig up python again, use pyserial, spawn the python threads from erlang and communicate via stdin.
如果有人知道得更好,请证明我错了.我很想拥有 erlang 原生串行 I/O.
If anyone knows better, please proof me wrong. I would love to have erlang native serial I/O.
这篇关于Erlang 串行 IO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!