[PATCH] HAL polling, cd drives and wakeups

Sam Morris sam at robots.org.uk
Wed Apr 2 02:52:19 PDT 2008


Brian Carlson noticed that HAL's polling of CD drives was causing his
system to wake up ~20 times a second, and filed a bug about it at
<http://bugs.debian.org/456214>.

He commented,

> Apparently hal knows that my drive supports CDROM_MEDIA_CHANGED, but 
> it's not using it.  Why?  Ah, I see, it's checking if the tray is open 
> first.  Shouldn't it be checking only to see if there's a media change, 
> since obviously if the tray is open, the media hasn't been changed yet?  
> Then you can make the kernel do the hard work of determining how to most 
> efficiently check the media change notification, with the asynchronous 
> API, or the inefficient (polling) one.

He also posted a patch, which I'd like to get reviewed upstream:

> 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.

The patch can be retrieved from
<http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=60;filename=hal.patch;att=1;bug=456214>.

Please keep Brian and 456214 at bugs.debian.org CC'd in replies.

-- 
Sam Morris
http://robots.org.uk/

PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/hal/attachments/20080402/417a7eb3/attachment.pgp 


More information about the hal mailing list