小编Dav*_*uff的帖子

替换linux中正在运行的可执行文件

我有一个嵌入式Linux系统,可以从USB卡更新自己.接口程序检测USB插入并查找升级的可执行文件.我目前将其复制到本地文件并在rc5.d中安装一些命令,以便在下次启动时将文件复制到现有的exe文件中.然后我重启了软件.

有一个更好的方法吗?

linux

22
推荐指数
3
解决办法
1万
查看次数

当端口上的字符时,select()调用不返回

我有一个选择调用,似乎没有检测到串行端口上的字符.有什么我想念的吗?

如果我删除上面的块中的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)

c++ linux select

1
推荐指数
1
解决办法
1123
查看次数

标签 统计

linux ×2

c++ ×1

select ×1