Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set stty parameters

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:)

like image 819
afro360 Avatar asked Feb 01 '12 08:02

afro360


1 Answers

try

stty -F /dev/ttyS0 cs7 cstopb -ixon raw speed 1200
like image 133
Ortwin Angermeier Avatar answered Sep 21 '22 07:09

Ortwin Angermeier