Subject: tcsetattr calls cause framing errors
From: [email-masked] (Chris Dearman)

20 Feb 1998 20:30:46 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked] ([email-masked])
Cc: [email-masked]

  I noticed a problem when using the coolview cygwin.dll (634339 Nov 3
07:04) on an NT4.0 machine.  It appears that calls to SetCommState
reprogram the serial chip even if the device parameters are
unchanged. Calling tcsetattr to modify the timeout parameters
(something that gdb does frequently...) can cause received data to be
scrambled.

  The attached patch works round the problem by only calling
SetCommState if the device parameters have actually changed.  It also
preserves the parity and stop bit settings.

 I'm not sure if the handling for ERROR_OPERATION_ABORTED in ReadFile
is really appropriate; it's needed because any serial error will make
the device inaccessible until ClearCommError is called.  It might be
better to simply stop the error from being generated by clearing
nstate.fAbortOnError in the tcsetattr call.

	Regards
		Chris

[ATTACHMENT /usr/algor/chris/fhandler.cc.diffs, application/octet-stream]

-- 
Chris Dearman, Algorithmics Ltd, 3 Drayton Park, London, N5 1NU, England
Phone: +44 171 700 3301  FAX: +44 171 700 3400  Email: [email-masked]
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".