libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-devel] [PATCH] Try ejecting using eject command on Linux


From: Thomas Schmitt
Subject: Re: [Libcdio-devel] [PATCH] Try ejecting using eject command on Linux
Date: Fri, 12 Jun 2015 19:15:34 +0200

Hi,

> Maybe CDROM's now have a "suspended" state that you need get out of?

It could be about "standby power condition" (SPC-3 5.9).
Table 39 says:
"While in the standby power condition (see 3.1.107):
  a) A device server is not capable of processing media access commands; [...]
"

But on the other hand, START/STOP UNIT is supposed to override
resp. change the power condition. Especially the value 0 of bits
4 to 7 of byte 4 is promised to "process the START and LOEJ bits"
which are bits 0 resp. 1 of byte 4. (LOEJ = Load/Eject)
SBC-2 table 49.

I have this reminder in libburn/sbc.c:

/* START STOP UNIT as of SBC-1 and SBC-2
   0:  Opcode 0x1B
   1:  bit0= Immed
       bit1-7= reserved
   2:  reserved
   3:  reserved
   4:  bit0= Start (else Stop unit)
       bit1= Load/Eject (according to Start resp. Stop)
       bit2-3= reserved
       bit4-7= Power Condition
               0= Start Valid: process Start and Load/Eject bits
               1= assume Active state
               2= assume Idle state
               3= assume Standby state
              (5= SBC-1 only: assume Sleep state)
               7= transfer control of power conditions to logical unit
              10= force idle condition timer to 0
              11= force standby condition timer to 0
              All others are reserved.
   5:  Control (set to 0)
*/

The sequence which libburn uses with
  xorriso -scsi_log on -outdev /dev/sr0 -eject all
is inconclusive in this aspect. It has a START UNIT command which
should bonk the drive out of its sleep, before anything else
happens.

  ...

  START/STOP UNIT
  1b 00 00 00 01 00 
      15070 us     [ 1096565 ]

  ... some drive inspection ...

  START/STOP UNIT
  1b 01 00 00 00 00 
    1186603 us     [ 2406124 ]

  TEST UNIT READY
  00 00 00 00 00 00 
  +++ sense data = 71 00 02 00 00 00 00 0A 00 00 00 00 04 07 00 80 FF FF
  +++ key=2  asc=04h  ascq=07h
      23600 us     [ 2930067 ]

  TEST UNIT READY
  00 00 00 00 00 00 
  +++ sense data = 71 00 02 00 00 00 00 0A 00 00 00 00 04 07 00 80 FF FF
  +++ key=2  asc=04h  ascq=07h
      53081 us     [ 3483470 ]

  TEST UNIT READY
  00 00 00 00 00 00 
        306 us     [ 3983994 ]

  PREVENT/ALLOW MEDIA REMOVAL
  1e 00 00 00 00 00 
        242 us     [ 3984516 ]

  START/STOP UNIT
  1b 00 00 00 02 00 
    1547037 us     [ 5531605 ]

I.e. start unit with tray action (= load),
stop unit without tray action,
unlock tray,
stop unit with tray action (= eject).
After this command the tray is out. (Needs 1.5 seconds. :))

The final command from libburn confirms this:

  START/STOP UNIT
  1b 01 00 00 00 00 
  +++ sense data = 70 00 02 00 00 00 00 0A 00 00 00 00 3A 02 00 00 00 00
  +++ key=2  asc=3Ah  ascq=02h
        946 us     [ 5532752 ]

Sense codes seen:
  2 04 07 LOGICAL UNIT NOT READY, OPERATION IN PROGRESS
  2 3A 02 MEDIUM NOT PRESENT  TRAY OPEN


>  ftp://www.t10.org/t10/document.05/05-344r0.pdf

Oops. SBC-3. I thought they want money since a few years.
Table 49 is in there.
Maybe SPC-3 (or SPC-4) is hidden there too.


Have a nice day :)

Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]