2012-10-07 19:35:46 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-10-07 21:12:36 +02:00
|
|
|
##
|
|
|
|
## This script is invoked by udev rules whenever USB device appears or
|
|
|
|
## changes. This happens in usbvm domain (or dom0 if USB controller
|
|
|
|
## drivers are in dom0). The script records information about available
|
|
|
|
## USB devices into XS directory, making it available to qvm-usb tool
|
|
|
|
## running in dom0.
|
|
|
|
##
|
|
|
|
|
2012-10-07 22:28:50 +02:00
|
|
|
# FIXME: Ignore USB hubs.
|
2012-10-07 21:12:36 +02:00
|
|
|
[ "$DEVTYPE" = "usb_device" ] || exit 0
|
2012-10-07 19:35:46 +02:00
|
|
|
|
|
|
|
NAME="${ID_VENDOR_ID}_${ID_MODEL_ID}"
|
|
|
|
DESC="${NAME} ${ID_SERIAL}"
|
|
|
|
XS_KEY="qubes-usb-devices/$NAME"
|
|
|
|
|
|
|
|
xenstore-write "$XS_KEY/desc" "$DESC"
|
2012-10-07 22:28:50 +02:00
|
|
|
#xenstore-write "$XS_KEY/_devname" "$DEVNAME"
|
|
|
|
#xenstore-write "$XS_KEY/_devtype" "$DEVTYPE"
|
2012-10-07 21:06:40 +02:00
|
|
|
|
2012-10-07 21:12:36 +02:00
|
|
|
# Make sure PVUSB backend driver is loaded.
|
2012-10-07 21:06:40 +02:00
|
|
|
/sbin/modprobe xen-usbback 2> /dev/null || /sbin/modprobe usbbk
|