This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can't use ioctl() to set baud rate on /dev/ttyS0


I've been working on porting a simple terminal emulator application 
from HP-UX 10.20 to Cygwin.  All it does is make a few termio 
settings on stdin, stdout and the specified serial port, then copy 
characters from stdin to the serial port and from the serial port to 
stdout.  It seems to work fine except that it won't set the serial 
port baud rate.

I've used "stty -a < /dev/ttyS0" to check the serial port termio 
settings before and after running the application and can verify 
that the application sets at least "clocal" and "cs8", so the 
ioctl() calls basically work.  None of the baud rate settings made 
via the ioctl() call have any effect, however.  I can set the baud 
rate using 'stty', but the application leaves the baud rate 
unchanged.

I can get the application to work if I first execute "stty 38400 < 
/dev/ttyS0", but I'd really rather have the application do this 
itself.

The behavior is the same on /dev/ttyS1.

I have attached an extremely simplified version of the application 
source, with everything stripped out except the part that attempts 
to set the baud rate.  This code builds and runs without errors--it 
just fails to set the baud rate.  I have also attached the output of 
"cygcheck -s -r -v > cygcheck.out".

Does anyone see what I'm doing wrong or know why ioctl() is not 
setting the baud rate?

Regards,
Gary

-- 
Gary Johnson                 | Agilent Technologies
garyjohn@spk.agilent.com     | Mobile Broadband Division
                             | Spokane, Washington, USA

Attachment: speed_test.c
Description: Text document

Attachment: cygcheck.out
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]