[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IO-redirection seems to be not working



Quoting matthschulz (matthschulz@gmx.net):
> I'm trying to setup a connection of an multimeter to ttyS0. It gives a steady
> stream of lines to the port. (CONRAD VC96 for whom who knows)
> 
> When I use minicom for this, it works fine. The input is written on the sceen,
> can be saved and so on. I can leave minicom with ^A^Q and then cat /dev/ttyS0
> writes the lines to the screen.
> 
> But I have planned to program some functions to this stream at least maximum,
> minimum, average and others. 
> 
> So I tried to do the following in order to get rid of minicom:
> 
> >stty -F /dev/ttyS0 -parenb cs8 cstopb cread ixon isig ispeed 1200
> 
> to set the required 1200,8,N,2. No luck, >stty -F /dev/ttyS0 shows the change,
> but the port is not setted to 1200 bps.
> 
> While I was playing with stty and setserial, I figured out, that the command 
> 
> >stty -F /dev/ttyS0 -echo
> 
> the echo on my actual ttyp0 changes, not this at /dev/ttyS0 !
> Either ">stty -F /dev/ttyS0 echo"    or  ">stty echo" bring the echo back.
> 
> Space between -F and /dev... doesn't matter.
> ttyp0 or tty doesn't matter.
> X (KDE) running or not doesn't matter.
> BASH_VERSION='2.01.1(1)-release'

Sorry, I meant to reply to your earlier post.

Try running stty under strace and I think you might find that
the -F switch doesn't work. You may have more success with

#!/bin/sh
stty 1200       < /dev/ttyS0
stty cstopb     < /dev/ttyS0
stty -echo      < /dev/ttyS0
stty eof        undef   < /dev/ttyS0

to give a few examples at random.

You probably don't need to touch setserial if your ports are standard.
It's easy to misunderstand its purpose at first (I did, but figured it
out before posting).

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.


Reply to: