#4785 HIGH Future : hal should not poll usb storage devices every 2s
Zarro Boogs per Child
bugtracker at laptop.org
Mon Nov 12 19:05:48 EST 2007
#4785: hal should not poll usb storage devices every 2s
-----------------------+----------------------------------------------------
Reporter: dilinger | Owner: jg
Type: defect | Status: new
Priority: high | Milestone: Future Release
Component: distro | Version:
Resolution: | Keywords: power
Verified: 0 |
-----------------------+----------------------------------------------------
Comment(by davidz):
> Yikes, talk about a waste.. Hald currently polls usb-storage
> devices every 2 seconds to see if they still exist. This
> seems completely unnecessary, as we can send an event from the
> kernel when a device disappears.
This is completely inaccurate and linking to random rants won't make it
more true. May I recommend reading the manual page for hal-disable-
polling(1)? If you don't have it on your system here's a semi-readable
copy
http://gitweb.freedesktop.org/?p=hal.git;a=blob;h=53f55b476dcef6ff44ed27f12ba96568b1a026d3;hb=534735f7844300fec22cfebcf515ca46c9b91879;f=doc/man
/hal-disable-polling.1.in
As for your specific complaint: If the kernel says the storage device
supports removable media (cf. /sys/block/sda/removable) the only viable
option to detect _media removal_ is to poll the device (see below for how
this can be avoided with SATA). Note the emphasis on _media removal_ as
compared to _device removal_. For the latter no polling is necessary. Also
if the kernel says that /sys/block/sda/removable is 0 hal won't poll.
Unfortunately a lot of USB storage devices claim to support removable
media even when they in fact don't. This is mostly the case for USB sticks
(close to 100%; I've only seen one expensive IBM USB stick that didn't lie
about it) and a few (close to 0%) hard disk enclosures also lies.
Some newer SATA optical drives supports Asynchronous Notification and the
Linux kernel is gaining support on the driver side to expose this to user
space. There is support in HAL to honor this and avoid polling. Won't help
for USB though.
If you really want to disable polling and don't care about media removal
(it's possible to design an user interface where this is possible) simply
drop an XML file
<deviceinfo version="0.2">
<device>
<match key="info.capabilities" contains=storage">
<merge key="storage.media_check_enabled" type="bool">false</merge>
</match>
</device>
</deviceinfo>
into /usr/share/hal/fdi/policy/10osvendor/00-no-polling.fdi and there will
be no polling.
Hope this helps.
--
Ticket URL: <http://dev.laptop.org/ticket/4785#comment:3>
One Laptop Per Child <http://dev.laptop.org>
OLPC bug tracking system
More information about the Bugs
mailing list