Linux serial port listener and interpreter?

前端 未结 4 880
抹茶落季
抹茶落季 2020-12-08 16:56

I\'m using a serial device for a project, and what I\'m trying to accomplish PC side, is listening for a command sent by the serial device, interpreting the query, running s

4条回答
  •  死守一世寂寞
    2020-12-08 17:45

    If you use right tools, it is possible to actually have your CPU usage to be exactly 0 when your device does not have any output.

    To accomplish this, you should use some higher level language (Perl, Python, C/C++ would do, but not bash) and use select loop on top of file handle of your serial device. This is an example for Perl http://perldoc.perl.org/IO/Select.html, but you can use any other language as long as it has support for select() syscall.

提交回复
热议问题