Bug 16920

Summary: cdcontrol fails under 4.0-20000214-CURRENT
Product: Base System Reporter: jdugan <jdugan>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: jdugan
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
xmcd.debug
none
xmcd.debug-cam none

Description jdugan 2000-02-23 02:20:01 UTC
  Neither cdcontrol nor a freshly compiled xmcd will play an audio cd.  Here's
  the output of dmesg (for boot messages as well as cd error messages):

Copyright (c) 1992-2000 The FreeBSD Project.
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California. All rights reserved.
FreeBSD 4.0-20000214-CURRENT #2: Tue Feb 22 17:48:54 CST 2000
    jdugan@rivendell.ncsa.uiuc.edu:/usr/src/sys/compile/RIVENDELL
Timecounter "i8254"  frequency 1193182 Hz
CPU: AMD-K7(tm) Processor (499.03-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x612  Stepping = 2
  Features=0x81f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,MMX>
  AMD Features=0xc0400000<AMIE,DSP,3DNow!>
real memory  = 134152192 (131008K bytes)
config> di sn0
No such device: sn0
Invalid command or syntax.  Type `?' for help.
config> di lnc0
No such device: lnc0
Invalid command or syntax.  Type `?' for help.
config> di le0
No such device: le0
Invalid command or syntax.  Type `?' for help.
config> di ie0
No such device: ie0
Invalid command or syntax.  Type `?' for help.
config> di fe0
No such device: fe0
Invalid command or syntax.  Type `?' for help.
config> di ed0
No such device: ed0
Invalid command or syntax.  Type `?' for help.
config> di cs0
No such device: cs0
Invalid command or syntax.  Type `?' for help.
config> di bt0
No such device: bt0
Invalid command or syntax.  Type `?' for help.
config> di aic0
No such device: aic0
Invalid command or syntax.  Type `?' for help.
config> di aha0
No such device: aha0
Invalid command or syntax.  Type `?' for help.
config> di adv0
No such device: adv0
Invalid command or syntax.  Type `?' for help.
config> q
avail memory = 126541824 (123576K bytes)
Preloaded elf kernel "kernel" at 0xc0340000.
Preloaded userconfig_script "/boot/kernel.conf" at 0xc034009c.
Pentium Pro MTRR support enabled
md0: Malloc disk
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <AMD-751 host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
pcib1: <AMD-751 PCI-PCI (AGP) bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
vga-pci0: <Matrox MGA G400 AGP graphics accelerator> mem 0xef000000-0xef7fffff,0xefefc000-0xefefffff,0xe4000000-0xe5ffffff irq 11 at device 5.0 on pci1
pci0: unknown card (vendor=0x109e, dev=0x036e) at 3.0 irq 9
pci0: unknown card (vendor=0x109e, dev=0x0878) at 3.1 irq 9
ahc0: <Adaptec 2940 Ultra2 SCSI adapter> port 0xdc00-0xdcff mem 0xeffff000-0xefffffff irq 10 at device 4.0 on pci0
ahc0: aic7890/91 Wide Channel A, SCSI Id=7, 16/255 SCBs
xl0: <3Com 3c905B-TX Fast Etherlink XL> port 0xd400-0xd47f mem 0xefffef80-0xefffefff irq 5 at device 6.0 on pci0
xl0: Ethernet address: 00:50:da:22:64:de
miibus0: <MII bus> on xl0
xlphy0: <3Com internal media interface> on miibus0
xlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
isab0: <VIA 82C686 PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
ata-pci0: <VIA 82C686 ATA-66 controller> port 0xffa0-0xffaf at device 7.1 on pci0
ata0 at 0x01f0 irq 14 on ata-pci0
chip1: <VIA 82C686 ACPI interface> at device 7.4 on pci0
pcm0: <AudioPCI ES1371> port 0xd000-0xd03f irq 9 at device 15.0 on pci0
devclass_alloc_unit: pcm0 already exists, using next available unit number
ata-isa0: already registered as ata0
atkbdc0: <keyboard controller (i8042)> at port 0x60-0x6f on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model Generic PS/2 mouse, device ID 0
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x200>
pcic1: not probed (disabled)
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1: configured irq 3 not in bitmap of probed irqs 0
sio2: not probed (disabled)
sio3: not probed (disabled)
ppc0: parallel port not found.
Waiting 5 seconds for SCSI devices to settle
afd0: 120MB <LS-120 VER5 00 UHD Floppy> [963/8/32] at ata0-master using PIO3
da0 at ahc0 bus 0 target 0 lun 0
da0: <QUANTUM ATLAS 10K 9WLS UCH0> Fixed Direct Access SCSI-3 device 
da0: 80.000MB/s transfers (40.000MHz, offset 31, 16bit), Tagged Queueing Enabled
da0: 8759MB (17938986 512 byte sectors: 255H 63S/T 1116C)
Mounting root from ufs:/dev/da0s1a
da1 at ahc0 bus 0 target 5 lun 0
da1: <IOMEGA ZIP 100 J.03> Removable Direct Access SCSI-2 device 
da1: 3.300MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
cd0 at ahc0 bus 0 target 6 lun 0
cd0: <MATSHITA CD-R   CW-7502 4.10> Removable CD-ROM SCSI-2 device 
cd0: 10.000MB/s transfers (10.000MHz, offset 8)
cd0: cd present [230982 x 2048 byte records]
(cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
(cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
(cd0:ahc0:0:6:0): Invalid field in CDB
(cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
(cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
(cd0:ahc0:0:6:0): Invalid field in CDB
(cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
(cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
(cd0:ahc0:0:6:0): Invalid field in CDB
(cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
(cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
(cd0:ahc0:0:6:0): Invalid field in CDB
(cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
(cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
(cd0:ahc0:0:6:0): Invalid field in CDB
(cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
(cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
(cd0:ahc0:0:6:0): Invalid field in CDB

Fix: 

I haven't found a fix yet.
How-To-Repeat: 
  /usr/sbin/cdcontrol
Comment 1 ken 2000-02-23 04:31:28 UTC
On Tue, Feb 22, 2000 at 20:13:29 -0600, jdugan@ncsa.uiuc.edu wrote:
> >Description:
> 
>   Neither cdcontrol nor a freshly compiled xmcd will play an audio cd.  Here's
>   the output of dmesg (for boot messages as well as cd error messages):

[ ... ]

> ahc0: <Adaptec 2940 Ultra2 SCSI adapter> port 0xdc00-0xdcff mem 0xeffff000-0xefffffff irq 10 at device 4.0 on pci0
> ahc0: aic7890/91 Wide Channel A, SCSI Id=7, 16/255 SCBs
[ ... ]

> cd0 at ahc0 bus 0 target 6 lun 0
> cd0: <MATSHITA CD-R   CW-7502 4.10> Removable CD-ROM SCSI-2 device 
> cd0: 10.000MB/s transfers (10.000MHz, offset 8)
> cd0: cd present [230982 x 2048 byte records]
> (cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
> (cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
> (cd0:ahc0:0:6:0): Invalid field in CDB
> (cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
> (cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
> (cd0:ahc0:0:6:0): Invalid field in CDB

Okay, I'll need some information to try to solve your problem:

- has this drive ever worked correctly with cdcontrol or xmcd?

- what exactly did you type in cdcontrol?

- what does 'cdcontrol info' return?

- does 'cdcontrol play 1' work?

- does camcontrol work?  e.g.:

	camcontrol devlist
	camcontrol tur cd0 -v
	camcontrol inquiry cd0 -v
	[ that will return bogus inquiry data, don't worry about it ]

- I also need the output from xmcd -debug

Ken
-- 
Kenneth Merry
ken@kdm.org
Comment 2 jdugan 2000-02-23 05:15:20 UTC
On Tue, Feb 22, 2000 at 09:31:28PM -0700, Kenneth D. Merry wrote:
> On Tue, Feb 22, 2000 at 20:13:29 -0600, jdugan@ncsa.uiuc.edu wrote:
> > >Description:
> > 
> >   Neither cdcontrol nor a freshly compiled xmcd will play an audio cd.  Here's
> >   the output of dmesg (for boot messages as well as cd error messages):
> 
> [ ... ]
> 
> > ahc0: <Adaptec 2940 Ultra2 SCSI adapter> port 0xdc00-0xdcff mem 0xeffff000-0xefffffff irq 10 at device 4.0 on pci0
> > ahc0: aic7890/91 Wide Channel A, SCSI Id=7, 16/255 SCBs
> [ ... ]
> 
> > cd0 at ahc0 bus 0 target 6 lun 0
> > cd0: <MATSHITA CD-R   CW-7502 4.10> Removable CD-ROM SCSI-2 device 
> > cd0: 10.000MB/s transfers (10.000MHz, offset 8)
> > cd0: cd present [230982 x 2048 byte records]
> > (cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
> > (cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
> > (cd0:ahc0:0:6:0): Invalid field in CDB
> > (cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
> > (cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
> > (cd0:ahc0:0:6:0): Invalid field in CDB
> 
> Okay, I'll need some information to try to solve your problem:
> 
> - has this drive ever worked correctly with cdcontrol or xmcd?

  Yes, it has, as recently as 3.4-STABLE.  (not sure what date)

> - what exactly did you type in cdcontrol?

  play, I did it again and got:

  (cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
  (cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
  (cd0:ahc0:0:6:0): Invalid field in CDB

> - what does 'cdcontrol info' return?
>
> - does 'cdcontrol play 1' work?

  DOH!  Yes, cdcontrol works that way...  Is it a bug that it doesn't work the
  other way?  I feel pretty dumb right about now...

> - does camcontrol work?  e.g.:
> 
> 	camcontrol devlist
> 	camcontrol tur cd0 -v
> 	camcontrol inquiry cd0 -v
> 	[ that will return bogus inquiry data, don't worry about it ]

rivendell# camcontrol devlist
<QUANTUM ATLAS 10K 9WLS UCH0>      at scbus0 target 0 lun 0 (pass0,da0)
<IOMEGA ZIP 100 J.03>              at scbus0 target 5 lun 0 (pass1,da1)
<MATSHITA CD-R   CW-7502 4.10>     at scbus0 target 6 lun 0 (pass2,cd0)
rivendell# camcontrol tur cd0 -v
Unit is ready
rivendell#  camcontrol inquiry cd0 -v
pass2: <  > Fixed Direct Access SCSI-0 device 
pass2: Serial Number 
pass2: 10.000MB/s transfers (10.000MHz, offset 8)

> - I also need the output from xmcd -debug

  I've attached it, but I don't think you'll need it, the comment from the
  HEAD of xmcd Makefile says it all:

    Upgrade to latest release (xmcd-2.6).

    This still fails to build correctly on -current since the /usr/libexec/cpp
    fiasco -- old versions of imake still use /usr/libexec/cpp instead of
    gcc -E.  If you don't have a fixed version of imake, a quick fix to get
    around this is to set IMAKECPP=/usr/bin/cpp in your environment before
    make'ing this port.

    Note that the port builds without errors if you don't have the correct
    version of imake, but FREEBSD_CAM will not be defined and xmcd will use
    the ioctl method which hasn't worked since 3.0.

  So it looks like I got an old port.  Which makes sense since the commit time
  for the above comment is Wed Feb 23 3:40:29 2000 UTC.  

  When I build from the latest version of the port with IMAKECPP set as
  instructed above xmcd builds and can interact with the cd but it doesn't
  actually seem to work, it sorta fast forwards through the tracks.  That is,
  it goes in 3-7 second hops through the time elapsed counter in xmcd and
  doesn't actually output any audio.  I've included a second xmcd -debug
  called xmcd.debug-cam which is a script of a session with this behavior.
  cdcontrol still works after I've seen xmcd in this state.  I just tried
  again after exiting cdcontrol in the "stop" state and now xmcd works fine.
  Probably just a fluke.

  Thanks for your time, sorry for my ignorance.

Jon
-- 
Jon Dugan             |  Network Engineer, NCSA Network Development
jdugan@ncsa.uiuc.edu  |  57C CAB, 605 E Springfield, Champaign, IL 61820
217/244-7715          |  http://www.ncsa.uiuc.edu/people/jdugan
Comment 3 ken 2000-02-23 05:33:22 UTC
On Tue, Feb 22, 2000 at 23:15:20 -0600, Jon Dugan wrote:
> On Tue, Feb 22, 2000 at 09:31:28PM -0700, Kenneth D. Merry wrote:
> > Okay, I'll need some information to try to solve your problem:
> > 
> > - has this drive ever worked correctly with cdcontrol or xmcd?
> 
>   Yes, it has, as recently as 3.4-STABLE.  (not sure what date)

Any idea whether it worked with that particular cd when you type 'cdcontrol
play'?

> > - what exactly did you type in cdcontrol?
> 
>   play, I did it again and got:
> 
>   (cd0:ahc0:0:6:0): PLAY AUDIO(12). CDB: a5 0 0 0 0 0 0 3 86 46 0 0 
>   (cd0:ahc0:0:6:0): ILLEGAL REQUEST asc:24,0
>   (cd0:ahc0:0:6:0): Invalid field in CDB

What happens when you do this is cdcontrol tries to play starting at block
0, for the entire length of the CD.

What is wrong is the CDROM drive either doesn't like the starting address,
or it doesn't like the number of blocks.

What happens if you use another CD?

> > - what does 'cdcontrol info' return?
> >
> > - does 'cdcontrol play 1' work?
> 
>   DOH!  Yes, cdcontrol works that way...  Is it a bug that it doesn't work the
>   other way?  I feel pretty dumb right about now...

It may be a bug, but it may just be a bug in your CDROM drive's firmware.
It works on a Plextor CDROM and a Panasonic DVD-RAM drive I've got here.

It might be interesting to see if we can figure out what is causing it to
fail.  Try something like this:

cdcontrol play "#0" 230980

230980 == 0x38646 - 2

0x38646 is the length from the command above.

The idea is that the TOC on the CD may be wrong somehow, and may be going
past the end of the CD or something.

If that doesn't work, just try something like this:

cdcontrol play "#0" 2048

> > - does camcontrol work?  e.g.:
> > 
> > 	camcontrol devlist
> > 	camcontrol tur cd0 -v
> > 	camcontrol inquiry cd0 -v
> > 	[ that will return bogus inquiry data, don't worry about it ]
> 
> rivendell# camcontrol devlist
> <QUANTUM ATLAS 10K 9WLS UCH0>      at scbus0 target 0 lun 0 (pass0,da0)
> <IOMEGA ZIP 100 J.03>              at scbus0 target 5 lun 0 (pass1,da1)
> <MATSHITA CD-R   CW-7502 4.10>     at scbus0 target 6 lun 0 (pass2,cd0)
> rivendell# camcontrol tur cd0 -v
> Unit is ready
> rivendell#  camcontrol inquiry cd0 -v
> pass2: <  > Fixed Direct Access SCSI-0 device 
> pass2: Serial Number 
> pass2: 10.000MB/s transfers (10.000MHz, offset 8)

That looks fine.  I fixed the camcontrol inquiry problem on Saturday, FWIW.

> > - I also need the output from xmcd -debug
> 
>   I've attached it, but I don't think you'll need it, the comment from the
>   HEAD of xmcd Makefile says it all:
> 
>     Upgrade to latest release (xmcd-2.6).
> 
>     This still fails to build correctly on -current since the /usr/libexec/cpp
>     fiasco -- old versions of imake still use /usr/libexec/cpp instead of
>     gcc -E.  If you don't have a fixed version of imake, a quick fix to get
>     around this is to set IMAKECPP=/usr/bin/cpp in your environment before
>     make'ing this port.
> 
>     Note that the port builds without errors if you don't have the correct
>     version of imake, but FREEBSD_CAM will not be defined and xmcd will use
>     the ioctl method which hasn't worked since 3.0.
> 
>   So it looks like I got an old port.  Which makes sense since the commit time
>   for the above comment is Wed Feb 23 3:40:29 2000 UTC.  
> 
>   When I build from the latest version of the port with IMAKECPP set as
>   instructed above xmcd builds and can interact with the cd but it doesn't
>   actually seem to work, it sorta fast forwards through the tracks.  That is,
>   it goes in 3-7 second hops through the time elapsed counter in xmcd and
>   doesn't actually output any audio.  I've included a second xmcd -debug
>   called xmcd.debug-cam which is a script of a session with this behavior.
>   cdcontrol still works after I've seen xmcd in this state.  I just tried
>   again after exiting cdcontrol in the "stop" state and now xmcd works fine.
>   Probably just a fluke.

Hmm, maybe the drive was set in a bogus mode or something.  One thing I
have found is that you generally don't want to have two CD-type programs
active on the device at the same time, even if they're paused.  Sometimes
they put the drive in different modes, and get screwed up if things aren't
in the state they expect.

I had trouble compiling the previous version of xmcd a couple weeks ago,
and I "solved" the problem by doing the following in
/usr/X11R6/lib/X11/config/Imake.cf:

#define __FreeBSD__  <----- this line
#ifdef __FreeBSD__
# define MacroIncludeFile <FreeBSD.cf>
# define MacroFile FreeBSD.cf
# undef __FreeBSD__

It's a kludge, but works permanantly.  Another alternative is to recompile
and reinstall XFree86, assuming they've fixed it to point to the "right"
cpp, or you can run a binary editor on cpp.

Ken
-- 
Kenneth Merry
ken@kdm.org
Comment 4 iedowse freebsd_committer freebsd_triage 2001-08-12 23:37:06 UTC
State Changed
From-To: open->feedback


Can this be closed?
Comment 5 iedowse freebsd_committer freebsd_triage 2001-08-12 23:52:44 UTC
State Changed
From-To: feedback->closed


Mail to submitter bounces.