Commits (2)
  • Robert Sprowson's avatar
    Simplify makefile · c8e6cf87
    Robert Sprowson authored
    Defaut RES_PATH, CModule now includes its dependents itself, -ff flag also handled for debug builds automatically.
    
    Version 0.05. Tagged as 'SCSI-0_05'
    c8e6cf87
  • Jeffrey Lee's avatar
    Fix drive lock status reporting for empty drives · dd460369
    Jeffrey Lee authored
    Detail:
      c/driver - Change IsDrawerLocked handler to read the lock status from the drive via mode page &2A, rather than doing a completely unrelated TEST UNIT READY command. On the offchance that &2A isn't implemented, just fall back on our softcopy of the lock state, which is effectively what TEST UNIT READY was doing in the first place.
      h/scsibits - Fix typo in mode page &2A name
    Admin:
      Tested on BB-xM
      CD_IsDrawerLocked now returns a sensible value for empty drives, instead of a drive empty error
      Fixes issue reported on forums where CDFS iconbar menu doesn't allow empty drives to be ejected (for SCSI/USB, at least):
      https://www.riscosopen.org/forum/forums/4/topics/3652
    
    
    Version 0.06. Tagged as 'SCSI-0_06'
    dd460369
......@@ -43,19 +43,14 @@ CMHGFILE = modhead
HDRS =
CINCLUDES = -Itbox:
CFLAGS += -ff -wp -wc
CFLAGS += -wp -wc
CMHGDEFINES = -DCOMPONENT=${COMPONENT}
CMHGDEPENDS = cmodule driver
RAMCDEFINES = -DSTANDALONE
RESFSDIR = ${RESDIR}.CDFSDriver.SCSI
RES_PATH = Resources.CDFSDriver.SCSI.Messages
RES_OBJ = messages
include StdTools
include ModStdRule
include ModuleLibs
include DbgRules
include CModule
# Dynamic dependencies:
/* (0.04)
/* (0.06)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.04
#define Module_MajorVersion_CMHG 0.06
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Aug 2013
#define Module_Date_CMHG 10 Feb 2018
#define Module_MajorVersion "0.04"
#define Module_Version 4
#define Module_MajorVersion "0.06"
#define Module_Version 6
#define Module_MinorVersion ""
#define Module_Date "22 Aug 2013"
#define Module_Date "10 Feb 2018"
#define Module_ApplicationDate "22-Aug-13"
#define Module_ApplicationDate "10-Feb-18"
#define Module_ComponentName "SCSI"
#define Module_ComponentPath "bsd/RiscOS/Sources/HWSupport/CD/SCSI"
#define Module_FullVersion "0.04"
#define Module_HelpVersion "0.04 (22 Aug 2013)"
#define Module_LibraryVersionInfo "0:4"
#define Module_FullVersion "0.06"
#define Module_HelpVersion "0.06 (10 Feb 2018)"
#define Module_LibraryVersionInfo "0:6"
......@@ -109,12 +109,12 @@ static uint32_t GetDrawerStatus(const cdfs_ctl_block_t *blk)
return ((*byte)>>(blk->lun)) & 1;
}
static void SetDrawerStatus(const cdfs_ctl_block_t *blk,uint32_t changed)
static void SetDrawerStatus(const cdfs_ctl_block_t *blk,uint32_t locked)
{
uint8_t *byte = DrawerStatusBits+blk->device+(blk->card<<3);
uint8_t val = *byte;
uint8_t flag = 1<<blk->lun;
if(changed)
if(locked)
val |= flag;
else
val &= ~flag;
......@@ -457,7 +457,7 @@ static _kernel_oserror *driver_GetParameters(cdfs_parameters_t *params,const cdf
params->readretrycount = MODEPAGE_RWER_ReadRetryCount_Read(page); /* Common offset in both forms */
#if 0
/* Find page 0x2a for speed setting */
page = FindModePage(SCSIOp_MiscBuffer+8,result-8,PageCode_MMCapabilitiesAndManualStatus);
page = FindModePage(SCSIOp_MiscBuffer+8,result-8,PageCode_MMCapabilitiesAndMechanicalStatus);
if(!page)
{
dprintf(("", " Couldn't find page 0x2a\n"));
......@@ -879,10 +879,32 @@ static _kernel_oserror *driver_IsDrawerLocked(uint32_t *locked,const cdfs_ctl_bl
{
if(!locked)
return ERROR(BadArgs);
SCSI_CREATEBLOCK(SCB,TESTUNITREADY,6);
_kernel_oserror *e = DoSCSIOp(SCSIOP_NODATA|SCSIOP_NOESCAPE,SCB,sizeof(SCB),NULL,0,0,NULL,blk,retries);
if(!e)
*locked = GetDrawerStatus(blk);
/* Perform MODE SENSE 10 to get list of mode pages */
uint32_t result;
_kernel_oserror *e = ModeSense(PageCode_All,&result,blk,retries);
if(e)
return e;
uint8_t *page;
/* Find page 0x2a for lock setting */
page = FindModePage(SCSIOp_MiscBuffer+8,result-8,PageCode_MMCapabilitiesAndMechanicalStatus);
if(!page)
{
dprintf(("", " Couldn't find page 0x2a\n"));
DumpBlock(SCSIOp_MiscBuffer,result);
}
else if(MODEPAGEHDR_PageLength_Read(page) < 28)
{
dprintf(("", " Unexpected 0x2a page length\n"));
DumpBlock(SCSIOp_MiscBuffer,result);
}
else
{
/* Page found, use it to update our softcopy of the lock state */
dprintf(("", " Locking flags: %x\n",page[6] & 3));
SetDrawerStatus(blk,page[6] & 2);
}
/* Return softcopy of the state (which will be the real state, if the drive supports the relevant mode page. Else assume lock state has remained the same as when we last set it) */
*locked = GetDrawerStatus(blk);
return e;
}
......
......@@ -183,7 +183,7 @@ typedef enum {
PageCode_ReadWriteErrorRecovery=0x01,
PageCode_CDDeviceParameters=0x0d,
PageCode_CDAudioControl=0x0e,
PageCode_MMCapabilitiesAndManualStatus=0x2a,
PageCode_MMCapabilitiesAndMechanicalStatus=0x2a,
PageCode_All = 0x3f,
} PageCode;
......