Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Oct 2005 12:49:37 +0200
From:      Gary Jennejohn <garyj@jennejohn.org>
To:        Divacky Roman <xdivac02@stud.fit.vutbr.cz>
Cc:        hackers@freebsd.org
Subject:   Re: serial port question 
Message-ID:  <200510021049.j92Anb5m004107@peedub.jennejohn.org>
In-Reply-To: Message from Divacky Roman <xdivac02@stud.fit.vutbr.cz> of "Sun, 02 Oct 2005 11:51:40 %2B0200." <20051002095140.GA49735@stud.fit.vutbr.cz>

next in thread | previous in thread | raw e-mail | index | archive | help

Divacky Roman writes:
> Hi,
> 
> I need to set serial port to given parity/speed/etc. and then cat from it...
> 
> when I: stty -f /dev/cuaa0 speed 1200
> its still at 9600 (the default setting)
> 
> how do I alter speed of serial port? minicom/cu is able to do it but I want t
> o
> do it via stty.
> 
> how can this be done?
> 

See discussion of the initial-state and lock-state devices in the sio
manual page.

Another, hacky way to do it is like this:

sleep 1000 < /dev/cuaa0&
stty -f /dev/cuaa0 speed 1200

The sleep holds the device open so that the values set using stty remain
effective. Without the sleep the stty values are only effective while
the command is being executed because stty opens the device and then,
once stty exits, the device is closed and all the new settings are lost.

---
Gary Jennejohn / garyjATjennejohnDOTorg gjATfreebsdDOTorg garyjATdenxDOTde




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510021049.j92Anb5m004107>