diff --git a/misc/usb_add_change b/misc/usb_add_change index d76cfcad..be756733 100755 --- a/misc/usb_add_change +++ b/misc/usb_add_change @@ -21,9 +21,21 @@ XSNAME=`echo ${NAME} | tr . _` # build devide description. #DESC=`python -c "dev='%d-%d' % (int('${BUSNUM}'.lstrip('0')), (int('${DEVNUM}'.lstrip('0'))-1)); from xen.util import vusb_util; print vusb_util.get_usbdevice_info(dev);"` DESC="${ID_VENDOR_ID}:${ID_MODEL_ID} ${ID_SERIAL}" -XS_KEY="qubes-usb-devices/${XSNAME}" + +VERSION=`cat /sys/bus/usb/devices/${NAME}/version` +if [ "${VERSION}" = " 1.00" -o "${VERSION}" = " 1.10" ] ; then + VERSION=1 +elif [ "${VERSION}" = " 2.00" ] ; then + VERSION=2 +else + # FIXME: silently ignoring devices with unexpected USB version + exit 0 +fi + +XS_KEY="qubes-usb-devices/$XSNAME" xenstore-write "$XS_KEY/desc" "$DESC" +xenstore-write "$XS_KEY/version" "$VERSION" # Make sure PVUSB backend driver is loaded. /sbin/modprobe xen-usbback 2> /dev/null || /sbin/modprobe usbbk