diff --git a/src/raspberrypi/devices/scsi_daynaport.cpp b/src/raspberrypi/devices/scsi_daynaport.cpp index 048bce05..ae334d68 100644 --- a/src/raspberrypi/devices/scsi_daynaport.cpp +++ b/src/raspberrypi/devices/scsi_daynaport.cpp @@ -221,7 +221,7 @@ int FASTCALL SCSIDaynaPort::Read(const DWORD *cdb, BYTE *buf, DWORD block) // Some of the packets we receive will not be for us. So, we'll keep pulling messages // until the buffer is empty, or we've read X times. (X is just a made up number) - while(read_count < 50) + while(read_count < MAX_READ_RETRIES) { read_count++; diff --git a/src/raspberrypi/devices/scsi_daynaport.h b/src/raspberrypi/devices/scsi_daynaport.h index 933b8667..8c682cc0 100644 --- a/src/raspberrypi/devices/scsi_daynaport.h +++ b/src/raspberrypi/devices/scsi_daynaport.h @@ -78,6 +78,12 @@ public: static const BYTE CMD_SCSILINK_SETMODE = 0x80; static const BYTE CMD_SCSILINK_SETMAC = 0x40; + // When we're reading the Linux tap device, most of the messages will not be for us, so we + // need to filter through those. However, we don't want to keep re-reading the packets + // indefinitely. So, we'll pick a large-ish number that will cause the emulated DaynaPort + // to respond with "no data" after MAX_READ_RETRIES tries. + static const int MAX_READ_RETRIES = 50; + // The READ response has a header which consists of: // 2 bytes - payload size // 4 bytes - status flags diff --git a/src/raspberrypi/gpiobus.cpp b/src/raspberrypi/gpiobus.cpp index 8c0c71df..a06bb57a 100644 --- a/src/raspberrypi/gpiobus.cpp +++ b/src/raspberrypi/gpiobus.cpp @@ -1164,6 +1164,7 @@ int FASTCALL GPIOBUS::SendHandShake(BYTE *buf, int count, int delay_after_bytes) for (i = 0; i < count; i++) { if(i==delay_after_bytes){ + LOGTRACE("%s DELAYING for %dus after %d bytes", __PRETTY_FUNCTION__, SCSI_DELAY_SEND_DATA_DAYNAPORT_US, (int)delay_after_bytes); SysTimer::SleepUsec(SCSI_DELAY_SEND_DATA_DAYNAPORT_US); }