[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avrdude-dev] [patch #5008] Patch for (5.1) ser_posix.c for O_NONBLOCK o
[avrdude-dev] [patch #5008] Patch for (5.1) ser_posix.c for O_NONBLOCK open and restoring serial port state on close
Mon, 3 Apr 2006 21:18:13 +0000
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:188.8.131.52) Gecko/20060111 Firefox/184.108.40.206
Summary: Patch for (5.1) ser_posix.c for O_NONBLOCK open and
restoring serial port state on close
Project: AVR Downloader/UploaDEr
Submitted by: None
Submitted on: Monday 04/03/06 at 21:18 UTC
Priority: 5 - Normal
Assigned to: None
Originator Email: address@hidden
The attached patch for ser_posix.c (from the avrdude-5.1 distribution) does
the following things, all of which I consider to be improvements <g>:
* Adds the O_NONBLOCK flag to the open arguments. I (and others) have found
that this prevents blocking at open using certain USB to serial adapters. The
problem is that if the CLOCAL flag happens to be clear (previously, which we
have no control over), then the open will wait (forever, on the jtagmkII) for
the carrier detect.
This won't affect reads or writes, because we're using select() to wait till
the fd is ready to read or write.
* Saves the original termios structure, before we start modifying it from
* Restores the original termios structure at ser_close() time.
* Changes the printf spec for "long baud" in serial_baud_lookup() to be "%ld"
instead of "%d"
* Factors reporting of strerror(errno) out of ser_setspeed(); we're already
returning a value of -errno, so we can just call strerror() once, in
ser_open() where we see that ser_setspeed returned with an error code.
* Ensures that if we try to open a non-tty that we get an explanatory error
message ("inappropriate ioctl for device").
* Ensures that the termios structure is properly set to raw mode by calling
cfmakeraw() instead of trying to set individual struct fields manually.
* Makes sure that the CSIZE bits in the termios.c_cflag are all reset before
or'ing CS8 into them.
* Adds TCSAFLUSH to the tcsetattr() call in ser_setspeed() to throw away any
pending input garbage
* Adds TCSADRAIN to the tcsetattr() call in ser_close() to wait for output to
complete before changing data rate and other flags.
Date: Monday 04/03/06 at 21:18 UTC Name: patch-ser_posix.c Size: 3KB By:
Reply to this item at:
Message sent via/by Savannah
|[Prev in Thread]
||[Next in Thread]|
- [avrdude-dev] [patch #5008] Patch for (5.1) ser_posix.c for O_NONBLOCK open and restoring serial port state on close,