Remove old pvusb handling code
This commit is contained in:
parent
a6df6df449
commit
2e7f483a60
@ -1,69 +0,0 @@
|
||||
Dedicated usbvm (optional)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In dom0, once:
|
||||
qvm-create -l red usbvm
|
||||
|
||||
# FIXME: use your own PCI device IDs
|
||||
qvm-pci -a usbvm 00:1d.0
|
||||
qvm-pci -a usbvm 00:1d.1
|
||||
qvm-pci -a usbvm 00:1d.2
|
||||
qvm-pci -a usbvm 00:1d.7
|
||||
|
||||
After each dom0 reboot:
|
||||
qvm-start usbvm
|
||||
|
||||
List
|
||||
~~~~
|
||||
|
||||
In dom0:
|
||||
qvm-usb -l
|
||||
|
||||
Example output:
|
||||
dom0:7-4 0718:061a TDKMedia_Trans-It_Drive_070326AE8AF92D95 (attached to qdvp:0-1)
|
||||
dom0:7-5 0b05:1706 ASUS_802.11g_WLAN_Drive (attached to sys-net:0-1)
|
||||
dom0:1-1 045e:0084 Microsoft_Basic_Optical_Mouse
|
||||
usbvm:4-6 05e3:0723 Generic_USB_Storage (attached to qdvp:1-1)
|
||||
|
||||
Attach
|
||||
~~~~~~
|
||||
|
||||
In dom0:
|
||||
qvm-usb -a [--no-auto-detach] <vm-name> <device-vm-name>:<backend-controller>-<backend-port>
|
||||
|
||||
Example:
|
||||
qvm-usb -a sys-net usbvm:4-1
|
||||
|
||||
Detach
|
||||
~~~~~~
|
||||
|
||||
In dom0:
|
||||
qvm-usb -d <vm-name>:<vusb-controller>-<vusb-port>
|
||||
|
||||
Example:
|
||||
qvm-usb -d sys-net:0-1
|
||||
|
||||
Known issues
|
||||
~~~~~~~~~~~~
|
||||
|
||||
List/attach/detach operations seem to work ok, devices are recognized by the target VM etc.
|
||||
But actual usage of the attached devices is unstable at best. In fact the only working device
|
||||
I saw was one USB stick (and this only after it took a minute to time out and reset the bus
|
||||
couple times). Kernel crashes are normal as well. I have not investigated these issues yet,
|
||||
I had similar experience with Marek's scripts.
|
||||
|
||||
* System keyboard / mouse are listed and can be detached away
|
||||
* Virtual USB devices (ones created by PVUSB frontend) may be listed
|
||||
* The installation/configuration is not persistent, not retained between reboots
|
||||
* No debugging / logging / audit trail
|
||||
* When an attached device is physically unplugged, USB port remains mapped but not displayed
|
||||
in the list. If device is plugged back it continues to work. Unlisted device cannot be detached.
|
||||
* We are not attaching actual devices, but USB ports (different behavior from VMWare, might be confusing)
|
||||
* After device is detached from the frontend and returned back to the backend it is not alwayws usable there
|
||||
* Code changing configuration of pvusb fe/be and vusb bind/unbind helper are located
|
||||
misc/xl-qvm-usb-attach.py misc/xl-qvm-usb-detach.py misc/vusb-ctl.py. These helpers are
|
||||
deployed into the backend domain. The initialization code is qubesutils.py in usb_setup(),
|
||||
should probably also be moved into an external helper. Perhaps the functionality of these
|
||||
external helpers should be merged into libxl? The is one catch is invokation of vusb helper
|
||||
in the backend domain -- now it relies on qubes-specific API.
|
||||
* After reboot attached USB devices are not listed by 'qvm-usb -l' until replugged.
|
@ -7,8 +7,5 @@ install:
|
||||
cp cleanup-dispvms $(DESTDIR)/usr/lib/qubes
|
||||
cp startup-misc.sh $(DESTDIR)/usr/lib/qubes
|
||||
cp prepare-volatile-img.sh $(DESTDIR)/usr/lib/qubes
|
||||
cp vusb-ctl.py $(DESTDIR)/usr/lib/qubes/
|
||||
cp xl-qvm-usb-attach.py $(DESTDIR)/usr/lib/qubes/
|
||||
cp xl-qvm-usb-detach.py $(DESTDIR)/usr/lib/qubes/
|
||||
cp block-cleaner-daemon.py $(DESTDIR)/usr/lib/qubes/
|
||||
cp fix-dir-perms.sh $(DESTDIR)/usr/lib/qubes/
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/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] == 'unbind':
|
||||
vusb_util.unbind_usb_device(device)
|
||||
else:
|
||||
print "Invalid command, must be 'bind' or 'unbind'"
|
||||
sys.exit(1)
|
||||
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
##
|
||||
## This script is for dom0
|
||||
## The syntax is modelled after "xl block-attach"
|
||||
##
|
||||
|
||||
import sys
|
||||
import os
|
||||
import xen.lowlevel.xl
|
||||
|
||||
|
||||
# parse command line
|
||||
if (len(sys.argv)<4) or (len(sys.argv)>5):
|
||||
print 'usage: xl-qvm-usb-attach.py <frontendvm-xid> <backendvm-device> <frontendvm-device> [<backendvm-xid>]'
|
||||
sys.exit(1)
|
||||
|
||||
frontendvm_xid=sys.argv[1]
|
||||
backendvm_device=sys.argv[2]
|
||||
|
||||
frontend=sys.argv[3].split('-')
|
||||
if len(frontend)!=2:
|
||||
print 'Error: frontendvm-device must be in <controller>-<port> format'
|
||||
sys.exit(1)
|
||||
(controller, port)=frontend
|
||||
|
||||
if len(sys.argv)>4:
|
||||
backendvm_xid=int(sys.argv[4])
|
||||
backendvm_name=xen.lowlevel.xl.ctx().domid_to_name(backendvm_xid)
|
||||
else:
|
||||
backendvm_xid=0
|
||||
|
||||
# FIXME: command injection
|
||||
os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s '%s'"
|
||||
% (backendvm_xid, frontendvm_xid, controller, port, backendvm_device))
|
||||
|
||||
cmd = "/usr/lib/qubes/vusb-ctl.py bind '%s'" % backendvm_device
|
||||
if backendvm_xid == 0:
|
||||
os.system("sudo %s" % cmd)
|
||||
else:
|
||||
from qubes.qubes import QubesVmCollection
|
||||
qvm_collection = QubesVmCollection()
|
||||
qvm_collection.lock_db_for_reading()
|
||||
qvm_collection.load()
|
||||
qvm_collection.unlock_db()
|
||||
|
||||
# launch
|
||||
qvm_collection.get_vm_by_name(backendvm_name).run(cmd, user="root")
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
##
|
||||
## This script is for dom0
|
||||
## The syntax is modelled after "xl block-attach"
|
||||
## FIXME: should be modelled after block-detach instead
|
||||
##
|
||||
|
||||
import sys
|
||||
import os
|
||||
import xen.lowlevel.xl
|
||||
|
||||
# parse command line
|
||||
if (len(sys.argv)<4) or (len(sys.argv)>5):
|
||||
print 'usage: xl-qvm-usb-detach.py <frontendvm-xid> <backendvm-device> <frontendvm-device> [<backendvm-xid>]'
|
||||
sys.exit(1)
|
||||
|
||||
frontendvm_xid=sys.argv[1]
|
||||
backendvm_device=sys.argv[2]
|
||||
|
||||
frontend=sys.argv[3].split('-')
|
||||
if len(frontend)!=2:
|
||||
print 'Error: frontendvm-device must be in <controller>-<port> format'
|
||||
sys.exit(1)
|
||||
(controller, port)=frontend
|
||||
|
||||
if len(sys.argv)>4:
|
||||
backendvm_xid=int(sys.argv[4])
|
||||
backendvm_name=xen.lowlevel.xl.ctx().domid_to_name(backendvm_xid)
|
||||
else:
|
||||
backendvm_xid=0
|
||||
|
||||
cmd = "/usr/lib/qubes/vusb-ctl.py unbind '%s'" % backendvm_device
|
||||
if backendvm_xid == 0:
|
||||
os.system("sudo %s" % cmd)
|
||||
else:
|
||||
from qubes.qubes import QubesVmCollection
|
||||
qvm_collection = QubesVmCollection()
|
||||
qvm_collection.lock_db_for_reading()
|
||||
qvm_collection.load()
|
||||
qvm_collection.unlock_db()
|
||||
|
||||
# launch
|
||||
qvm_collection.get_vm_by_name(backendvm_name).run(cmd, user="root")
|
||||
|
||||
# FIXME: command injection
|
||||
os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s ''"
|
||||
% (backendvm_xid, frontendvm_xid, controller, port))
|
||||
|
@ -376,9 +376,6 @@ fi
|
||||
/usr/lib/qubes/unbind-pci-device.sh
|
||||
/usr/lib/qubes/cleanup-dispvms
|
||||
/usr/lib/qubes/block-cleaner-daemon.py*
|
||||
/usr/lib/qubes/vusb-ctl.py*
|
||||
/usr/lib/qubes/xl-qvm-usb-attach.py*
|
||||
/usr/lib/qubes/xl-qvm-usb-detach.py*
|
||||
/usr/lib/qubes/fix-dir-perms.sh
|
||||
/usr/lib/qubes/startup-misc.sh
|
||||
/usr/lib/qubes/prepare-volatile-img.sh
|
||||
|
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
tmpf=`mktemp`
|
||||
|
||||
sudo xenstore-ls -f qubes-usb-devices | sort > $tmpf
|
||||
|
||||
cat << 'END' | diff -u - $tmpf
|
||||
qubes-usb-devices/2-1 = ""
|
||||
qubes-usb-devices/2-1/desc = "046a:0021 046a_0021"
|
||||
qubes-usb-devices/2-2 = ""
|
||||
qubes-usb-devices/2-2/desc = "045e:0745 Microsoft_Microsoft\xc2\xae_Nano_Transceiver_v1.0"
|
||||
END
|
||||
|
||||
rm $tmpf
|
@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
tmpf=`mktemp`
|
||||
|
||||
sudo xenstore-ls -f qubes-usb-devices | sort > $tmpf
|
||||
|
||||
cat << 'END' | diff -u - $tmpf
|
||||
qubes-usb-devices/2-1 = ""
|
||||
qubes-usb-devices/2-1/desc = "046a:0021 046a_0021"
|
||||
qubes-usb-devices/2-2 = ""
|
||||
qubes-usb-devices/2-2/desc = "045e:0745 Microsoft_Microsoft\xc2\xae_Nano_Transceiver_v1.0"
|
||||
qubes-usb-devices/7-1 = ""
|
||||
qubes-usb-devices/7-1/desc = "07d1:3c0a Ralink_11n_Adapter_1.0"
|
||||
qubes-usb-devices/7-5 = ""
|
||||
qubes-usb-devices/7-5/desc = "0781:5530 SanDisk_Cruzer_1942531DB09038A6"
|
||||
END
|
||||
|
||||
rm $tmpf
|
@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
tmpf=`mktemp`
|
||||
domu='qdvp'
|
||||
|
||||
## === List
|
||||
echo 'qvm-usb -l'
|
||||
qvm-usb -l | sort > $tmpf
|
||||
|
||||
cat <<'END' | diff -bu - $tmpf
|
||||
dom0:2-1 046a:0021 046a_0021
|
||||
dom0:2-2 045e:0745 Microsoft_Microsoft®_Nano_Transceiver_v1.0
|
||||
dom0:7-1 07d1:3c0a Ralink_11n_Adapter_1.0
|
||||
dom0:7-5 0781:5530 SanDisk_Cruzer_1942531DB09038A6
|
||||
END
|
||||
|
||||
## === Attach
|
||||
echo 'qvm-usb -a'
|
||||
qvm-usb -a $domu dom0:7-5 | diff -bu /dev/null -
|
||||
#echo 'pvusb-script/usb-attach.py'
|
||||
#sudo /home/abb/pvusb-scripts/usb-attach.py 7-5 3 1
|
||||
|
||||
## === List again
|
||||
echo 'qvm-usb -l'
|
||||
qvm-usb -l | sort > $tmpf
|
||||
|
||||
# FIXME
|
||||
cat <<'END' | diff -bu - $tmpf
|
||||
dom0:2-1 046a:0021 046a_0021
|
||||
dom0:2-2 045e:0745 Microsoft_Microsoft®_Nano_Transceiver_v1.0
|
||||
dom0:7-1 07d1:3c0a Ralink_11n_Adapter_1.0
|
||||
dom0:7-5 0781:5530 SanDisk_Cruzer_1942531DB09038A6
|
||||
END
|
||||
|
||||
read -p 'Press ENTER to continue'
|
||||
|
||||
## === Use: try ls
|
||||
echo 'qvm-run $domu ls /dev/sda'
|
||||
qvm-run -p $domu 'ls /dev/sda' > $tmpf
|
||||
cat <<'END' | diff -bu - $tmpf
|
||||
/dev/sda
|
||||
END
|
||||
|
||||
## === Use: try fdisk
|
||||
echo 'qvm-run $domu fdisk'
|
||||
qvm-run -p $domu 'su - root -c "fdisk -l /dev/sda"' > $tmpf
|
||||
|
||||
cat <<'END' | diff -bu - $tmpf
|
||||
|
||||
Disk /dev/sda: 4022 MB, 4022337024 bytes
|
||||
124 heads, 62 sectors/track, 1021 cylinders, total 7856127 sectors
|
||||
Units = sectors of 1 * 512 = 512 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
||||
Disk identifier: 0x3963a77b
|
||||
|
||||
Device Boot Start End Blocks Id System
|
||||
/dev/sda1 * 62 7849447 3924693 c W95 FAT32 (LBA)
|
||||
END
|
||||
|
||||
## === Detach
|
||||
#echo 'qvm-usb -d'
|
||||
#qvm-usb -d $domu:7-5 | diff -bu /dev/null -
|
||||
echo 'pvusb-script/usb-detach.py'
|
||||
sudo /home/abb/pvusb-scripts/usb-detach.py 7-5 4 1
|
||||
|
||||
rm $tmpf
|
Loading…
Reference in New Issue
Block a user