[PATCH] Fix dock station status detection

Holger Macht hmacht at suse.de
Thu Mar 13 11:38:42 PDT 2008


On Do 13. Mär - 19:25:14, Danny Kukawka wrote:
> On Donnerstag, 13. März 2008, Holger Macht wrote:
> > When the user triggers an undock operation, the kernel assumes that the
> > undock cannot fail (which is pretty true) and sends out the 'UNDOCK' udev
> > event before actually doing it. So when HAL comes down to
> > platform_refresh() and reads the 'docked' sysfs file, it still contains
> > 'docked' (at odd times, it's a race).
> 
> Sound to me like a kernel bug. Should the kernel get fixed to send the UNDOCK 
> first if the sysfs attribute is changed?

Same considerations over here ;-) but...

AFAIK, it can't, because for sending the udev event, the device structure
has to be still present.

The more clean solution would be to catch the UNDOCK_EVENT and to wait in
a loop for the undock to fail or succeed (according to the flags). The
only thing the dock driver signals is "now I'm starting the undock
operation", which is correct. Userspace can check if it succeeded or not.

But I think the overhead would be too high in comparison to what it
gains.

Regards,
	Holger


More information about the hal mailing list