Home Page

Make OS/2 Detect Changed CD/DVD Media;

2016-21. OS/2 EcomStations may not notice that CD/DVD media has changed until the drive door is closed manually. Common physical utilities like CDRECORD and DVDDAO fail to notify the operating system when they open or close the door programmatically. As a result, following an optical disc change, the operating system may be using the previously cached directory and data. An effective workaround is to have OS/2 check the disc (e.g., taking a dir) immediately after programmatically opening the tray with such utilities.

Details

This issue can be demonstrated with two optical discs, one that contains files, the other ready to write but with no files (e.g. formatted but unwritten DVD+RW, virgin or blanked DVD-RW, or CD-R). For the sake of example, suppose the optical drive is logical 'S:' and physical '0,1,0'.

  1. Insert the DVD+RW with files, close the drive door, wait for it to spin up, and take a directory ('dir S:').
  2. Eject the DVD+RW by any convenient means, for example:
  3. Insert the DVD that's ready to write but has no files and close the door programmatically. I found that 'DVDDAO -d S --load' did not work, but these methods did:
  4. Take a directory ('dir S:').
  5. Observe that the system displays the directory of the previous disc. When you attempt to read one of these files, you'll either see blanks or cached data, if the file had been previously opened.

To repeat, it appears that a workaround is that any time you programmatically eject a disc, you immediately have the operating system attempt to access the drive while the door is still open. Then it realizes there's been a disc change. You can use CHKDSK, DIR, VOL, as well as the Rexx Utility functions SysDriveInfo, SysFileSystemType (not in Classic Rexx), and SysFileTree.

Test Script

I found it convenient to use this Rexx Script for testing (hardcoded to use my drive S and 0,1,0):


/* @#Walter Gregg of Juneau:2016.2021.12.29#@TestCDRChange */
/* 
You must have DVDDAO, available at Hobbes.NMSU.EDU. You must
also set your drive letter and SCSI Device here because I am
ignoring \config.sys variables.
*/
CDR_DRIVE='S:' /* Format 'S:' */
CDR_DEVICE='0,1,0' /* Format '0,1,0' */
'@echo off'
parse source system calltype script
THIS=filespec('name',script)
parse upper arg NOTIFY
select
  when NOTIFY='CHKDSK' then nop
  when NOTIFY='DIR' then nop
  when NOTIFY='VOL' then nop
  when NOTIFY='SYSDRIVEINFO' then nop
  when NOTIFY='SYSFILESYSTEMTYPE' then nop
  when NOTIFY='SYSFILETREE' then nop
  when NOTIFY='NONE' then nop
  otherwise do
    say 'Use' THIS 'to see if OS/2 detects an optical media change.'
    say 'You must have DVDDAO (available at Hobbes.NMSU.EDU).'
    say 'You need a disc with files and one with none but ready to write.'
    say 'Syntax:'
    say '  'THIS
    say '     [None] [ChkDsk] [Dir] [Vol] '
    say '     [SysDriveInfo] [SysFileSystemType] [SysFileTree]' 
    say 'where:'
    say '  You pick one method to test whether OS/2 sees a disc change.'
    exit 0
  end
end
Say 'Opening the drive tray...'
'dvddao -L nul -d' CDR_DEVICE '--eject'
say 'Please insert a disc with files and press Enter to close the door.'
'pause >nul'
say 'Closing tray, getting directory...'
'dvddao -L nul -d' CDR_DEVICE
'dir' CDR_DRIVE
say 'Opening tray...'
'dvddao -L nul -d' CDR_DEVICE '--eject'
say 'Please insert a disc with no files and press Enter to close the door.'
'pause >nul'
/* The method we hope helps OS/2 detect changed media */
select
  when notify='CHKDSK' then 'CHKDSK' CDR_DRIVE
  when notify='DIR' then 'DIR' CDR_DRIVE
  when notify='VOL' then 'VOL' CDR_DRIVE
  when notify='SYSDRIVEINFO' then do
    call RxFuncAdd 'SysDriveInfo','RexxUtil','SysDriveInfo'
    toss=SysDriveInfo(CDR_DRIVE) /* xyzzy */
  end
  when notify='SYSFILESYSTEMTYPE' then do
    call RxFuncAdd 'SysFileSystemType','RexxUtil','SysFileSystemType'
    toss=SysFileSystemType(CDR_DRIVE) /* xyzzy */
  end
  when notify='SYSFILETREE' then do
    call RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'
    toss=SysFileTree(CDR_DRIVE'\*','entry','bo')
  end
  when notify='NONE' then nop
  otherwise nop
end
say 'Closing tray...'
'dvddao -L nul -d' CDR_DEVICE
say 'Press Enter to verify that the directory of the blank disc is blank.'
say "If you see the last disc's directory, it's a bugaboo."
'pause >nul'
'dir' CDR_DRIVE
exit 0

📧 Send Comment Walt.Gregg.Juneau.AK.US/contact
🏡 Home Page Walt.Gregg.Juneau.AK.US
  Global Statistics   gs.statcounter.com