23,224
社区成员
发帖
与我相关
我的任务
分享
最近在做一个项目,需要把一个串口读写的windows项目移植到linux下面,下面这段代码是设置串口文件读写超时的,请问下面有没有对应的Linux函数之类的 COMMTIMEOUTS CommTimeOuts;
GetCommTimeouts (m_hComm, &CommTimeOuts);
CommTimeOuts.ReadIntervalTimeout = 1; //接收字符间最大时间间隔
CommTimeOuts.ReadTotalTimeoutMultiplier = 10;
CommTimeOuts.ReadTotalTimeoutConstant = 1000; // 读数据总超时常量
CommTimeOuts.WriteTotalTimeoutMultiplier = 10;
CommTimeOuts.WriteTotalTimeoutConstant = 10;
if(!SetCommTimeouts( m_hComm, &CommTimeOuts ))
{
TRACE( _T("SetCommTimeouts 返回错误") );
//关闭串口
CloseHandle (m_hComm);
m_hComm = INVALID_HANDLE_VALUE;
return FALSE;
}