[PATCH] - tc{set,get}attr() error checking and B0 support

Troy Curtiss tcurtiss@qcpi.com
Thu Jan 23 00:34:00 GMT 2003


Chris,
   Per your comments on my prior patches, I have re-architected my 
error-checking changes so that the short-circuiting behavior in tcsetattr() 
is gone.  I also cleaned up the B0 (ie. drop DTR) support to more closely 
resemble what POSIX expects while not enraging Win32 :)  Please let me know 
if this passes muster - the prior test case program still applies.  My only 
remaining question is why errno isn't being propagated back up to the 
application?  Thanks,

-Troy

2003-01-22  Troy Curtiss  <troyc@usa.net>

         * fhandler_serial.cc (fhandler_serial::tcsetattr): Add error-checking
         so that if any Win32 SetComm*() calls fail, errno gets set to EINVAL
      and tcsetattr() returns -1. Catches invalid bitrates, mostly.
         * fhandler_serial.cc (fhandler_serial::tcsetattr): If baud rate 
setting
      is B0, just drop DTR and leave Win32 DCB bitrate as-is since 0 is not
      a valid Win32 setting.
         (fhandler_serial::tcgetattr): If DTR is low, populate the bitrate 
as B0,
      otherwise get it from the DCB.  Works around Win32's lack of bitrate 0
      at the expense of using DTR as the flag (POSIX behavior.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030123/31776732/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serial_support_patch
Type: application/octet-stream
Size: 5007 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030123/31776732/attachment.obj>


More information about the Cygwin-patches mailing list