Add support for SCSI-1 CD Drives, .is1 extension (#1109)

* Add SCSI-1 option for scsicd with file extension is1

Update tests

Update documentation with is1 file extension

* Fix tests
This commit is contained in:
nsafran1217 2023-02-26 21:52:19 -05:00 committed by GitHub
parent 059a31ba53
commit bf97201580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 7 deletions

View File

@ -59,6 +59,7 @@ DeviceFactory::DeviceFactory()
extension_mapping["hdr"] = SCRM;
extension_mapping["mos"] = SCMO;
extension_mapping["iso"] = SCCD;
extension_mapping["is1"] = SCCD;
device_mapping["bridge"] = SCBR;
device_mapping["daynaport"] = SCDP;
@ -118,7 +119,8 @@ shared_ptr<PrimaryDevice> DeviceFactory::CreateDevice(PbDeviceType type, int lun
break;
case SCCD:
device = make_shared<SCSICD>(lun, sector_sizes.find(SCCD)->second);
device = make_shared<SCSICD>(lun, sector_sizes.find(SCCD)->second,
GetExtensionLowerCase(filename) == "is1" ? scsi_level::SCSI_1_CCS : scsi_level::SCSI_2);
device->SetProduct("SCSI CD-ROM");
break;

View File

@ -21,7 +21,8 @@
using namespace scsi_defs;
using namespace scsi_command_util;
SCSICD::SCSICD(int lun, const unordered_set<uint32_t>& sector_sizes) : Disk(SCCD, lun)
SCSICD::SCSICD(int lun, const unordered_set<uint32_t>& sector_sizes, scsi_defs::scsi_level level)
: Disk(SCCD, lun), scsi_level(level)
{
SetSectorSizes(sector_sizes);
@ -164,7 +165,7 @@ void SCSICD::ReadToc()
vector<uint8_t> SCSICD::InquiryInternal() const
{
return HandleInquiry(device_type::CD_ROM, scsi_level::SCSI_2, true);
return HandleInquiry(device_type::CD_ROM, scsi_level, true);
}
void SCSICD::SetUpModePages(map<int, vector<byte>>& pages, int page, bool changeable) const

View File

@ -22,7 +22,7 @@ class SCSICD : public Disk, private ScsiMmcCommands
{
public:
SCSICD(int, const unordered_set<uint32_t>&);
SCSICD(int, const unordered_set<uint32_t>&, scsi_defs::scsi_level = scsi_level::SCSI_2);
~SCSICD() override = default;
bool Init(const unordered_map<string, string>&) override;
@ -43,6 +43,7 @@ private:
void AddCDROMPage(map<int, vector<byte>>&, bool) const;
void AddCDDAPage(map<int, vector<byte>>&, bool) const;
scsi_defs::scsi_level scsi_level;
void OpenIso();
void OpenPhysical();

View File

@ -62,7 +62,8 @@ void Piscsi::Banner(const vector<char *>& args) const
cout << " hdi : SCSI HD image (Anex86 HD image)\n";
cout << " nhd : SCSI HD image (T98Next HD image)\n";
cout << " mos : SCSI MO image (MO image)\n";
cout << " iso : SCSI CD image (ISO 9660 image)\n" << flush;
cout << " iso : SCSI CD image (ISO 9660 image)\n";
cout << " is1 : SCSI CD image (ISO 9660 image, SCSI-1)\n" << flush;
exit(EXIT_SUCCESS);
}

View File

@ -29,6 +29,7 @@ TEST(DeviceFactoryTest, GetTypeForFile)
EXPECT_EQ(device_factory.GetTypeForFile("test.hdr"), SCRM);
EXPECT_EQ(device_factory.GetTypeForFile("test.mos"), SCMO);
EXPECT_EQ(device_factory.GetTypeForFile("test.iso"), SCCD);
EXPECT_EQ(device_factory.GetTypeForFile("test.is1"), SCCD);
EXPECT_EQ(device_factory.GetTypeForFile("test.suffix.iso"), SCCD);
EXPECT_EQ(device_factory.GetTypeForFile("bridge"), SCBR);
EXPECT_EQ(device_factory.GetTypeForFile("daynaport"), SCDP);
@ -79,7 +80,7 @@ TEST(DeviceFactoryTest, GetExtensionMapping)
DeviceFactory device_factory;
unordered_map<string, PbDeviceType> mapping = device_factory.GetExtensionMapping();
EXPECT_EQ(9, mapping.size());
EXPECT_EQ(10, mapping.size());
EXPECT_EQ(SCHD, mapping["hd1"]);
EXPECT_EQ(SCHD, mapping["hds"]);
EXPECT_EQ(SCHD, mapping["hda"]);
@ -89,6 +90,7 @@ TEST(DeviceFactoryTest, GetExtensionMapping)
EXPECT_EQ(SCRM, mapping["hdr"]);
EXPECT_EQ(SCMO, mapping["mos"]);
EXPECT_EQ(SCCD, mapping["iso"]);
EXPECT_EQ(SCCD, mapping["is1"]);
}
TEST(DeviceFactoryTest, GetDefaultParams)

View File

@ -221,5 +221,5 @@ TEST(PiscsiResponseTest, GetMappingInfo)
const auto& info = response.GetMappingInfo(result);
EXPECT_TRUE(result.status());
EXPECT_EQ(9, info->mapping().size());
EXPECT_EQ(10, info->mapping().size());
}

View File

@ -30,6 +30,8 @@ void ScsiCdTest_SetUpModePages(map<int, vector<byte>>& pages)
TEST(ScsiCdTest, Inquiry)
{
TestInquiry(SCCD, device_type::CD_ROM, scsi_level::SCSI_2, "PiSCSI SCSI CD-ROM ", 0x1f, true);
TestInquiry(SCCD, device_type::CD_ROM, scsi_level::SCSI_1_CCS, "PiSCSI SCSI CD-ROM ", 0x1f, true, ".is1");
}
TEST(ScsiCdTest, SetUpModePages)

View File

@ -34,6 +34,7 @@ PiSCSI will determine the type of device based upon the file extension of the FI
hda: SCSI Hard Disk image (Apple compatible - typically used with Macintosh computers)
mos: SCSI Magneto-Optical image (generic - typically used with NeXT, X68000, etc.)
iso: SCSI CD-ROM or DVD-ROM image (ISO 9660 image)
is1: SCSI CD-ROM or DVD-ROM image (ISO 9660 image, SCSI-1)
For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command:
sudo piscsi -ID0 /path/to/drive/hdimage.hda

View File

@ -29,6 +29,7 @@ DESCRIPTION
hda: SCSI Hard Disk image (Apple compatible - typically used with Macintosh computers)
mos: SCSI Magneto-Optical image (generic - typically used with NeXT, X68000, etc.)
iso: SCSI CD-ROM or DVD-ROM image (ISO 9660 image)
is1: SCSI CD-ROM or DVD-ROM image (ISO 9660 image, SCSI-1)
For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command:
sudo piscsi -ID0 /path/to/drive/hdimage.hda