TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Herbert Bushong
from: Stephane Bessette
date: 1996-09-01 08:24:06
subject: CD Changer eject/retract

-=> Quoting Herbert Bushong to All <=-

 HB> I need a solution to a problem I have, REXX will be fine, or Borland
 HB> C++ (4.5  dos, 2.0 os/2) if someone is adventurous, but I think REXX
 HB> will be easier. 
 HB> I have a Panasonic 5 CD changer (ATAPI). Currently I have to press the
 HB> various  eject buttons to change CD's, and then push the tray back til
 HB> it kicks in and  retracts. I know it can be ejected/retracted via
 HB> software control as the  windows utility is supposed to do it (but the
 HB> utility goes bonkers under os2,  among other problems). I also have a
 HB> OS2 CD player program that is able to  eject the CD tray it is playing
 HB> (only works with the default audio device  though), but it can't cause
 HB> the tray to reload.  
 HB> Anyone got any ideas how to do the eject/retract? Appears to work with
 HB> the  drive letter (each tray is a different drive letter)...

 HB> All I need is something to pass the appropriate drive letter and it
 HB> will eject/retract it, ie:

 HB> EJECT H:
 HB> RETRACT H:

        I don't have problems with ejecting a CD from the drive, but
cannot get the drive door to close itself.  I suspect that the OS/2
driver is deficient since the mci code is fine (it's essentially the
same command as opening the drive door) and I receive a message to the
effect that a certain flag (to close the door) is not supported by the
MMPM2 driver.  If you are feeling adventurous, you may look at the ioctl
commands, or write a device driver.

        With that said, here's how I would construct eject.cmd and
retract.cmd

/* Load the DLL, initialize MCI REXX support */
rc = RXFUNCADD('mciRxInit','MCIAPI','mciRxInit')
InitRC = mciRxInit()

/* open the door */
rc = mciRxSendString('set CDaudio01 DOOR OPEN', ReturnString, 0, 0)

/* retract the door (will result in an error message) */
rc = mciRxSendString('set CDaudio01 DOOR CLOSED', ReturnString, 0, 0)

if rc0 then
   do
      ErrRC = rc
      say 'Err:mciRxSendString RC=' ErrRC ReturnString
      rc = mciRxGetErrorString(ErrRC, 'ErrStVar')
      say 'mciRxGetErrorString('ErrRC') =' ErrStVar
      rc = ErrRC /* return the error rc */
   end



       In this example, replace CdauDio01 with the appropriate CD, such
as CDaudio01 for d:, CDaudio02 for e:, CDaudio03 for f:, and so on.
You can also look at mmos2\play.cmd for a more detailed example.

        Stephane [TEAM OS/2]
--- Blue Wave/OS2 v2.20
* Origin: Juxtaposition BBS (1:167/133)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 167/133 116 90 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.