dom0+vm/usb: store USB version in XS
This commit is contained in:
		
						commit
						7a11a8305c
					
				@ -21,9 +21,21 @@ XSNAME=`echo ${NAME} | tr . _`
 | 
				
			|||||||
# build devide description.
 | 
					# 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=`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}"
 | 
				
			||||||
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/desc" "$DESC"
 | 
				
			||||||
 | 
					xenstore-write "$XS_KEY/version" "$VERSION"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Make sure PVUSB backend driver is loaded.
 | 
					# Make sure PVUSB backend driver is loaded.
 | 
				
			||||||
/sbin/modprobe xen-usbback 2> /dev/null || /sbin/modprobe usbbk
 | 
					/sbin/modprobe xen-usbback 2> /dev/null || /sbin/modprobe usbbk
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user