diff --git a/cpp/devices/disk.cpp b/cpp/devices/disk.cpp index 63574ad343..8649103f0c 100644 --- a/cpp/devices/disk.cpp +++ b/cpp/devices/disk.cpp @@ -396,7 +396,12 @@ void Disk::SetUpModePages(map>& pages, int page, bool changeab void Disk::AddErrorPage(map>& pages, bool) const { // Retry count is 0, limit time uses internal default value - pages[1] = vector(12); + vector buf(12); + + // TB, PER, DTE (required for OpenVMS/VAX compatibility, see issue #1117) + buf[2] = (byte)0x26; + + pages[1] = buf; } void Disk::AddFormatPage(map>& pages, bool changeable) const diff --git a/cpp/test/mocks.h b/cpp/test/mocks.h index ef49fa6be1..f654054d65 100644 --- a/cpp/test/mocks.h +++ b/cpp/test/mocks.h @@ -3,7 +3,7 @@ // SCSI Target Emulator PiSCSI // for Raspberry Pi // -// Copyright (C) 2022 Uwe Seimet +// Copyright (C) 2022-2023 Uwe Seimet // //--------------------------------------------------------------------------- @@ -358,6 +358,7 @@ class MockSCSIHD : public SCSIHD //NOSONAR Ignore inheritance hierarchy depth in class MockSCSIHD_NEC : public SCSIHD_NEC //NOSONAR Ignore inheritance hierarchy depth in unit tests { FRIEND_TEST(ScsiHdNecTest, SetUpModePages); + FRIEND_TEST(ScsiHdNecTest, TestAddErrorPage); FRIEND_TEST(ScsiHdNecTest, TestAddFormatPage); FRIEND_TEST(ScsiHdNecTest, TestAddDrivePage); FRIEND_TEST(PiscsiExecutorTest, ProcessDeviceCmd); diff --git a/cpp/test/scsihd_nec_test.cpp b/cpp/test/scsihd_nec_test.cpp index 9ddf9a119a..cfff848545 100644 --- a/cpp/test/scsihd_nec_test.cpp +++ b/cpp/test/scsihd_nec_test.cpp @@ -3,7 +3,7 @@ // SCSI Target Emulator PiSCSI // for Raspberry Pi // -// Copyright (C) 2022 Uwe Seimet +// Copyright (C) 2022-2023 Uwe Seimet // //--------------------------------------------------------------------------- @@ -47,6 +47,20 @@ TEST(ScsiHdNecTest, SetUpModePages) ScsiHdNecTest_SetUpModePages(pages); } +TEST(ScsiHdNecTest, TestAddErrorPage) +{ + map> pages; + MockSCSIHD_NEC hd(0); + + hd.SetBlockCount(0x1234); + hd.SetReady(true); + // Non changeable + hd.SetUpModePages(pages, 0x01, false); + EXPECT_EQ(1, pages.size()) << "Unexpected number of mode pages"; + const vector& page_1 = pages[1]; + EXPECT_EQ(0x26, to_integer(page_1[2])); +} + TEST(ScsiHdNecTest, TestAddFormatPage) { map> pages;