[英]how to control dcd in linux
How to control data carrier detect's voltage? 如何控制数据载体检测的电压? I use
TIOCMSET
, but it does not work: 我使用
TIOCMSET
,但是不起作用:
int status;
int fd;
/* OPEN Connection */
if ((fd = open("/dev/ttyS0",O_RDWR)) < 0)
{
printf("Couldn't open ttyS0\n");
exit(1);
}
// turn on DCD
status |= TIOCM_CAR;
ioctl(fd, TIOCMSET, &status);
The voltage never changes on dcd pin, but the dtr and rts pin's voltage change. 电压不会在dcd引脚上改变,但dtr和rts引脚的电压会改变。 Can I do this in linux?
我可以在linux中这样做吗?
No, you cannot do that. 不,你不能那样做。
DCD is an output from Data Communication Equipment (like a modem) and an input to Data Terminal Equipment such as your typical computer. DCD是数据通信设备(例如调制解调器)的输出 ,也是数据终端设备(例如您的典型计算机)的输入 。
An input can be read, but not driven. 可以读取输入,但不能驱动输入。
The exception would be if you are running linux on something like an embedded board designed to be a peripheral, where its serial port might be wired as DCE rather than DTE, to permit direct connection to a PC without a null modem cable. 例外情况是,如果您在设计成外围设备的嵌入式板上运行linux,其串行端口可能被连接为DCE而不是DTE,以允许直接连接到PC 而无需使用空调制解调器电缆。 However, in this case the signal you drive will probably not be called DCD in software, unless the soft interface also reflects the DCE role.
但是,在这种情况下,除非软件接口也反映了DCE的作用,否则您在软件中驱动的信号可能不会称为DCD。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.