[PATCH] HAL polling, cd drives and wakeups

Doug Goldstein cardoe at gentoo.org
Wed Apr 2 09:57:44 PDT 2008


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. 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 hal mailing list