[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: More on hotplug issue w/HAL



On Mon, 2004-01-05 at 08:58, Matthew Mastracci wrote:
> Some time tomorrow I'll do a clean CVS checkout and try things again
> just to verify my hunch.  I'm pretty optimistic that it has fixed the
> hotplug event problems I was having earlier.
> 

Ok, basically you need to check that everything works on both hald
startup (when detecting all the devices) and on hotplug add/remove.

One thing I've been missing from your debug logs are lines like this

 [I] linux/linux_osspec.c:529 handle_udev_node_created() : udev
 NodeCreated: /udev/sda /initrd/sys/block/sda
 
 [I] linux/linux_osspec.c:563 handle_udev_node_created_found_device() :
 Setting block.device=/udev/sda for 
 udi=/org/freedesktop/Hal/devices/temp/47
 [I] linux/linux_osspec.c:529 handle_udev_node_created() : udev
 NodeCreated: /udev/sda1 /initrd/sys/block/sda/sda1
 
 [I] linux/linux_osspec.c:563 handle_udev_node_created_found_device() :
 Setting block.device=/udev/sda1 for 
 udi=/org/freedesktop/Hal/devices/temp/48

on hotpluggin - the debug means that hald has received a dbus signal
from the udev service associating a device file with a sysfs path. You
might want to check that the file 

 /etc/dbus-1/system.d/udev_sysbus_policy.conf

exist on your system. It seems to be missing from an RPM I built from
udev-012, but that may be my own fault.

> Does CD-ROM media insertion notification work right now?  I'm itching to
> get the card-reader notification to kick a new device node into the HAL
> device list, but I need a place to start learning how that stuff works. 
> :)
> 

I'm currently working on this using polling and ioctl(2) on the cdrom
device file (like magicdev). Unfortunately I won't have time to hack on
this before tomorrow evening due to other commitments in real life. If
you write code to detect media change for your devices, we should
definitely put it in HAL.

(btw, some day we want to use the dbus events that Rob Love's kernel
will be generating instead of polling)

> > You can actually see here that the devices are not added in order -
> > that's why I need to have asynchronous find_parent functions which kind
> > of complicates everything.
> 
> Once you've got an idea of what's going on, the code makes a lot of
> sense in there.  :)
> 
> BTW, is the code for find_parent waiting for 30 seconds every time, or
> is that just the maximum amount of time to wait if things are going
> slowly?
> 

It's the maximum amount of time, don't worry. My favourite test case is
hotplugging this tree of devices

 USB 2.0 hub
  + MP3 usb storage player
  + USB pendrive
  + USB Hub keyboard
    + Keyboard
    + Mouse
    + CF reader

and this take a fair amount of time (~20 sec) on my old laptop mostly
due to swapping (it's a 128MB box running Fedora) and devlabel being
invoked all the time. It does work however, even though the devices
appear in a funny order.

Also note that there are some race problems that is said to be fixed
once libsysfs 0.4 is out  (HAL includes a local copy of libsysfs 0.3
just like udev). A workaround may be to sleep more than 500ms in
hal_hotplug.c before sending the dbus event representing the hotplug
event.

> > 
> > Thanks for testing so far!
> 
> No prob!  This stuff will make my life *so* much easier.

Great! I'm really hoping we can get your device to work with HAL.

Take care,
David




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]