- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
首先安装usb
& V2 K4 X' h& Q6 Orpm -ivh usbutils-007-5.el7.x86_64.rpm
: P" k0 R. @! O+ t* t. k ^使用lsusb命令查看:
S! w* C5 Q8 q( z7 o8 z |(nova-libvirt)[root@compute07 /]# lsusb -v( I1 S6 B4 z; }' \
- X7 j- f1 M( Z, W: W3 gBus 002 Device 003: ID 0781:5588 SanDisk Corp. , |4 @/ N( a# D+ O3 h. q
Device Descriptor:( P, z. V% R( R; Q G
bLength 189 d3 Q; Z0 A) I
bDescriptorType 1: N, @6 L! o5 R$ j. ~/ |
bcdUSB 2.107 y8 B8 S# G! h. B/ u' q
bDeviceClass 0 (Defined at Interface level)8 \6 r, m4 k3 _$ V$ P9 \
bDeviceSubClass 0 6 | n% ?2 g% ]" H4 c, L
bDeviceProtocol 0
% K7 v! G8 f5 V; m* f7 l: v _0 l bMaxPacketSize0 64( v( M% P+ [: q& P
idVendor 0x0781 SanDisk Corp.: T1 e4 M/ E1 F$ r% o4 j
idProduct 0x5588 ) j" N" P9 b/ z: |+ S s0 i
bcdDevice 1.00) m, E5 y& [6 w4 }$ Z
iManufacturer 2 SanDisk; j1 a. E {& y6 b+ T& y
iProduct 3 USB Extreme Pro
& S4 E6 N3 Q/ S1 ]3 w1 g iSerial 1 00000000000000000000- ?$ O$ l8 H3 p1 C# `+ B/ G
bNumConfigurations 1 v7 x- R5 t# T6 V& H! w3 [
Configuration Descriptor:
5 f: i1 K1 G( n8 t0 W bLength 9
! s" O) f$ s/ ?! i, ~) K) u/ | bDescriptorType 2# o" D. v r% _% t5 V
wTotalLength 32/ e/ N: L; d$ d3 M8 a
bNumInterfaces 1
% f9 P$ o# }/ x) { bConfigurationValue 1
, _" [" F7 N0 g; J6 I8 D( J iConfiguration 0
4 _4 x% B/ E9 p% V$ z bmAttributes 0xc0
1 F: C- s' K: J: d$ K' P" O( F8 F4 v Self Powered5 a8 _! y9 L7 z" Y3 `9 V( y# g
MaxPower 0mA
, m" N) p- b1 ~3 [ Interface Descriptor:3 K: {9 T$ R/ {7 O8 k E
bLength 9
6 Q2 v, P) i, n( l. O- M0 s bDescriptorType 46 ]9 }& p# c T' ^. Y; v7 C
bInterfaceNumber 0
- n: @, V( c1 Q; P+ c bAlternateSetting 05 [$ D2 {7 a$ k/ ~- r
bNumEndpoints 2
9 M8 b ^, t- X3 F8 K+ A# B" O! R bInterfaceClass 8 Mass Storage- ?$ B2 {1 O3 H, N+ L5 L, N% J1 O
bInterfaceSubClass 6 SCSI
! A3 P% M* P" b bInterfaceProtocol 80 Bulk-Only
; @' V4 t% x0 c, @ iInterface 0 _0 C9 ]- T' [0 b Q; T& r# k
Endpoint Descriptor:! j# f2 @: o0 O* p9 k
bLength 7# W- U; P' J% f) L8 M2 }
bDescriptorType 5( F. t9 o# T% U8 E: Z
bEndpointAddress 0x81 EP 1 IN
9 |+ d, N5 y. P2 O5 Q. d bmAttributes 2
7 Q. ~+ u: y3 w6 n Transfer Type Bulk7 i9 |' N) Q) Z1 ^8 [
Synch Type None: |) j% ^% i" Z8 k% N' V% K! J
Usage Type Data: ~, r& O! a; l5 d
wMaxPacketSize 0x0200 1x 512 bytes
0 X9 b: r8 H# _# s: F5 W bInterval 0
+ w B5 \' l! u$ b Endpoint Descriptor:: {) h! u5 S8 v" l4 ^
bLength 7
; y) R5 k6 o0 h* s# M bDescriptorType 5
( i( T8 }" I2 j0 q bEndpointAddress 0x02 EP 2 OUT
. s# ?4 h9 d% b+ x$ R0 a bmAttributes 2
% q; ]: l/ U8 S& k; e$ j4 r+ { Transfer Type Bulk2 p% x4 ?$ ]9 F( k8 A$ Q
Synch Type None1 f$ `$ F/ W+ j1 i ?3 w
Usage Type Data
8 z5 h) ]- L9 R( j wMaxPacketSize 0x0200 1x 512 bytes
* ]4 C* i: z# R$ R6 s4 }% r" o: _ bInterval 0
4 N1 O/ j2 |6 u. T; l1 d- y9 DBinary Object Store Descriptor:
- U4 B6 H+ f0 G b* s* F! A0 W$ _ bLength 59 m# P, d" Y" G* D* q8 F4 {5 n
bDescriptorType 15: @6 g) r2 n$ V- Z. ?
wTotalLength 22
- V+ o* J4 M1 e) \2 y bNumDeviceCaps 2
2 y* g; O' U( T# N% b% O* M, V USB 2.0 Extension Device Capability:
6 ?* ]' u! B6 \" n h# P bLength 7! `) |: ?2 K6 c2 S6 {, s5 U* b* v, V/ ]
bDescriptorType 161 ^4 j" D2 D7 h; r4 H& |
bDevCapabilityType 2" s6 O$ h' S! m' J# w' C4 A2 j
bmAttributes 0x0000f41e+ q; ~* f/ p8 g6 q7 g3 i
Link Power Management (LPM) Supported p% O2 o+ a$ S4 i
SuperSpeed USB Device Capability:
1 ?# Q; U c/ r3 Q/ |3 ` bLength 104 b9 b6 v N! j+ g! L& y6 y4 X! _
bDescriptorType 16) I7 l1 d6 \% u9 D' |5 |3 ~7 Z
bDevCapabilityType 3# B# N7 t! @: u, U3 I
bmAttributes 0x00
6 a+ y( t( v4 v' k1 D wSpeedsSupported 0x000e7 j3 U4 c0 r' u, o* F3 N* C( O8 J
Device can operate at Full Speed (12Mbps)$ R4 g; t9 v( x" g- N* V3 ^+ P! M" g
Device can operate at High Speed (480Mbps)7 J: W. H: z% |% J5 |% W
Device can operate at SuperSpeed (5Gbps)6 U& @& ]' r- f# P# \
bFunctionalitySupport 1
2 _, F+ T. _$ R* e Lowest fully-functional device speed is Full Speed (12Mbps)
, W0 q5 S, n$ W% c4 s3 v4 `6 T bU1DevExitLat 10 micro seconds
) k# O1 f6 S" n2 r- V5 T! ]5 X+ X bU2DevExitLat 2047 micro seconds) M; t+ e+ w5 t; ]% Q# K# b" @7 b
Device Status: 0x0001
5 a5 | S O5 q4 B7 [ Self Powered# l! r* M. J" H6 ~
/ P4 i& B/ N& j6 V( \# q编辑xml文件:
2 F. V J& m, P5 K" ^4 U, U) `+ f' f' @9 w( q M% i
(nova-libvirt)[root@compute07 /]# vim usb.xml 1 F# i8 V! w d) L
<hostdev mode='subsystem' type='usb'>
% E1 L# E) ~# z# j5 a5 x1 [<source startupPolicy='optional'>
& e9 A; C4 y3 Q5 v2 P<vendor id='0x0781'/>/ @6 U/ Q# M& k6 ~
<product id='0x5588'/>
; P/ }2 T( n4 D. k! f, @8 O- T</source>
* K4 u2 o$ }6 G& t; R; H2 W+ n</hostdev>" m4 M( e7 V6 C7 M8 T
8 g/ {, H4 r6 l+ ?
添加usb到虚机 ~& C+ M. X U2 l1 H
+ F1 D- V% K1 m2 x
(nova-libvirt)[root@compute07 /]# virsh attach-device instance-00000162 usb.xml" w% Q( D0 C w: c
Device attached successfully
- }* M- N; T, l
0 i$ E- W6 X) D/ p: o) f) h(nova-libvirt)[root@compute07 /]# virsh detach-device instance-00000162 usb.xml 7 m/ P: V! f; h: T5 E1 c
Device detached successfully" j$ l t( \8 T7 y
* w# v M N* h# S1 J, y1 h) r1 ]2 S# E6 ~6 Q
( ^+ I: `' _: G, l/ J" a" h$ p
5 Q7 D- y9 |8 _1 b0 B0 s
9 c3 q6 S: K- ~- r8 s' i
, g, F, {* E! A |
|