diff --git a/README.md b/README.md
index c8d7e7df..729a334b 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,6 @@ I am also the author of the HDDRIVER driver s
# How is SCSI2Pi related to PiSCSI?
-In the PiSCSI project there was not much interest in replacing old, often buggy or unnecessary code, or to improve the data transfer rates. Long promised features on the roadmap and user requests in tickets were not addressed, and it took long for features or bug fixes to make it into a release. This is why I started to work on the emulation in a separate project, while staying compatible with the PiSCSI web interface. The major part of the PiSCSI C++ codebase has been contributed by me anyway. SCSI2Pi is not meant to completely replace the PiSCSI software, but only the device emulation and the tools.
+In the PiSCSI project there was not much interest in replacing old, often buggy or unnecessary code, or to improve the data transfer rates. Long promised features on the roadmap and user requests in tickets were not addressed, and it took long for features or bug fixes to make it into a release. This is why I started to work on the emulation in a separate project, while staying compatible with the PiSCSI web interface. The major part of the PiSCSI C++ codebase has been contributed by me anyway. SCSI2Pi is not meant to fully replace/extend the PiSCSI software, but only the device emulation and the tools.
With PiSCSI there was also not much interest in further developing the SCSI emulation and exploiting the initiator mode feature of the FULLSPEC board. This mode, together with new SCSI2Pi command line tools, offers solutions for use cases that have never been addressed before. These tools also help with advanced testing, making the emulation more robust and reliable.
The SCSI2Pi website offers an overview on differences between SCSI2Pi and PiSCSI.
diff --git a/cpp/base/property_handler.cpp b/cpp/base/property_handler.cpp
index 2305fd25..0b527bef 100644
--- a/cpp/base/property_handler.cpp
+++ b/cpp/base/property_handler.cpp
@@ -23,7 +23,7 @@ void PropertyHandler::Init(const string &filenames, const property_map &cmd_prop
property_map properties;
- // Always parse the optional global property file
+ // Parse the optional global property file unless disabled
if (!ignore_conf && exists(path(CONFIGURATION))) {
ParsePropertyFile(properties, CONFIGURATION, true);
}
diff --git a/cpp/controllers/controller.cpp b/cpp/controllers/controller.cpp
index a2275cb7..e1e04968 100644
--- a/cpp/controllers/controller.cpp
+++ b/cpp/controllers/controller.cpp
@@ -607,7 +607,7 @@ void Controller::LogCdb() const
{
const auto opcode = static_cast(GetCdb()[0]);
const string_view &command_name = BusFactory::Instance().GetCommandName(opcode);
- string s = fmt::format("Controller is executing {}, CDB $",
+ string s = fmt::format("Controller is executing {}, CDB ",
!command_name.empty() ? command_name : fmt::format("{:02x}", GetCdb()[0]));
for (int i = 0; i < BusFactory::Instance().GetCommandBytesCount(opcode); i++) {
if (i) {
diff --git a/cpp/devices/host_services.cpp b/cpp/devices/host_services.cpp
index 0e960066..33791753 100644
--- a/cpp/devices/host_services.cpp
+++ b/cpp/devices/host_services.cpp
@@ -278,7 +278,6 @@ void HostServices::AddRealtimeClockPage(map> &pages, bool chan
int HostServices::WriteData(span buf, scsi_command command)
{
- assert(command == scsi_command::execute_operation);
if (command != scsi_command::execute_operation) {
throw scsi_exception(sense_key::aborted_command);
}
diff --git a/cpp/devices/storage_device.cpp b/cpp/devices/storage_device.cpp
index a6a0e1a7..daf61b16 100644
--- a/cpp/devices/storage_device.cpp
+++ b/cpp/devices/storage_device.cpp
@@ -135,7 +135,7 @@ void StorageDevice::ModeSelect(cdb_t cdb, span buf, int length)
{
// PF
if (!(cdb[1] & 0x10)) {
- // Vendor-specific parameters (SCSI-1) are not supported.
+ // Vendor-specific parameters (all parameters in SCSI-1 are vendor-specific) are not supported.
// Do not report an error in order to support Apple's HD SC Setup.
return;
}
diff --git a/cpp/devices/tape.cpp b/cpp/devices/tape.cpp
index 6fcba8f6..e15fcdac 100644
--- a/cpp/devices/tape.cpp
+++ b/cpp/devices/tape.cpp
@@ -349,23 +349,11 @@ void Tape::AddDeviceConfigurationPage(map> &pages, bool change
void Tape::AddMediumPartitionPage(map > &pages, bool changeable) const
{
- vector buf(10);
+ vector buf(8);
if (!changeable) {
- // Maximum additional partitions
- buf[2] = (byte)1;
-
- // PSUM (descriptor unit in MB)
- buf[4] = (byte)0b00010000;
-
- // Logical unit is capable of format and partition recognition
- buf[5] = (byte)0x03;
-
- // Approximate partition size in MB
- if (IsReady()) {
- const auto capacity = static_cast(GetFileSize()) / 1048576;
- SetInt16(buf, 8, capacity > 0 ? capacity : 1);
- }
+ // Fixed data partitions, PSUM (descriptor unit in MB)
+ buf[4] = (byte)0b10010000;
}
pages[17] = buf;
diff --git a/cpp/test/controller_factory_test.cpp b/cpp/test/controller_factory_test.cpp
index 163e0c42..b2c7d7cb 100644
--- a/cpp/test/controller_factory_test.cpp
+++ b/cpp/test/controller_factory_test.cpp
@@ -72,7 +72,18 @@ TEST(ControllerFactoryTest, AttachToController)
TEST(ControllerFactoryTest, ProcessOnController)
{
+ const int VALID_ID = 0;
+ const int INVALID_ID = 1;
+
+ MockBus bus;
ControllerFactory controller_factory;
- EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(0));
+ EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(VALID_ID));
+
+ const auto device = make_shared(0);
+ EXPECT_TRUE(controller_factory.AttachToController(bus, VALID_ID, device));
+
+ EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(VALID_ID));
+
+ EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(INVALID_ID));
}
diff --git a/cpp/test/host_services_test.cpp b/cpp/test/host_services_test.cpp
index a3ebbec4..43603e9f 100644
--- a/cpp/test/host_services_test.cpp
+++ b/cpp/test/host_services_test.cpp
@@ -208,6 +208,8 @@ TEST(HostServicesTest, WriteData)
auto [controller, services] = CreateDevice(SCHS);
array buf = { };
+ EXPECT_THROW(services->WriteData(buf, scsi_command::test_unit_ready), scsi_exception)<< "Illegal command";
+
EXPECT_EQ(0, services->WriteData(buf, scsi_command::execute_operation));
controller->SetCdbByte(8, 1);
diff --git a/cpp/test/tape_test.cpp b/cpp/test/tape_test.cpp
index f8cce892..b46a95b1 100644
--- a/cpp/test/tape_test.cpp
+++ b/cpp/test/tape_test.cpp
@@ -26,7 +26,7 @@ static void ValidateModePages(map> &pages)
EXPECT_EQ(8U, pages[10].size());
EXPECT_EQ(16U, pages[15].size());
EXPECT_EQ(16U, pages[16].size());
- EXPECT_EQ(10U, pages[17].size());
+ EXPECT_EQ(8U, pages[17].size());
}
static void CheckPosition(AbstractController &controller, PrimaryDevice &tape, uint32_t position)
diff --git a/doc/s2pctl.1 b/doc/s2pctl.1
index 8b97508d..6f4db9ab 100644
--- a/doc/s2pctl.1
+++ b/doc/s2pctl.1
@@ -1,4 +1,4 @@
-.TH s2p 1
+.TH s2pctl 1
.SH NAME
s2pctl \- SCSI2Pi Server Controller Tool
.SH SYNOPSIS