From 6154cc08db17167a19c13d7e9287727e736eb3d1 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 2 Dec 2020 14:44:16 +0100 Subject: [PATCH] serial: fix maxspeed hang at boot reading from console --- core/hw/sh4/modules/serial.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/hw/sh4/modules/serial.cpp b/core/hw/sh4/modules/serial.cpp index de51cd974..c3251ff92 100644 --- a/core/hw/sh4/modules/serial.cpp +++ b/core/hw/sh4/modules/serial.cpp @@ -79,7 +79,8 @@ static u32 ReadSerialStatus(u32 addr) { #if HOST_OS == OS_LINUX || defined(__APPLE__) int count = 0; - if (settings.debug.SerialConsole && ioctl(tty, FIONREAD, &count) == 0 && count > 0) + if (settings.debug.SerialConsole && tty != 1 + && ioctl(tty, FIONREAD, &count) == 0 && count > 0) { return SCIF_SCFSR2.full | 2; } @@ -112,7 +113,8 @@ static u32 Read_SCFDR2(u32 addr) static u32 ReadSerialData(u32 addr) { u8 data = 0; - read(tty, &data, 1); + if (tty != 1) + read(tty, &data, 1); return data; }