Allow optical files that are set to RO on the SD card to be used

This commit is contained in:
Eric Helgeson 2022-12-22 08:52:34 -06:00
parent b117ebb39d
commit 208e3cdf9a

View File

@ -563,11 +563,8 @@ void findDriveImages(FsFile root) {
break; break;
} }
// Valid file, open for reading/writing. if(tolower(name[1]) != 'd')
file = new FsFile(SD.open(name, O_RDWR)); {
if(file && file->isFile()) {
SCSI_DEVICE_TYPE device_type;
if(tolower(name[1]) != 'd') {
file->close(); file->close();
delete file; delete file;
LOG_FILE.print("Not an image: "); LOG_FILE.print("Not an image: ");
@ -575,10 +572,16 @@ void findDriveImages(FsFile root) {
continue; continue;
} }
switch (tolower(name[0])) { SCSI_DEVICE_TYPE device_type;
case 'h': device_type = SCSI_DEVICE_HDD; switch (tolower(name[0]))
{
case 'h':
device_type = SCSI_DEVICE_HDD;
file = new FsFile(SD.open(name, O_RDWR));
break; break;
case 'c': device_type = SCSI_DEVICE_OPTICAL; case 'c':
device_type = SCSI_DEVICE_OPTICAL;
file = new FsFile(SD.open(name, O_RDONLY));
break; break;
default: default:
file->close(); file->close();
@ -588,7 +591,10 @@ void findDriveImages(FsFile root) {
continue; continue;
} }
// Defaults for Hard Disks // Valid file
if(file && file->isFile())
{
// Defaults drives
int id = 1; // 0 and 3 are common in Macs for physical HD and CD, so avoid them. int id = 1; // 0 and 3 are common in Macs for physical HD and CD, so avoid them.
int lun = 0; int lun = 0;
int blk = 512; int blk = 512;