linux 串口接收有OE溢出错误,怎么办

linux 串口接收有OE溢出错误,怎么办,第1张

1. 确认是否成功打开的串口设备?

2. 确认打开串口后, 是否设置了波特率等一系列的参数?

3. 确认是否可成功写入?

4. 尝试使用poll 来代替select. 对于系统设备, 有时select不能正常工作而poll是可以的

分类: 电脑/网络 >>程序设计 >>其他编程语言

问题描述:

#include <sys/poll.h>int poll(struct pollfd *ufds, unsigned int nfds, int timeout)struct pollfd{int fd/* 想查询的文件描述符. */short int events/* fd 上,我们感兴趣的事件*/short int revents/* Types of events that actually occurred. */}请问第二个参数unsigned int nfds的含义,它传递什么信息?

解析:

ufds 指向 struct pollfd 数组

nfds 指定 pollfd 数组元素的个数,也就是要监测几个 pollfd

1. 确认是否成功打开的串口设备?

2. 确认打开串口后, 是否设置了波特率等一系列的参数?

3. 确认是否可成功写入?

4. 尝试使用poll 来代替select. 对于系统设备, 有时select不能正常工作而poll是可以的。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/7205081.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-02
下一篇2023-04-02

发表评论

登录后才能评论

评论列表(0条)

    保存