udev: make USB device version detection more generic

Apparently some devices do not comply with standards (there is no such
thing as USB version 2.01), but other than that works fine. So take into
account only the major number of bcdUSB field.

Fixes QubesOS/qubes-issues#2158
pull/8/head mm_f7eea554
Marek Marczykowski-Górecki 8 years ago
parent 281c628b0e
commit f7eea5548a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

@ -21,17 +21,7 @@ XSNAME=`basename ${DEVPATH} | tr . _`
#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}"
VERSION=`cat /sys/$DEVPATH/version`
if [ "${VERSION}" = " 1.00" -o "${VERSION}" = " 1.10" ] ; then
VERSION=1
elif [ "${VERSION}" = " 2.00" -o "${VERSION}" = " 2.10" ] ; then
VERSION=2
elif [ "${VERSION}" = " 3.00" -o "${VERSION}" = " 3.10" ] ; then
VERSION=3
else
# FIXME: silently ignoring devices with unexpected USB version
exit 0
fi
VERSION=`cat /sys/$DEVPATH/version | tr -d ' '|cut -f 1 -d .`
# ignore usbip-connected devices, as most likely already passed through from
# another VM

Loading…
Cancel
Save