Subject: kern/30288: eject and raw SCSI access to a CDROM drive don't work when the medium is bad
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
List: netbsd-bugs
Date: 05/20/2005 11:03:00
>Number:         30288
>Category:       kern
>Synopsis:       eject and raw SCSI access to a CDROM drive don't work when the medium is bad
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 20 11:03:00 +0000 2005
>Originator:     Pavel Cahyna
>Release:        NetBSD 3.0_BETA i386
>Organization:
>Environment:


System: NetBSD 3.0_BETA (GENERIC) #0: Sat May  7 08:05:37 UTC 2005
	jmc@faith.netbsd.org:/home/builds/ab/netbsd-3/i386/200505060000Z-obj/home/builds/ab/netbsd-3/src/sys/arch/i386/compile/GENERIC



>Description:


When there is an unreadable CD-RW medium in my SCSI CD drive, even the tools
that don't access the medium don't work.  For example scsictl:
$ scsictl cd1 identify                                        
scsictl: cd1: Device not configured

or eject:
$ eject cd1
eject: open: /dev/rcd1d: Device not configured

When I attempt to do this, the kernel prints:
cd1(ahc1:0:5:0):  Check Condition on CDB: 0x25 00 00 00 00 00 00 00 00 00
    SENSE KEY:  Not Ready
     ASC/ASCQ:  Cannot Read Medium - Incompatible Format

When there is a good medium, scsictl works normally:
$ scsictl cd1 identify 
/dev/rcd1d: scsibus0 target 5 lun 0 <YAMAHA, CRW6416S, 1.0c>

eject too.

The problem is also present in 2.0_BETA and I remember similar problems with
a PD optical drive with NetBSD 1.6 .

relevant lines from my dmesg:

ahc1 at pci0 dev 11 function 0: Adaptec 2940 Ultra SCSI adapter
ahc1: interrupting at irq 5
ahc1: aic7880: Ultra Wide Channel A, SCSI Id=7, 16/253 SCBs
scsibus0 at ahc1: 16 targets, 8 luns per target
scsibus0: waiting 2 seconds for devices to settle...
cd1 at scsibus0 target 5 lun 0: <YAMAHA, CRW6416S, 1.0c> cdrom removable
cd1: sync (100.00ns offset 15), 8-bit (10.000MB/s) transfers



>How-To-Repeat:


see above.


>Fix:


Unknown. Somehow always allow to access the raw device? 
Or introduce another device node for the necessary IOCTLs instead of the raw device?