Linux serial port listener and interpreter?

前端 未结 4 869
抹茶落季
抹茶落季 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:55

    Is this not what you're looking for?

    while read -r line < /dev/ttyS2; do
      # $line is the line read, do something with it
      # which produces $result
      echo $result > /dev/ttyS2
    done
    

提交回复
热议问题