|
|
首先安装usb1 [1 b( C$ j# C8 t" V c( C
rpm -ivh usbutils-007-5.el7.x86_64.rpm " B3 S4 W2 D/ c( X0 e; E
使用lsusb命令查看:
/ C$ Z: }2 `% R& T(nova-libvirt)[root@compute07 /]# lsusb -v
* ^' a+ y& }) ?5 |8 {1 z
1 S9 \% R. a' c- h1 G6 r1 E+ YBus 002 Device 003: ID 0781:5588 SanDisk Corp.
& Y& {0 z$ V9 k: B; CDevice Descriptor:
# W; r! j9 e5 B1 g8 A$ z: ] bLength 18+ t6 K4 U, T4 K$ T* H9 f
bDescriptorType 15 |! L/ Z1 m" e0 R- e7 }
bcdUSB 2.10
( C- f, ^2 E0 B8 W' B+ }$ O# U bDeviceClass 0 (Defined at Interface level)6 Q9 d, m0 m( h* `
bDeviceSubClass 0
) g9 q% U" N- M bDeviceProtocol 0
/ q- n+ K$ f* A6 f& v bMaxPacketSize0 64
: I' J, Y# T: h0 O! p) z idVendor 0x0781 SanDisk Corp.: N. W% i/ ~" h. ~
idProduct 0x5588 4 R1 w" X! z3 N$ v
bcdDevice 1.00
9 }- F) n2 I/ W5 i" K iManufacturer 2 SanDisk
8 p* g- |" ?5 ]# H+ ? iProduct 3 USB Extreme Pro. w- R( l( S! y& Q! A
iSerial 1 00000000000000000000) X+ y9 w U2 d! H3 L0 a, ^
bNumConfigurations 1
) X) Z( y0 b% Z) \; O3 [) A" h Configuration Descriptor:( I a" J( ]- G1 _" ?
bLength 95 j8 A+ i4 [5 D# D* `& p+ I
bDescriptorType 2" `9 L& }, x5 B A9 C
wTotalLength 32
9 y7 S( s5 ^- v4 G bNumInterfaces 1/ Q5 {' v4 ` `
bConfigurationValue 1
" D+ i/ `8 `- e+ [; A iConfiguration 0 : R" n9 `5 ^. k. r$ |( g& z
bmAttributes 0xc01 o, g. V- U( x c( b
Self Powered: {) S' }( e j4 `
MaxPower 0mA
8 p3 \' q- C) ? Interface Descriptor:9 g, e& l v3 k1 S
bLength 9& b7 \& w6 E9 @! B; [
bDescriptorType 4
1 Z& k6 [5 x6 V) m9 m bInterfaceNumber 0
" a& q. R& g" Y3 `( I" R bAlternateSetting 0- M1 |9 A, V% C9 ~! a
bNumEndpoints 22 h6 u3 r w% l6 O7 |5 P
bInterfaceClass 8 Mass Storage
- \, u8 {, t/ P( c+ f, t. D bInterfaceSubClass 6 SCSI+ K* {" b2 @- f6 [
bInterfaceProtocol 80 Bulk-Only6 y" _: R* O# h2 D; U' H. z$ B
iInterface 0 # W; ], o" e7 z3 m
Endpoint Descriptor:
4 B$ t% ?5 z% c# j' E bLength 7( I8 v8 k: J9 R
bDescriptorType 5/ w* n8 |) ~0 M, U
bEndpointAddress 0x81 EP 1 IN
) S1 \" V, [3 q4 P bmAttributes 2
& }, ^, M0 i7 r4 i3 v Transfer Type Bulk
' v: G2 ?- P; i8 r4 w* K Synch Type None9 q- j1 n5 R9 v" @% F& D
Usage Type Data
8 L- S. k u, ?9 e. P/ {1 y wMaxPacketSize 0x0200 1x 512 bytes
( g0 }: Z1 i- o) F8 I1 S bInterval 07 \+ [' Y6 n; q' x. V+ q
Endpoint Descriptor:) D0 V) a; u8 G) J
bLength 7
' w5 e5 f$ E5 o9 ~1 ~2 X bDescriptorType 5% ^- g* O3 d" e* c( M& X' B/ R* i
bEndpointAddress 0x02 EP 2 OUT
! s2 b5 L# N) N+ M. W7 O9 \2 P6 B bmAttributes 2
$ f! }! k% z, s2 |9 c3 Y9 T' Z2 c Transfer Type Bulk0 }* K1 x2 l9 y& ]# X
Synch Type None
, u, w. i9 @: f* J1 i( \ Usage Type Data; [ v$ l0 S1 ?% i# k, s
wMaxPacketSize 0x0200 1x 512 bytes* {1 G- F! l u+ ~0 P0 o' K
bInterval 0
( O- [1 v. h0 S2 E* G. @, Y N6 hBinary Object Store Descriptor:6 N3 o( x8 o ]. m% F* y0 I3 m. Y
bLength 5
, T. O% M" _5 D8 J5 I6 | bDescriptorType 153 L [+ l# K5 s! F# x
wTotalLength 22
5 C0 Z% E) w! l% Q bNumDeviceCaps 2( l4 ~ P5 H( {2 C
USB 2.0 Extension Device Capability:
8 n+ }8 @6 o4 `9 x8 O( e4 l bLength 7. u1 g( q) l1 l/ v0 O
bDescriptorType 16; M4 }* ]5 C: |4 \# h
bDevCapabilityType 2$ A+ u' m5 Z9 b( t& q! U3 z* x
bmAttributes 0x0000f41e
5 s! {2 P: a6 P6 y, L' k Link Power Management (LPM) Supported
. U9 J, R! [& p, u+ V SuperSpeed USB Device Capability:
) C6 n5 w) K0 k bLength 10
6 d: U& C8 R6 B$ L h$ p. w bDescriptorType 16 m2 e2 W# S& l4 r' k; r: V- U
bDevCapabilityType 3
_$ v5 W2 j) e) r4 ?; H) e! s; j bmAttributes 0x00
9 T2 i9 B/ Y: n; [" V9 I& c wSpeedsSupported 0x000e8 d, z' P7 ?9 \7 Z0 y% R
Device can operate at Full Speed (12Mbps)
" a* W3 o6 ^8 U: _7 @. v% u% r+ q Device can operate at High Speed (480Mbps)5 }+ `6 W }" N$ G
Device can operate at SuperSpeed (5Gbps)* [. ^$ l; w- I# H! ?
bFunctionalitySupport 14 k' s: \6 V6 h. A4 {' u4 k, d
Lowest fully-functional device speed is Full Speed (12Mbps); Z/ q0 J; L! g7 G- o" e6 W
bU1DevExitLat 10 micro seconds; \* G/ ~9 S$ ]! M! b* g/ o( N- p# \
bU2DevExitLat 2047 micro seconds3 ^9 A+ X! N6 f7 {. G& _7 R; ^" t
Device Status: 0x00010 _) ^8 b" g! X5 O
Self Powered
) W1 R9 j+ H3 M* O3 {
# E e8 ?# U3 h9 t" G编辑xml文件:
0 M4 k- [" T$ o4 |/ |' `( W
( J: e; \7 c! _1 j(nova-libvirt)[root@compute07 /]# vim usb.xml ) U! T' g9 x( T! n2 x
<hostdev mode='subsystem' type='usb'>( f) i6 j0 e) K' i+ D: P- d% [
<source startupPolicy='optional'>5 H3 {8 g) C3 @; Q0 I3 i
<vendor id='0x0781'/>
7 j. x) f8 k4 u4 W1 u% K3 h<product id='0x5588'/>
0 [7 ^. j. J* D8 b% c1 r: Q</source>$ D# u' F# R0 z: X9 E
</hostdev>
1 w+ [# U0 @7 U. Y J
: k7 r3 F" L" a. F4 j [0 B添加usb到虚机
0 o# w4 I7 ?+ W0 C( O
. K0 t H T+ [" H; t% [(nova-libvirt)[root@compute07 /]# virsh attach-device instance-00000162 usb.xml
8 m6 e4 k' \$ p XDevice attached successfully8 q9 Z8 l- m2 P0 |; z) K P
' L* Z- m8 Y0 g1 S
(nova-libvirt)[root@compute07 /]# virsh detach-device instance-00000162 usb.xml
* F# }) Q8 Q; h/ _6 X( qDevice detached successfully
5 d4 v2 v0 Z1 h: U( L2 p8 G u' F* \. `% M$ I( j- d
. |0 I R- \# Q
! e5 S$ ~- c; S1 V; }2 O8 r! P
# [4 k: k9 E4 g/ \8 ]6 Y9 W" x/ m' [& }/ Z
+ {- l" n2 Y3 I$ I. U
|
|