Commit efd12171 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix drive lock status reporting for empty drives

Detail:
  s/DriverCode - 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.
Admin:
  Tested on Iyonix
  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 ATAPI, at least):
  https://www.riscosopen.org/forum/forums/4/topics/3652


Version 1.44. Tagged as 'ATAPI-1_44'
parent c5fb0382
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.43"
Module_Version SETA 143
Module_MajorVersion SETS "1.44"
Module_Version SETA 144
Module_MinorVersion SETS ""
Module_Date SETS "22 Apr 2017"
Module_ApplicationDate SETS "22-Apr-17"
Module_Date SETS "10 Feb 2018"
Module_ApplicationDate SETS "10-Feb-18"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.43"
Module_HelpVersion SETS "1.43 (22 Apr 2017)"
Module_FullVersion SETS "1.44"
Module_HelpVersion SETS "1.44 (10 Feb 2018)"
END
/* (1.43)
/* (1.44)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.43
#define Module_MajorVersion_CMHG 1.44
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Apr 2017
#define Module_Date_CMHG 10 Feb 2018
#define Module_MajorVersion "1.43"
#define Module_Version 143
#define Module_MajorVersion "1.44"
#define Module_Version 144
#define Module_MinorVersion ""
#define Module_Date "22 Apr 2017"
#define Module_Date "10 Feb 2018"
#define Module_ApplicationDate "22-Apr-17"
#define Module_ApplicationDate "10-Feb-18"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.43"
#define Module_HelpVersion "1.43 (22 Apr 2017)"
#define Module_LibraryVersionInfo "1:43"
#define Module_FullVersion "1.44"
#define Module_HelpVersion "1.44 (10 Feb 2018)"
#define Module_LibraryVersionInfo "1:44"
......@@ -2647,23 +2647,40 @@ IsDrawerLocked ROUT
;
;-----------------------------------------------------------------------------------------------
;-----------------------------
; Test Unit Ready Command
;-----------------------------
MOV r0, # nodata + ATAPIOP__COMMAND_PACKET
;----------------------------------
; Get all of the Mode pages
;----------------------------------
MOV r0, # readdata + ATAPIOP__COMMAND_PACKET
MOV r1, # 12
ADR r2, DS_CDBTestUnitReady
MOV r3, # 0
MOV r4, # 0
ADRL r2, GP_CurrentModeSense
ADR r3, buffer
LDR r4, = BUFFER_SIZE
MOV r8, # ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
BLVC Extras_ConvertControlBlockToDrive
BVS error_handler
;-----------------------------------------------------
; Find page &2a containing lock status
;-----------------------------------------------------
MOV r1, # &2a
ADR r2, buffer
BL GP_FindModePage
TEQ r2, # 0
BEQ %FT90
; Check lock status
LDRB r1, [ r2, # 1 ]
CMP r1, #28
BLO %FT90
LDRB r1, [ r2, # 6 ]
MOV r1, r1, LSR #1
AND r1, r1, #1
BL Extras_SetDrawerStatus
90
; Fall back to the cached status if we couldn't get real value from drive
BL Extras_GetDrawerStatus
;-----------------------------
......@@ -2671,11 +2688,6 @@ IsDrawerLocked ROUT
CLRV
MACRO__EXIT_DRIVER_WITH_R0
DS_CDBTestUnitReady
DCD 0
DCD 0
DCD 0
;-----------------------------------------------------------------------------------------------
;AudioControl ROUT
;
......
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