dom0+vm/qvm-usb: added vusb helper script to usbvm

This commit is contained in:
Alexandre Bezroutchko 2012-10-11 00:02:54 +02:00
parent f2dc86b2f1
commit 88c446c6f3
2 changed files with 25 additions and 1 deletions

View File

@ -8,7 +8,7 @@
# Copy files
cp misc/usb_add_change /usr/lib/qubes/usb_add_change
cp misc/usb_remove /usr/lib/qubes/usb_remove
# FIXME cp misc/xen-vusb-helper.py /usr/lib/qubes/xen-vusb-helper.py
cp misc/misc/vusb-ctl.py /usr/lib/qubes/misc/vusb-ctl.py
cp misc/qubes_usb.rules /etc/udev/rules.d/99-qubes_usb.rules
# Reload PVUSB backend and cleanup xenstore

24
misc/vusb-ctl.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python
##
## Python script wrapper around xen.util.vusb_util bind_usb_device() and unbind_usb_device() methods
## Run as root in usbvm
##
from xen.util import vusb_util
import sys
import os
if len(sys.argv)!=3:
print 'usage: vusb-ctl <bind|unbind> device'
sys.exit(1)
device=sys.argv[2]
if sys.argv[1] == 'bind':
vusb_util.bind_usb_device(device)
elif sys.argv[1] == 'ubind':
vusb_util.unbind_usb_device(device)
else
print "Invalid command, must be 'bind' or 'unbind'"
sys.exit(1)