我有一个嵌入式Linux系统,可以从USB卡更新自己.接口程序检测USB插入并查找升级的可执行文件.我目前将其复制到本地文件并在rc5.d中安装一些命令,以便在下次启动时将文件复制到现有的exe文件中.然后我重启了软件.
有一个更好的方法吗?
我有一个选择调用,似乎没有检测到串行端口上的字符.有什么我想念的吗?
如果我删除上面的块中的read()代码,select将返回一段时间,直到清空现有的端口缓冲区,然后再检测不到更多.
我正在将字符流式传输到端口,并且运行minicom会在端口上显示连续的输入流.
任何人都可以看到这段代码有什么问题吗?
int main(void)
{
int ret;
char buf[1280];
fd_set m_Inputs; // fd_set for the select call for com input
int m_maxFD; // max FD for select() call.
struct timeval tv;
int fd1;
fd1 = open("/dev/ttyXR6", O_RDWR | O_NOCTTY | O_NONBLOCK);
fcntl(fd1, F_SETFL, 0);
struct termios options;
tcgetattr(fd1, &options); // Get the current options for the port...
// Set the baud rates...
cfsetispeed(&options, B9600);
cfsetospeed(&options, B9600);
// Enable the receiver and set local mode...
options.c_cflag |= (CLOCAL | …Run Code Online (Sandbox Code Playgroud)