pvusb-003-list-attach-use-detach 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. tmpf=`mktemp`
  3. domu='qdvp'
  4. ## === List
  5. echo 'qvm-usb -l'
  6. qvm-usb -l | sort > $tmpf
  7. cat <<'END' | diff -bu - $tmpf
  8. dom0:2-1 046a:0021 046a_0021
  9. dom0:2-2 045e:0745 Microsoft_Microsoft®_Nano_Transceiver_v1.0
  10. dom0:7-1 07d1:3c0a Ralink_11n_Adapter_1.0
  11. dom0:7-5 0781:5530 SanDisk_Cruzer_1942531DB09038A6
  12. END
  13. ## === Attach
  14. echo 'qvm-usb -a'
  15. qvm-usb -a $domu dom0:7-5 | diff -bu /dev/null -
  16. #echo 'pvusb-script/usb-attach.py'
  17. #sudo /home/abb/pvusb-scripts/usb-attach.py 7-5 3 1
  18. ## === List again
  19. echo 'qvm-usb -l'
  20. qvm-usb -l | sort > $tmpf
  21. # FIXME
  22. cat <<'END' | diff -bu - $tmpf
  23. dom0:2-1 046a:0021 046a_0021
  24. dom0:2-2 045e:0745 Microsoft_Microsoft®_Nano_Transceiver_v1.0
  25. dom0:7-1 07d1:3c0a Ralink_11n_Adapter_1.0
  26. dom0:7-5 0781:5530 SanDisk_Cruzer_1942531DB09038A6
  27. END
  28. read -p 'Press ENTER to continue'
  29. ## === Use: try ls
  30. echo 'qvm-run $domu ls /dev/sda'
  31. qvm-run -p $domu 'ls /dev/sda' > $tmpf
  32. cat <<'END' | diff -bu - $tmpf
  33. /dev/sda
  34. END
  35. ## === Use: try fdisk
  36. echo 'qvm-run $domu fdisk'
  37. qvm-run -p $domu 'su - root -c "fdisk -l /dev/sda"' > $tmpf
  38. cat <<'END' | diff -bu - $tmpf
  39. Disk /dev/sda: 4022 MB, 4022337024 bytes
  40. 124 heads, 62 sectors/track, 1021 cylinders, total 7856127 sectors
  41. Units = sectors of 1 * 512 = 512 bytes
  42. Sector size (logical/physical): 512 bytes / 512 bytes
  43. I/O size (minimum/optimal): 512 bytes / 512 bytes
  44. Disk identifier: 0x3963a77b
  45. Device Boot Start End Blocks Id System
  46. /dev/sda1 * 62 7849447 3924693 c W95 FAT32 (LBA)
  47. END
  48. ## === Detach
  49. #echo 'qvm-usb -d'
  50. #qvm-usb -d $domu:7-5 | diff -bu /dev/null -
  51. echo 'pvusb-script/usb-detach.py'
  52. sudo /home/abb/pvusb-scripts/usb-detach.py 7-5 4 1
  53. rm $tmpf