Bug 13715

Summary: acd0c unable to detect media change
Product: Base System Reporter: Espen Skoglund <esk>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   

Description Espen Skoglund 1999-09-13 10:00:02 UTC
I'm doing audiocd support for xmms, but I've experienced some problems
with the acd0c driver.  The problem is that the driver is not able to
detect MEDIA_CHANGED if I use the hardware eject button.  (This might
also be a hardware problem.  I'm currently using an IBM ThinkPad 600E
with a <TOSHIBA DVD-ROM SD-C2102/1137>.)  When I insert a new CD, the
driver will only give me the old toc entries.  This is of course kind
of annoying when you're just going to play a single track from a CD.

If I use the ioctl eject functionality on the other hand, things work
just fine.  I've also tried issuing a ioctl(CDIOCRESET) before reading
the TOC.  I would think that this would force the new toc to be read
from the CD, but no such luck.  However, if I use cdcontrol to do the
exact same ioctl RESET command, the new toc _will_ be read from thr CD
(I'm thinking that I might probably be doing something wrong here.
*hrmf*)

Well.  Is this a known problem?  Or is it just some peculiar hardware
problem?

How-To-Repeat: Pick an atapi cd player.

Insert a CD.  Play it with e.g. xcdplayer.  Press hardware eject and
insert a new CD.  Start playing some tracks from the new CD.  These
tracks will have correct data, but the toc information will be messed
up (so that you might for instance play parts of track 2 and 3 when you
really wanted to play inly track 2).
Comment 1 Espen Skoglund 1999-09-13 15:42:19 UTC
Uhm... silly me.  It seems that my problems stemmed from opening the
device with O_NONBLOCK flag set.  (It still seems like a strange
behaviour though.  Certainly not the way I expected the device to
behave.)

	eSk
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 1999-09-13 18:29:24 UTC
State Changed
From-To: open->closed

Originator discovered that the problem was caused by his 
opening the device O_NONBLOCK.