diff --git a/misc/usb_add_change b/misc/usb_add_change index 79b9794..e01f362 100755 --- a/misc/usb_add_change +++ b/misc/usb_add_change @@ -9,15 +9,17 @@ ## # FIXME: Ignore USB hubs. -[ "$DEVTYPE" = "usb_device" ] || exit 0 +[ "$DEVNUM" = "001" ] && exit 0 -NAME="${ID_VENDOR_ID}_${ID_MODEL_ID}" -DESC="${NAME} ${ID_SERIAL}" +NAME="${BUSNUM}/${DEVNUM}" +# FIXME: For some devices (my Cherry keyboard) ID_SERIAL does not +# contain proper human-readable name, should find better method to +# 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/$NAME" xenstore-write "$XS_KEY/desc" "$DESC" -#xenstore-write "$XS_KEY/_devname" "$DEVNAME" -#xenstore-write "$XS_KEY/_devtype" "$DEVTYPE" # Make sure PVUSB backend driver is loaded. /sbin/modprobe xen-usbback 2> /dev/null || /sbin/modprobe usbbk