diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2016-01-04 03:05:06 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2016-01-04 03:05:06 +0000 |
commit | 631bb021359e8bc85c40d4700ca276667c0f97ed (patch) | |
tree | 1c48a68d89cc5a2ded687460b68a6ea8c234741f | |
parent | a4d60f31016adb1dc7c273b6d0cd7c0d21dcb417 (diff) | |
download | ast2050-flashrom-631bb021359e8bc85c40d4700ca276667c0f97ed.zip ast2050-flashrom-631bb021359e8bc85c40d4700ca276667c0f97ed.tar.gz |
serprog: ignore failures when setting serial port options
There is no good reason to abort earlier just because some options did
not stick. This should improve compatibility without negative effects. If
communication is affected by the missing flag(s) then we abort later
anyway.
Corresponding to flashrom svn r1906.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
-rw-r--r-- | serial.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -209,12 +209,25 @@ int serialport_config(fdtype fd, unsigned int baud) if (observed.c_cflag != wanted.c_cflag || observed.c_lflag != wanted.c_lflag || observed.c_iflag != wanted.c_iflag || - observed.c_oflag != wanted.c_oflag || - cfgetispeed(&observed) != cfgetispeed(&wanted)) { - msg_perr("%s: Some requested options did not stick.\n", __func__); - return 1; + observed.c_oflag != wanted.c_oflag) { + msg_pwarn("Some requested serial options did not stick, continuing anyway.\n"); + msg_pdbg(" observed wanted\n" + "c_cflag: 0x%08lX 0x%08lX\n" + "c_lflag: 0x%08lX 0x%08lX\n" + "c_iflag: 0x%08lX 0x%08lX\n" + "c_oflag: 0x%08lX 0x%08lX\n", + (long)observed.c_cflag, (long)wanted.c_cflag, + (long)observed.c_lflag, (long)wanted.c_lflag, + (long)observed.c_iflag, (long)wanted.c_iflag, + (long)observed.c_oflag, (long)wanted.c_oflag + ); + } + if (cfgetispeed(&observed) != cfgetispeed(&wanted) || + cfgetospeed(&observed) != cfgetospeed(&wanted)) { + msg_pwarn("Could not set baud rates exactly.\n"); + msg_pdbg("Actual baud flags are: ispeed: 0x%08lX, ospeed: 0x%08lX\n", + (long)cfgetispeed(&observed), (long)cfgetospeed(&observed)); } - msg_pdbg("Baud rate is %d now.\n", entry->baud); #endif return 0; } |