Ah, I get it. 'read -n1' is the way.
On Fri, May 17, 2013 at 12:19 PM, Magicloud Magiclouds 
<magicloud.magiclo...@gmail.com> wrote:
Hi,

  Say I have device /dev/ttyACM0. If I `stty -F /dev/ttyACM0 raw`, then `cat /dev/ttyACM0` 
in one term, and `echo -e "QUERYCOMMAND" > /dev/ttyACM0` in another term. I 
would get the data in first term.

  But if echo first, then cat. The data seemed lost. Cat would not get 
anything. So I think these two commands must be run at the same time.

  So I put this process be in a script like this:

        (stty -F $tty raw
        currentSettings=""
        while [ 1 ]
        do
                c=`dd if=$tty count=1`
                currentSettings=${currentSettings}${c}
                if [ c == '.' ]
                then
                        break
                fi
        done
        echo -n $currentSettings > $conf) &
        echo -e "${query}?." > $tty
        until [ -e $conf ]
        do
                sleep 1
        done
        currentSettings=`cat $conf`

  The script stuck at dd, it did not get anything.

  What should I do?
You might be interested in a utility called 'chat', that is part of the 
'ppp'-package.
It is meant for scripts like this.

HTH, --Jasper.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/51960038....@xs4all.nl

Reply via email to