UPSTREAM: serial: Fix sp_flush_incoming for serprog TCP connections
During the development of an esp32 serprog-compatible SPI programmer,
and implementation of the TCP over Wi-Fi for serprog,
I discovered that sp_flush_incoming() silently fails
if the underlying sp_fd descriptor is a TCP socket.
This patch adds a check for this case - tcflush returns ENOTTY,
meaning tcflush is not supported for not terminal objects,
in this case a fallback serialport_read_nonblock loop is used.
TESTED=esp32-serprog, TCP-over-WiFi mode, ~90% connection attempts fail to synchronize without patch; no synchronization issues with patch applied.
(cherry picked from commit bda8361453077a6db2f895eccd345f17bfabfb94)
Original-Signed-off-by: Stanislav Ponomarev <me@stasponomarev.com>
Original-Change-Id: I9724a2fcd4a41dede2c15f83877efa6c3b0b7fae
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/79112
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
GitOrigin-RevId: bda8361453077a6db2f895eccd345f17bfabfb94
Change-Id: I0ce1630723a4ba510a40518245110edd335fccce
Signed-off-by: chromeos-ci-prod <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/5061677
Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org>
Reviewed-by: Jian-Jia Su <jjsu@chromium.org>
Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org>
Tested-by: Hsuan Ting Chen <roccochen@chromium.org>
1 file changed