Fixing CD-ROM media change detection

David Zeuthen david at fubar.dk
Wed Dec 8 19:18:07 PST 2004


On Tue, 2004-12-07 at 19:15 +0100, Martin Pitt wrote:
> Hi!
> 
> Media change detection for CD-ROMs does not work on some broken CD-ROM
> devices. There are some devices where the CDROM_DRIVE_STATUS ioctl
> returns CDS_DISK_OK even when the tray is open. This has the
> consequence that the event of inserting a CD is not recognized by hal.
> 
> If the CD-ROM reports CDS_DISK_OK, then CDROM_MEDIA_CHANGED should be
> checked twice. If it returns two different values, then there really
> was a media change and got_media can be set to true. OTOH, if both
> CDROM_MEDIA_CHANGED events return the same value, then the tray is
> still open and we must not assume that there is already a CD in the
> drive.
> 

Clever trick for working around broken hardware - I like it.

> Second, for deciding the value of storage.cdrom.support_media_changed
> hald should not use the CDROM_MEDIA_CHANGED ioctl() (which returns the
> current state), but the CDC_MEDIA_CHANGED capability.
> 

Nice catch.

> I updated the Ubuntu package and now media change detection works fine
> on all machines I tested it on (also on the one of my friend with the
> odd CD-ROM).
> 
> I attach the used patch. Thanks in advance for considering to adopt
> it.
> 

I've committed this to the 0.4.x branch. I left out the logging bits
though.

Thanks a lot, Cheers,
David


_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list