Skip to content

Commit

Permalink
Remove debug Alert() and add retries for mounter GetBlockSize/CheckPVD
Browse files Browse the repository at this point in the history
  • Loading branch information
LIV2 committed Aug 28, 2023
1 parent 2dbad3e commit f124e71
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion atapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ BYTE atapi_scsi_mode_sense_6(struct SCSICmd *cmd, struct IDEUnit *unit) {
*/
BYTE atapi_scsi_read_write_6 (struct SCSICmd *cmd, struct IDEUnit *unit) {
BYTE ret;
Alert(0xBADC0DE);
struct SCSI_CDB_10 *cdb = AllocMem(sizeof(struct SCSI_CDB_10),MEMF_ANY|MEMF_CLEAR);
if (!cdb) return TDERR_NoMem;

Expand Down
2 changes: 1 addition & 1 deletion device.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct DeviceBase {
#define DEVICE_DATE "(" __DATE__ ")"
#define DEVICE_ID_STRING "lide " XSTR(DEVICE_VERSION) "." XSTR(DEVICE_REVISION) " " DEVICE_DATE /* format is: 'name version.revision (d.m.yy)' */
#define DEVICE_VERSION 34
#define DEVICE_REVISION 1
#define DEVICE_REVISION 2
#define DEVICE_PRIORITY 0 /* Most people will not need a priority and should leave it at zero. */

#endif
13 changes: 10 additions & 3 deletions mounter.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ struct MountData
int GetBlockSize(struct IOStdReq *req) {
struct SCSICmd *cmd = MakeSCSICmd();
struct SCSI_READ_CAPACITY_10 *cdb = (struct SCSI_READ_CAPACITY_10 *)cmd->scsi_Command;
BYTE err;
int ret = -1;

struct SCSI_CAPACITY_10 *result = AllocMem(sizeof(struct SCSI_CAPACITY_10),MEMF_CLEAR|MEMF_ANY);
Expand All @@ -116,9 +117,11 @@ int GetBlockSize(struct IOStdReq *req) {
req->io_Data = cmd;
req->io_Length = sizeof(struct SCSICmd);

DoIO((struct IORequest *)req);
for (int retry = 0; retry < 3; retry++) {
if ((err = DoIO((struct IORequest *)req)) == 0) break;
}

if (req->io_Error == 0 && req->io_Length > 0) {
if (err == 0 && req->io_Length > 0) {
ret = result->block_size;
} else {
ret = -1;
Expand Down Expand Up @@ -159,7 +162,11 @@ bool CheckPVD(struct IOStdReq *ior) {

ior->io_Offset = (i + 16) << 11;

if ((err = DoIO((struct IORequest*)ior)) != 0 || (ior->io_Actual < 2048)) break;
for (int retry = 0; retry < 3; retry++) {
if ((err = DoIO((struct IORequest*)ior)) == 0) break;
}

if (ior->io_Actual < 2048) break;

// Check ISO ID String & for PVD Version & Type code
if ((strncmp(iso_id,id_string,5) == 0) && buf[0] == 1 && buf[6] == 1) {
Expand Down

0 comments on commit f124e71

Please sign in to comment.