2005-01-07 03:14:45

by Dan Dennedy

[permalink] [raw]
Subject: sr.c media_changed handling

I am working with a PowerFile DVD jukebox (firewire/sbp2) on kernel
2.6.10, and it works quite well except for media change handling. The
problem is sr limits reads of subsequent discs to the capacity of the
first disc opened. If I remove the line "if (cd->needs_sector_size)"
from sr_open() and make it always get the capacity when a disc is
opened, then it resolves my issues. Alternatively, I can send a
CDROM_MEDIA_CHANGED ioctl when no disc is loaded to force a Read
Capacity request when the next disc is mounted and opened. I have
another, non-changer sbp2 disc drive that does not exhibit this problem.
Therefore, I have two questions:

1) How does a SCSI device that reports media-changed capable
(CDC_MEDIA_CHANGED) actually send that signal or flag? Does it come up
through block device operation media_changed, or is that just a means to
query the driver's current status?

2) I suspect there are other devices that have a similar flaw. What is
the harm in sending an inexpensive Read Capacity command each time a
disc is opened? IOW, removing that line from sr.c in bitkeeper. It seems
it would improve compatibility for less well-behaved devices with
little-to-no impact on the majority.

p.s. please include my address in the reply; I am not subscribed.