setserial:无法获取串行信息:设备的 ioctl 不合适

setserial:无法获取串行信息:设备的 ioctl 不合适
$ setserial /dev/ttyUSB0 -G
Cannot get serial info: Inappropriate ioctl for device

这个错误是什么意思?stty工作正常:

$ stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
eof = ^A; min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

答案1

这意味着驱动程序不支持setserial正在使用的 IOCTL:

setserial gets the information via an ioctl() call. In case the driver 
for your device does not support TIOCGSERIAL, the "invalid argument" is 
returned.

Debian 错误报告)

我认为stty应该能够执行 USB 串行设备所需的任何配置。

答案2

阅读man setserial或搜索manpages.ubuntu.com。它部分地说:

For the most part, superuser privilege is required to set the configuration parameters of a serial port. A few serial port parameters can be set by normal users, however, and these will be noted as exceptions in this manual page.

或者,你可以sudo setserial ...

相关内容