简体   繁体   English

从bash脚本设置串行端口流控制线?

[英]Set serial port flow control lines from bash script?

Is it possible to manually control the handshaking/flow control lines of a serial port from a bash script? 是否可以通过bash脚本手动控制串行端口的握手/流控制线? I'm referring to RTS, CTS, DTR and DSR. 我指的是RTS,CTS,DTR和DSR。 I don't want to enable automatic flow control, but manually manipulate these signals. 我不想启用自动流量控制,而是手动操作这些信号。 In my application, those lines control LEDs. 在我的应用程序中,这些线控制LED。 I've seen C code to do this using IOCtl(), but am wondering if it is possible via bash? 我已经看过C代码使用IOCtl()来做到这一点,但想知道是否可以通过bash进行?

There were no responses here and I couldn't find anything else on the web. 这里没有任何回应,我在网上找不到其他任何内容。 So I decided to write my own C program I could call from bash. 因此,我决定编写自己的C程序,可以从bash调用它。 It was actually quite simple to control the handshaking lines via C - just an open() and a couple of ioctl() calls. 实际上,通过C控制握手线非常简单-只需一个open()和几个ioctl()调用。 See https://www.cmrr.umn.edu/~strupp/serial.html#5_1 if you are interested in the details. 如果您对详细信息感兴趣,请参见https://www.cmrr.umn.edu/~strupp/serial.html#5_1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM