Set stty parameters

╄→尐↘猪︶ㄣ 提交于 2019-12-01 03:11:50

问题


Im trying to use bash to read from ttyS0 and need to set the following but im struggling to figure it out

databits = 7
stopbits = 2
parity = 0
flow control = 0

heres my code:

#!/bin/bash

# Port setting
stty -F /dev/ttyS0 raw speed 1200

# Loop
while [ 1 ]; 
do
    echo 'LOADING...'
    READ=`dd if=/dev/ttyS0 count=1`
    echo $READ


echo '[PRESS Ctrl + C TO EXIT]'
done

The script is working but I need to set the parameters. Any suggestions? And thanks:)


回答1:


try

stty -F /dev/ttyS0 cs7 cstopb -ixon raw speed 1200


来源:https://stackoverflow.com/questions/9092791/set-stty-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!