Bugzilla – Bug 157072
binding driver to a device does not create an udev event
Last modified: 2006-03-15 23:11:46 UTC
Binding a driver to a device (e.g. via 'hwup') does not create an udev event. This is a bit annoying as this (missing) event would be ideal to start ipw3945d (and maybe do other useful thins). ipw3945d is an userspace daemon needed to run an ipw3945 device. The driver registers the interface after the daemon was started, so I can not use a net-event to start it. Currently I am using a driver-event, which is not optimal, as it does only work when the module is loaded, but not when the driver get re-bound to the device or when compiled into the kernel.
What does 'hwup' do to "bind" the device to the driver? And no, creating a uevent for this would be crazy, what would userspace do with this kind of information?
hwup does: echo -n $HWD_BUSID > $SYSFS_DRIVER_PATH/bind This works, but prints an error message about "no such device". IMHO the module and driver events are at least as crazy as an (un)bound event. This bound-event can be used to start a userspace daemon for a device. ipw3945 devices need this, because the daemon registers the network interface.
if you get an error, that means it didn't work :) And, since you know you bound the device to the driver (which you should really never have to do by hand, why are you doing this?), you can call whatever program you want to after this if you want, why would you want the kernel to do something instead? As the ipw3945 driver is not in the kernel tree yet, let's take this to lkml in public for others to discuss please. closing this.
Greg, i get this error message, but nevertheless it works: d147:~ # ls /sys/bus/pci/drivers/ipw2200/ 0000:04:02.0 bind debug_level module new_id unbind d147:~ # ls /sys/class/net/ eth0 eth1 lo sit0 d147:~ # echo -n 0000:04:02.0 > /sys/bus/pci/drivers/ipw2200/unbind d147:~ # ls /sys/bus/pci/drivers/ipw2200/ bind debug_level module new_id unbind d147:~ # ls /sys/class/net/ eth0 lo sit0 d147:~ # echo -n 0000:04:02.0 > /sys/bus/pci/drivers/ipw2200/bind bash: echo: write error: No such device d147:~ # ls /sys/bus/pci/drivers/ipw2200/ 0000:04:02.0 bind debug_level module new_id unbind d147:~ # ls /sys/class/net/ eth0 eth1 lo sit0 d147:~ # Please care about the error message: About bind-events: You have to bind the device after you released it. hwdown and hwup do that. These are used from YaST. If you change the driver module via YaST it calls hwdown which should release the device without unloading the module (because of other devices; we had bug reports because we unloaded modules in SLES9SP2). hwup does only bind devices manually if not already bound automatically. We wnated to make you aware about the need for bind-events. Of course we could add that also to hwup. But using udev via bind-events would be a better approach.
Yes, others have reported the same error from the bind sysfs file, sorry about that, am looking into it. As for the events, the kernel doesn't emit any events when things are "bound" today, so that would have to be a totally new event. Please propose a new feature for that (preferably with patch...) And again, it's a bit too late in the SLES10 process for new events to be added...