Commit dd44bd45 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL

Revisit residue override logic

In SCSISoftUSB-0_27 all residue values were replaced with a locally computed one, however this seems to be tripped up by some brands of CD/DVD-ROM drive which stall, resulting in a differently wrong value being placed in the residue. Combat this by only replacing the residue with a locally computed one if it's obviously incorrect (as would be the case for reversed endianness and garbage upper byte).

Thanks to Doug Webb, Chris Dale, and Chris Hall for helping test this on a variety of devices at their disposal; this restores some makes of drive that worked with SCSISoftUSB-0_26 and earlier, while also adding classes of quirky ones that now work.

Version 0.28. Tagged as 'SCSISoftUSB-0_28'
parent 70347aa3
/* (0.27) /* (0.28)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 0.27 #define Module_MajorVersion_CMHG 0.28
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Apr 2019 #define Module_Date_CMHG 18 May 2020
#define Module_MajorVersion "0.27" #define Module_MajorVersion "0.28"
#define Module_Version 27 #define Module_Version 28
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "18 Apr 2019" #define Module_Date "18 May 2020"
#define Module_ApplicationDate "18-Apr-19" #define Module_ApplicationDate "18-May-20"
#define Module_ComponentName "SCSISoftUSB" #define Module_ComponentName "SCSISoftUSB"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/SCSI/SCSISoftUSB"
#define Module_FullVersion "0.27" #define Module_FullVersion "0.28"
#define Module_HelpVersion "0.27 (18 Apr 2019)" #define Module_HelpVersion "0.28 (18 May 2020)"
#define Module_LibraryVersionInfo "0:27" #define Module_LibraryVersionInfo "0:28"
...@@ -1543,11 +1543,13 @@ umass_bbb_state( ...@@ -1543,11 +1543,13 @@ umass_bbb_state(
DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw)); DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw));
#ifdef __riscos #ifdef __riscos
/* Based on an idea from umass.c revision 1.146 (which is some way /* Rather than have a large table of UMASS_QUIRK_IGNORE_RESIDUE, only believe the
* ahead), rather than have a large table of UMASS_QUIRK_IGNORE_RESIDUE * returned value if it's plausibly less than the amount requested in the first
* ignore the csw and always use what the USB stack actually transferred. * place, otherwise replace it with what the USB stack thinks it did. This catches endian
* swap and garbage upper bytes, which seemed to be the most common class of quirk.
*/ */
USETDW(sc->csw.dCSWDataResidue, sc->transfer_datalen - sc->transfer_actlen); if (UGETDW(sc->csw.dCSWDataResidue) > sc->transfer_datalen)
USETDW(sc->csw.dCSWDataResidue, sc->transfer_datalen - sc->transfer_actlen);
#endif #endif
/* Translate weird command-status signatures. */ /* Translate weird command-status signatures. */
if ((sc->sc_quirks & UMASS_QUIRK_WRONG_CSWSIG) && if ((sc->sc_quirks & UMASS_QUIRK_WRONG_CSWSIG) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment