diff --git a/cpp/base/primary_device.h b/cpp/base/primary_device.h index 9476ff8a..57372117 100644 --- a/cpp/base/primary_device.h +++ b/cpp/base/primary_device.h @@ -24,13 +24,14 @@ using namespace scsi_defs; class PrimaryDevice: private ScsiPrimaryCommands, public Device { - friend class AbstractController; + friend class AbstractController; using operation = function; public: - PrimaryDevice(PbDeviceType type, int lun) : Device(type, lun) {} + PrimaryDevice(PbDeviceType type, int lun, int delay_after_bytes = BUS::SEND_NO_DELAY) + : Device(type, lun), send_delay(delay_after_bytes) { } ~PrimaryDevice() override = default; virtual bool Init(const param_map&); @@ -68,8 +69,6 @@ class PrimaryDevice: private ScsiPrimaryCommands, public Device virtual vector InquiryInternal() const = 0; void CheckReady(); - void SetSendDelay(int s) { send_delay = s; } - void Inquiry() override; void RequestSense() override; @@ -107,7 +106,7 @@ class PrimaryDevice: private ScsiPrimaryCommands, public Device unordered_map commands; - int send_delay = BUS::SEND_NO_DELAY; + int send_delay; int reserving_initiator = NOT_RESERVED; }; diff --git a/cpp/devices/daynaport.cpp b/cpp/devices/daynaport.cpp index 21089bd5..b2b2392b 100644 --- a/cpp/devices/daynaport.cpp +++ b/cpp/devices/daynaport.cpp @@ -27,7 +27,8 @@ using namespace scsi_defs; using namespace scsi_command_util; -SCSIDaynaPort::SCSIDaynaPort(int lun) : PrimaryDevice(SCDP, lun) +// The MacOS Daynaport driver needs to have a delay after the size/flags field of the read response +SCSIDaynaPort::SCSIDaynaPort(int lun) : PrimaryDevice(SCDP, lun, DAYNAPORT_READ_HEADER_SZ) { SupportsParams(true); } @@ -44,9 +45,6 @@ bool SCSIDaynaPort::Init(const param_map& params) AddCommand(scsi_command::cmd_set_mcast_addr, [this] { SetMcastAddr(); }); AddCommand(scsi_command::cmd_enable_interface, [this] { EnableInterface(); }); - // The MacOS Daynaport driver needs to have a delay after the size/flags field of the read response - SetSendDelay(DAYNAPORT_READ_HEADER_SZ); - tap_enabled = tap.Init(GetParams()); if (!tap_enabled) { // Not terminating on a regular PC is helpful for testing diff --git a/cpp/test/mocks.h b/cpp/test/mocks.h index 3c49703d..89961bcc 100644 --- a/cpp/test/mocks.h +++ b/cpp/test/mocks.h @@ -236,7 +236,6 @@ class MockPrimaryDevice : public PrimaryDevice FRIEND_TEST(PrimaryDeviceTest, TestUnitReady); FRIEND_TEST(PrimaryDeviceTest, RequestSense); FRIEND_TEST(PrimaryDeviceTest, Inquiry); - FRIEND_TEST(PrimaryDeviceTest, GetSetSendDelay); FRIEND_TEST(ScsiControllerTest, RequestSense); FRIEND_TEST(S2pExecutorTest, ValidateOperationAgainstDevice); diff --git a/cpp/test/primary_device_test.cpp b/cpp/test/primary_device_test.cpp index 55e15983..2f4176a6 100644 --- a/cpp/test/primary_device_test.cpp +++ b/cpp/test/primary_device_test.cpp @@ -338,15 +338,6 @@ TEST(PrimaryDeviceTest, WriteByteSequence) EXPECT_FALSE(device->WriteByteSequence({})) << "Primary device does not support writing byte sequences"; } -TEST(PrimaryDeviceTest, GetSetSendDelay) -{ - MockPrimaryDevice device(0); - - EXPECT_EQ(-1, device.GetSendDelay()) << "Wrong delay default value"; - device.SetSendDelay(1234); - EXPECT_EQ(1234, device.GetSendDelay()); -} - TEST(PrimaryDeviceTest, Init) { param_map params;