Переглянути джерело

Handle condition where there is a vendor-specific mode page present.

In addition to trying to fix vendor-specific mode pages that won't be understood, this works around a problem on modern Linux: with block descriptors present in MODE SENSE, changing volume via mmc_io_cdrom_volume() in cdrom.c appears to send block descriptor information following the 0x0E page update.
saybur 2 роки тому
батько
коміт
30db7a4ca9
1 змінених файлів з 7 додано та 1 видалено
  1. 7 1
      lib/SCSI2SD/src/firmware/mode.c

+ 7 - 1
lib/SCSI2SD/src/firmware/mode.c

@@ -623,10 +623,16 @@ static void doModeSelect(void)
 
 		while (idx < scsiDev.dataLen)
 		{
+			// Change from SCSI2SD: if code page is 0x0 (vendor-specific) it
+			// will not follow the normal page mode format and cannot be
+			// parsed, but isn't necessarily an error. Instead, just treat it
+			// as an 'end of data' field and allow normal command completion.
+			int pageCode = scsiDev.data[idx] & 0x3F;
+			if (pageCode == 0) goto out;
+
 			int pageLen = scsiDev.data[idx + 1];
 			if (idx + 2 + pageLen > scsiDev.dataLen) goto bad;
 
-			int pageCode = scsiDev.data[idx] & 0x3F;
 			switch (pageCode)
 			{
 			case 0x03: // Format Device Page