Răsfoiți Sursa

Adjust logic for supported vendor commands

There isn't any functional change in this fix, just a rearrangement
with if else statements to address this issue: https://github.com/ZuluSCSI/ZuluSCSI-firmware/issues/432
Also a for loop wasn't initialized in `src/ZuluSCSI.cpp`, set the
counter to 0.
Morio 1 an în urmă
părinte
comite
37f990df85
2 a modificat fișierele cu 13 adăugiri și 14 ștergeri
  1. 12 13
      lib/SCSI2SD/src/firmware/vendor.c
  2. 1 1
      src/ZuluSCSI.cpp

+ 12 - 13
lib/SCSI2SD/src/firmware/vendor.c

@@ -185,7 +185,16 @@ int scsiVendorCommand()
 
 void scsiVendorCommandSetLen(uint8_t command, uint8_t* command_length)
 {
-	if (scsiDev.target->cfg->deviceType == S2S_CFG_OPTICAL)
+	if (scsiToolboxEnabled())
+	{
+		// Conflicts with Apple CD-ROM audio over SCSI bus and Plextor CD-ROM D8 extension
+		// Will override those commands if enabled
+		if (0xD0 <= command && command <= 0xDA)
+		{
+			*command_length = 10;
+		}
+	}
+	else if (scsiDev.target->cfg->deviceType == S2S_CFG_OPTICAL)
 	{
 		// Apple CD-ROM with CD audio over the SCSI bus
 		if (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_APPLE && (command == 0xD8 || command == 0xD9))
@@ -193,19 +202,9 @@ void scsiVendorCommandSetLen(uint8_t command, uint8_t* command_length)
 			*command_length =  12;
 		}
 		// Plextor CD-ROM vendor extensions 0xD8
-		if (unlikely(scsiDev.target->cfg->vendorExtensions & VENDOR_EXTENSION_OPTICAL_PLEXTOR) && command == 0xD8)
+		else if (unlikely(scsiDev.target->cfg->vendorExtensions & VENDOR_EXTENSION_OPTICAL_PLEXTOR) && command == 0xD8)
 		{
 			*command_length =  12;
 		}
 	}
-
-	if (scsiToolboxEnabled())
-	{
-		// Conflicts with Apple CD-ROM audio over SCSI bus and Plextor CD-ROM D8 extension
-		// Will override those commands if enabled
-		if (0xD0 <= command && command <= 0xDA)
-		{
-			*command_length = 10;
-		}
-	}
-}
+}

+ 1 - 1
src/ZuluSCSI.cpp

@@ -580,7 +580,7 @@ bool findHDDImages()
     }
   }
   // count the removable drives and drive with eject enabled
-  for (uint8_t id; id < S2S_MAX_TARGETS; id++)
+  for (uint8_t id = 0; id < S2S_MAX_TARGETS; id++)
   {
     const S2S_TargetCfg* cfg = s2s_getConfigByIndex(id);
     if (cfg  && (cfg->scsiId & S2S_CFG_TARGET_ENABLED ))