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
This commit is contained in:
parent
281c628b0e
commit
f7eea5548a
@ -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=`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}"
|
DESC="${ID_VENDOR_ID}:${ID_MODEL_ID} ${ID_SERIAL}"
|
||||||
|
|
||||||
VERSION=`cat /sys/$DEVPATH/version`
|
VERSION=`cat /sys/$DEVPATH/version | tr -d ' '|cut -f 1 -d .`
|
||||||
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
|
|
||||||
|
|
||||||
# ignore usbip-connected devices, as most likely already passed through from
|
# ignore usbip-connected devices, as most likely already passed through from
|
||||||
# another VM
|
# another VM
|
||||||
|
Loading…
Reference in New Issue
Block a user