From f7eea5548a6e0cd88f0a0fcc12cdbd67ec25cc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 8 Jul 2016 10:40:12 +0200 Subject: [PATCH] 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 --- udev/udev-usb-add-change | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/udev/udev-usb-add-change b/udev/udev-usb-add-change index 3e9da35..1903674 100755 --- a/udev/udev-usb-add-change +++ b/udev/udev-usb-add-change @@ -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