Card-Reader Problem continued

David Zeuthen david at fubar.dk
Tue May 16 12:04:35 PDT 2006


(adding Alan Stern to the Cc)

On Tue, 2006-05-16 at 19:20 +0200, Christian Haul wrote:
> Hi all,
> 
> I'm having problems with HAL and an USB card-reader as can be read here
> http://lists.freedesktop.org/archives/hal/2006-April/004991.html
> The outcome of my post to the hal list was to consult the appropriate
> linux kernel list.
> I have done that as can be read here
> http://marc.theaimsgroup.com/?l=linux-usb-users&m=114599989707419&w=2
> 
> The thread concluded in
> http://marc.theaimsgroup.com/?l=linux-usb-users&m=114616963518128&w=2
> 

Interesting. Tell me again, How many main block devices
e.g. /dev/sda, /dev/sdb etc. does the device provide? One has to keep in
mind that we poll _every one_ of these block devices every two seconds.
So for a card reader with four main block devices (say /dev/sda
through /dev/sdd), which is common, we poll 4 times every two seconds,
e.g. every 0.5 seconds in average. 

I'm not sure we can do less polling than this. Also, this works nicely
for lots of other card readers. Can you possibly try another card reader
and see if you can reproduce?

> Alan Stern wrote:
> > Notice that there is very little time between one command ending
> > ("sleeping") and the next command starting ("awakened").  Apart from
> > the one big interval between 440.450 and 440.836, the vast majority of
> > the time in this log is spent carrying out the commands.
> >
> > This clearly indicates a problem in hald.  It has managed to poll an
> > empty card reader 7 times during 515 ms.  That's a far cry from once
> > every two seconds!

I cannot see why hald would do that unless you have seven main block
devices from the card reader. I've only seen card readers with 4 main
block devices (the 7in1 etc. is purely marketing).

So, sure, we have a process for each main block device that polls it
approximately every two seconds (it's fd = open("/dev/sda"); close(fd)
then sleep (2)), see

 http://webcvs.freedesktop.org/*checkout*/hal/hal/hald/linux2/addons/addon-storage.c?rev=1.19&content-type=text%2Fplain

for the exact code.

It's not unlikely that some of these does open(2) on their respective
device file at the same time but over time it should be randomized.

> 
> So, here I am back again needing help....
> 
> Any clues what could have gone wrong here?

I'm curious. Does running something like (adjust for device files)

 while /bin/true ; do for i in sda sdb sdc sdd ; do echo "polling /dev/$i"; /sbin/blockdev --rereapt /dev/$i; done; sleep 2; done

as root trigger the same load? (run with hald turned off)

    David




More information about the hal mailing list