Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Oct 2000 16:31:14 -0600
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        John Reynolds <jjreynold@home.com>
Cc:        scsi@FreeBSD.ORG
Subject:   Re: what part of the driver locks the CD tray?
Message-ID:  <20001007163114.A63656@panzer.kdm.org>
In-Reply-To: <14815.41391.607241.353903@whale.home-net>; from jjreynold@home.com on Sat, Oct 07, 2000 at 03:20:31PM -0700
References:  <14813.21325.718668.456937@whale.home-net> <20001005225426.A45446@panzer.kdm.org> <14815.41391.607241.353903@whale.home-net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 07, 2000 at 15:20:31 -0700, John Reynolds wrote:
> 
> [ On Thursday, October 5, Kenneth D. Merry wrote: ]
> > 
> > Yes.  To prevent removal:
> > 
> > camcontrol cmd cd0 -v -c "1e 0 0 0 1 0"
> > 
> > To allow removal:
> > 
> > camcontrol cmd cd0 -v -c "1e 0 0 0 0 0"
> 
> These commands worked for my plain CD-ROM drive on cd0 but did not work for my
> SCSI CD-RW on cd1
> 
>   cd1 at ahc0 bus 0 target 4 lun 0
>   cd1: <YAMAHA CRW4416S 1.0g> Removable CD-ROM SCSI-2 device 
>   cd1: 8.333MB/s transfers (8.333MHz, offset 31)
>   cd1: cd present [239755 x 2048 byte records]
>   
> When I run the "lock" command (s/cd0/cd1), I get:
> 
>   camcontrol: error sending command
>   (pass2:ahc0:0:4:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 0 0 0 1 0 
>   (pass2:ahc0:0:4:0): NOT READY asc:3a,1
>   (pass2:ahc0:0:4:0): Medium not present - tray closed
> 
> Is the command different for CDRW drives? There is no media in either drive but
> the command for locking/unlocking on cd0 works regardless of media.

That means the drive won't let you lock it unless there is media.

So you'll have to leave media in that drive in order to lock it.

> ps: if I put media into the CD-RW drive and execute the clock command I get
> this:
> 
>   camcontrol: error sending command
>   (pass2:ahc0:0:4:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 0 0 0 1 0 
>   (pass2:ahc0:0:4:0): UNIT ATTENTION asc:28,0
>   pass2:ahc0:0:4:0): Not ready to ready change, medium may have changed

That's normal.  The drive is just informing you that the media has changed.
In the kernel, we normally retry commands returned with unit attention
errors, although with camcontrol the default action is not to do any error
recovery.

If you execute the command a second time, it should complete without
errors.

Unit Attention conditions generally happen when the device has been reset
or the media has changed.  Once the condition is reported, it is cleared,
and subsequent commands can complete without errors.

Another way to handle this with camcontrol, besides executing the command a
second time, is to enable error recovery and retries.  e.g.:

camcontrol cmd cd0 -E -C 3 -v -c "1e 0 0 0 1 0"

The -E enables error recovery, and -C 3 tells the kernel to retry the
command up to three times.

Ken
-- 
Kenneth Merry
ken@kdm.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001007163114.A63656>