[Pkg-utopia-maintainers] Bug#456214: [PATCH] HAL polling, cd drives and wakeups

David Zeuthen david at fubar.dk
Wed Apr 2 17:40:24 UTC 2008


On Wed, 2008-04-02 at 12:57 -0400, Doug Goldstein wrote:
> David Zeuthen wrote:
> > On Wed, 2008-04-02 at 10:52 +0100, Sam Morris wrote:
> >   
> >>> Attached is a patch to fix the problem with wakeups.  This patch does 
> >>> CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
> >>> sure the drive is closed and then that the drive is not lying.  This 
> >>> causes the number of wakeups from HAL to go to zero.  It also has the 
> >>> side effect of issuing an extra ioctl(2) when the drive tray is open, 
> >>> which is harmless since the drive tray should be closed most of the 
> >>> time.
> >>>       
> >
> > So if I understand this correctly, what this patch does is to reduce the
> > number of wakeups only when the drive door is open?
> >
> >      David
> >
> >   
> No. Other way around. It'll increase the number of wakeups when the 
> drive door is opened and decrease them when it's closed. 

Hmm. I'm confused how it can bring the wakeups to zero as is claimed
upthread. Surely the kernel won't know if media is changed unless it
asks the drive [1]. And the kernel won't do this by itself since it's a
policy decision to do so. Or to put it in another way: To detect media
changes the drive _will_ need to be polled from user space - SATA AN
wasn't invented for nothing.

[1] : Unless of course it's a SATA optical drive supporting AN - but the
Linux kernel interfaces for detecting this have been in a flux (stable
in 2.6.24 I think) so we don't properly support this right now. It's
easy to add and probably something we should do for 0.5.11; in fact I
volunteer to do this as I have the hardware to do so (thanks to Kristen
from Intel). But that's up to Danny whether it should be in 0.5.11
(would be a small invasive patch). Danny?

> However it's 
> problematic in the fact that Linux does not do per-process 
> CDROM_MEDIA_CHANGED. If another app reads that, then HAL will never know 
> that the media changed.
> 
> Right now HAL always checks to see if the drive door and then assumes 
> there is media in the drive.
> 
> The downside to the patch is that it relies on CDROM_MEDIA_CHANGED not 
> being touched by another app. So with the patch HAL, will cause less 
> interrupts but will miss media changes in some situations..
> 






More information about the Pkg-utopia-maintainers mailing list