- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
首先安装usb5 [7 G3 l# @& ^- r3 }! O
rpm -ivh usbutils-007-5.el7.x86_64.rpm
# q- W, M% m1 R4 Q* Z2 H使用lsusb命令查看:
) h# u0 G' `0 Y! z6 W) ` {! v+ {3 J(nova-libvirt)[root@compute07 /]# lsusb -v+ t/ Q; F9 {' S1 Q' z
# e8 g/ U' y6 oBus 002 Device 003: ID 0781:5588 SanDisk Corp.
8 I' s* ]3 W+ p" e$ h# p9 @$ ~Device Descriptor:
/ g) K& l6 C t3 s% T3 L' _ bLength 18: o! [$ P* v) z# Q2 a) ^
bDescriptorType 1
+ }0 g1 a5 s: Y' m6 s: Q bcdUSB 2.10' S: k! ~0 t D
bDeviceClass 0 (Defined at Interface level) {' a& j/ R' j4 O/ N: _2 j) h
bDeviceSubClass 0 4 c% z/ R/ A4 y& V! ]4 o; c$ X
bDeviceProtocol 0 2 p" |. G3 T5 V \# I
bMaxPacketSize0 641 `! }$ H/ Q6 U P
idVendor 0x0781 SanDisk Corp.
: Q( ~$ K2 ~& m% p _ idProduct 0x5588 4 }. ]( v- A* K; K3 O! b- C1 s
bcdDevice 1.00- n% j/ s6 y1 {
iManufacturer 2 SanDisk! Z9 l8 w! r7 _/ N9 ?4 A
iProduct 3 USB Extreme Pro* o7 _- r; r$ e5 u( |: q V5 B
iSerial 1 00000000000000000000
, [0 H; n8 r2 g L9 E bNumConfigurations 1
& K# f( D( M. d Configuration Descriptor:
b% J! B3 F7 h; N- O4 y4 K+ L bLength 90 k: ~; J- S) Q- y3 q
bDescriptorType 20 V( k$ W, C4 _" n+ w
wTotalLength 325 D- Z0 i: a, T( q. [
bNumInterfaces 1
/ F) ]& z- I; y( w- n1 D4 ]1 E. @ bConfigurationValue 1
% I: C7 M" o% U iConfiguration 0
( K% @9 ?4 u% U$ f% i, ] bmAttributes 0xc0% x9 W) b2 k* M7 h9 S+ F1 x/ _
Self Powered
, E5 q6 K+ y8 O7 `# d7 z MaxPower 0mA# } f x0 c/ j: h3 T2 T0 ~
Interface Descriptor:
, _" t3 K3 k7 e* q+ I+ w. k bLength 9
& i0 f2 q0 C: M bDescriptorType 4
/ v* S1 J5 ]' y- P bInterfaceNumber 0) B; P: Y* d: t. N' u
bAlternateSetting 0
# {) W( k4 j3 j" n% K; D) L4 f6 | bNumEndpoints 2% G8 F3 G% R" B3 t5 b6 R; Q. ^6 @
bInterfaceClass 8 Mass Storage
6 h! X* |! x' i7 Q: ] bInterfaceSubClass 6 SCSI
! j2 n: w" A+ p3 d+ }0 O" q8 [; X bInterfaceProtocol 80 Bulk-Only
, O* I4 i* N9 _( q m iInterface 0 / J6 ~. u% F, G' O4 v+ a$ S
Endpoint Descriptor:; Y1 m5 `# K- F/ d& J( `
bLength 7
# r4 k( c; d1 o. ]( d bDescriptorType 5+ i% p) S8 o; j4 A$ f+ Z) Y
bEndpointAddress 0x81 EP 1 IN+ ~. m0 [7 @2 x8 j# } Z; z
bmAttributes 2
% m- H' U& _/ L l$ P4 D, ]* x Transfer Type Bulk& x( _4 H% N6 \1 T& S5 ~
Synch Type None9 r: G8 e' e/ S* c
Usage Type Data! u! c1 |; T+ f u
wMaxPacketSize 0x0200 1x 512 bytes y& ^3 B$ e6 X% B+ l2 W3 H/ [4 o# D
bInterval 0! ^: y+ j, o; }
Endpoint Descriptor:, T7 V5 M3 `( P; r8 P3 {; ]
bLength 7
( @! [* j% [% i& z0 s% w7 t6 \# F bDescriptorType 5" {1 F) s' X" O' O( U7 X6 N
bEndpointAddress 0x02 EP 2 OUT
' [6 {) ^: L6 e3 f4 t bmAttributes 2! k% t/ b [) @2 k) ?' U
Transfer Type Bulk
# k$ ~+ i5 q8 N) r+ C4 I4 C Synch Type None* X! i" F# U) _
Usage Type Data/ b8 \5 Y, K7 A" Y/ `( V6 I
wMaxPacketSize 0x0200 1x 512 bytes# n3 r) `. V' F. Z& \. y1 B
bInterval 0
. e5 T; s& _, D9 ^Binary Object Store Descriptor:
8 W, Y" z! S* ]& t1 {& F bLength 5: E& I R( E2 \
bDescriptorType 15- Y; A+ U2 { ~( `' d
wTotalLength 229 `6 A _6 q4 s
bNumDeviceCaps 22 p& Y, K0 o5 T& Y4 ]3 `, M
USB 2.0 Extension Device Capability:1 ^2 d/ |9 Q/ j1 J' \
bLength 7" U6 Y- R" h$ t
bDescriptorType 16
5 b) X, H& q' L" {3 t bDevCapabilityType 21 T4 M `8 b1 f# {' @
bmAttributes 0x0000f41e
" r9 k7 e* j% R! V; [6 [7 A0 j Link Power Management (LPM) Supported: U" z& P% T+ s2 b' T6 d' c. g& R
SuperSpeed USB Device Capability:) N+ x1 {: X( }2 M. m8 V Y% }) p
bLength 10* y" l% d: f ^' m7 W4 z# m# B
bDescriptorType 16
9 G" h& ~ I0 B0 j4 D" d. q# L bDevCapabilityType 32 r! B: h3 v, ?6 I1 A
bmAttributes 0x00
: f) E8 W5 c' i: D- } wSpeedsSupported 0x000e
( C$ Z+ F& n7 i% H Device can operate at Full Speed (12Mbps): n7 k( w6 p* C7 {$ v) v0 a/ k' h
Device can operate at High Speed (480Mbps)8 O8 @/ _! H ]+ y& X
Device can operate at SuperSpeed (5Gbps)
' V2 M% v: P5 @2 ~3 b! K bFunctionalitySupport 1
8 h9 X- T& S$ c" R7 j Lowest fully-functional device speed is Full Speed (12Mbps)3 `% K" o/ m( `- e
bU1DevExitLat 10 micro seconds
0 w8 c# ~& a, v6 m2 q2 a4 v6 S bU2DevExitLat 2047 micro seconds
! ~5 C8 S( x5 r% PDevice Status: 0x0001
8 X% i& Z( E5 j, u+ L8 E- S! V Self Powered7 [( x6 e7 @% O3 I2 N# M; C5 N3 B. F
: x- G6 x4 v1 ]# {1 i; F5 I; A t
编辑xml文件:
2 Q+ U% V& [+ d2 D# g, ~, U# y3 B7 v
(nova-libvirt)[root@compute07 /]# vim usb.xml 2 B& R3 g. g' S0 {2 U
<hostdev mode='subsystem' type='usb'>1 i" w! P6 r( M$ f' H) j
<source startupPolicy='optional'>
1 ?& h# F+ d( ^4 i0 j! n8 e<vendor id='0x0781'/>5 A1 c3 ^7 L0 g
<product id='0x5588'/> j! ~3 a9 F% e. E1 t% v
</source>" {3 u' p& w+ i* {7 Z# o
</hostdev>) @# }! n2 X: s6 m) ]) u; S
' `: [) x3 \- q* a
添加usb到虚机6 o# G& x2 Q6 q2 q1 ]3 A1 Y, z' D
3 S1 }5 c, J- N8 K/ E" P; S& r(nova-libvirt)[root@compute07 /]# virsh attach-device instance-00000162 usb.xml- o+ n9 n, g7 c7 ~" D2 t/ b
Device attached successfully' T& J! r) q6 d4 ?4 [, t: C
7 C' s! L5 ?! V/ @9 I
(nova-libvirt)[root@compute07 /]# virsh detach-device instance-00000162 usb.xml 1 y2 Y& W& b1 K/ y0 h
Device detached successfully/ t) E' D/ Q3 c e
. N" p; l3 M2 |8 B! J# ]/ k: U' h/ {8 ?7 B* E6 s* X* F i
0 n5 x6 u) d- O" L5 H- G: Y
' L1 w, k) N" V5 `: I6 h0 }, j+ f F' g+ C6 X
8 i! X# \3 ~4 S
|
|