packagekit/contrib/device-rebind
2010-01-27 21:00:41 +00:00
..
.gitignore Add the device rebinding functionality required for the session to install drivers 2009-08-20 08:33:14 +01:00
Makefile.am device-rebind: actually make this work after testing with a bit of actual hardware 2009-08-21 10:56:19 +01:00
pk-device-rebind.c Update the Free Software Foundation address 2010-01-27 21:00:41 +00:00
pk-device-rebind.xml Add the device rebinding functionality required for the session to install drivers 2009-08-20 08:33:14 +01:00
README device-rebind: actually make this work after testing with a bit of actual hardware 2009-08-21 10:56:19 +01:00

			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"