Device Rebinding
Device rebinding is something that can be done in userspace to simulate removing
and then replugging hardware so that the driver attempts to connect to the
device again and firmware is re-requested.
If the session client installs a driver or firmware, then this functionality is
required to avoid asking the user to remove the hardware manually, or in the
case where the hardware is internal, to avoid asking the user to reboot.
See http://lwn.net/Articles/143397/ for more information about how to unbind and
rebind a device with Linux.
You can test this functionality by doing:
./pk-device-rebind -v -s "/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-2"
In userspace it is expected that clients just use PolicyKit to run this command
as root, for instance, "pkexec /usr/sbin/pk-device-rebind"
This functionality is only available if GUdev is available.
TODO:
Modify /lib/udev/firmware.sh so that we use usb-db and pci-db to get a better
vendor and model.
--------------------------------------------------------------------------------
if [ ! -e /sys$DEVPATH/loading ]; then
err "udev firmware loader misses sysfs directory"
exit 1
fi
use loading file in sysfs to match these properties
SUBSYSTEM=="firmware", ACTION=="add", , NEED_FIRMWARE="1", RUN+="firmware.sh", NEED_FIRMWARE="0"
SUBSYSTEMS=="usb", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="usb-db %p"
SUBSYSTEMS=="usb", GOTO="skip_pci"
SUBSYSTEMS=="pci", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="pci-db %p"
LABEL="skip_pci"