- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
首先安装usb2 t: \1 ]% h4 Y! g3 ~- R
rpm -ivh usbutils-007-5.el7.x86_64.rpm $ u# m4 F. ?4 W! {( R$ M0 b1 _7 Y
使用lsusb命令查看:
7 B: B+ V+ {8 G# B(nova-libvirt)[root@compute07 /]# lsusb -v
. T/ i) S$ B5 {1 k8 Q- G$ l. @9 q' F6 T$ b. s& F( l
Bus 002 Device 003: ID 0781:5588 SanDisk Corp. - m3 ~2 j& ^0 ]; T" {: e+ ~
Device Descriptor:4 s: U, L6 w2 A/ q' q* Q; d
bLength 186 K8 u' o+ G1 `
bDescriptorType 18 Y1 V2 u" d y* k
bcdUSB 2.107 L4 y% V1 f# w
bDeviceClass 0 (Defined at Interface level)- x# B7 L0 i0 e, P1 ?
bDeviceSubClass 0 4 x$ V3 p& `( e: E% Y2 Z& ?$ n. f+ x0 u
bDeviceProtocol 0 ; P% }/ Z% y6 Z7 |' V' O2 Y- ?
bMaxPacketSize0 64; l- o+ Y6 h1 A, C, X* j- W+ F
idVendor 0x0781 SanDisk Corp.
& {; B6 i) O% C" {; t/ j& c2 d idProduct 0x5588
5 v9 C1 W: g: R1 z7 W bcdDevice 1.00
5 V+ ~/ X `/ R" s iManufacturer 2 SanDisk
X# _% W" a k4 J/ h' f( _. L0 S- H" i iProduct 3 USB Extreme Pro8 }$ \& i! E4 V* `3 w) @; b
iSerial 1 00000000000000000000% P( d" ]/ m& u6 d2 S7 m# `
bNumConfigurations 1
- l3 s9 c; h2 n/ S9 J I Configuration Descriptor:
! I! @* Y9 Y( R bLength 95 J. A0 f j# q9 W
bDescriptorType 2
u* T3 ~' {' @. ~6 O wTotalLength 32. }: |/ @- B% z8 k0 }
bNumInterfaces 1
' N! h* O( L- c1 Z% o# Q& U& N bConfigurationValue 1
5 i `9 Q* G! b! Z iConfiguration 0
9 n0 n5 Q, \ R bmAttributes 0xc0/ j) Z- |& `; F/ @5 L
Self Powered3 ?# N" X- B9 R. c! h% w& W8 n
MaxPower 0mA/ H9 l7 S& R% y3 C& M2 @: W
Interface Descriptor:
+ N5 e0 B9 c6 D( B3 [# ` bLength 9& S" A0 w' C8 |. Z2 X) e; t
bDescriptorType 4) M& e, I( J: S% y
bInterfaceNumber 0
- p* B6 h* o- O& ?9 c$ H; a bAlternateSetting 0( p3 i, ?& U$ G) T }$ [ c
bNumEndpoints 2
1 z+ U3 H7 r" n# c0 [. v, d bInterfaceClass 8 Mass Storage: M1 B+ @* Y" M4 [5 U
bInterfaceSubClass 6 SCSI
0 P! p% u1 u/ c9 |9 W bInterfaceProtocol 80 Bulk-Only
# r- c0 |3 I& ?9 U$ Q iInterface 0 & I( A" ]8 l. T2 j A" Z5 j
Endpoint Descriptor:" I! v6 R& H" Z" v" v/ g' F! g
bLength 7' e3 w5 m2 a7 B9 z7 j6 E
bDescriptorType 5
5 x/ y7 T" ?) M8 T7 [3 U" u7 T- u" V) V bEndpointAddress 0x81 EP 1 IN
1 |9 E6 u, G3 V/ p0 [+ P; f- a$ T bmAttributes 2) l5 ]0 a6 a8 d+ s. S. p% V2 w" M4 C
Transfer Type Bulk
# y1 O/ w5 r4 U; P# w" t& m. t% I Synch Type None
( G2 U p; G, F; b Usage Type Data
. [7 w. x" W n, C2 a4 d+ F wMaxPacketSize 0x0200 1x 512 bytes. J; z7 x) _* F8 ?: y
bInterval 0
* I/ x1 V$ c9 `2 [ V. [ Endpoint Descriptor:6 f- e! g& D9 y3 V( Q+ p2 N4 d% L
bLength 7. G+ F% U( S0 v h! t+ K. A
bDescriptorType 59 ` L; f3 N' }5 d
bEndpointAddress 0x02 EP 2 OUT1 F! C6 e% q3 `$ I& A
bmAttributes 2, x' l5 G) i% z2 C+ }! L! z
Transfer Type Bulk
( \6 u. E; k. ^8 Z0 e2 u z Synch Type None
( f! z1 U$ k* m% a% f, x7 I Usage Type Data
; O- A5 A5 \. y- R: L& s. @3 ^ wMaxPacketSize 0x0200 1x 512 bytes% d+ B7 K/ M$ R8 z
bInterval 0
% Y7 p8 b! Z% I, g2 D8 S0 v2 nBinary Object Store Descriptor:0 p' j3 S. B- F$ e7 K
bLength 5
* x# u7 S y& ~ bDescriptorType 15/ g8 \; R/ J, B2 B9 s% f& {* ^. t' O: ~
wTotalLength 22
- C8 [0 {: T0 Z bNumDeviceCaps 2. e( K) K0 y* l- T
USB 2.0 Extension Device Capability:+ C5 g# |3 [% f5 k: K
bLength 7
3 Z8 a4 O* \) L+ x2 i+ A8 { bDescriptorType 16# T; A1 i9 f+ h1 G
bDevCapabilityType 26 x; o! O5 z+ C1 d
bmAttributes 0x0000f41e( e: M) Y8 ?; Z3 r
Link Power Management (LPM) Supported! N% M1 Q# U3 X/ ^; r; k& ]/ X) J
SuperSpeed USB Device Capability:/ h0 n4 P: v6 W: j* {( p
bLength 107 j; O( K! O2 D/ p4 w. |$ P
bDescriptorType 16
* n' Q+ ~: J8 k3 [! F/ U bDevCapabilityType 3 U' H$ t) h0 h, o/ P& p) D. L
bmAttributes 0x00% t5 |4 @: G2 w" m# j7 I/ y
wSpeedsSupported 0x000e
0 U( d- [6 N' w$ h" F8 @! f Device can operate at Full Speed (12Mbps)# M. ^) D4 ?6 s
Device can operate at High Speed (480Mbps)8 w, _! ?5 D. d& x( ^
Device can operate at SuperSpeed (5Gbps)
$ g8 T% P% P/ m; \ bFunctionalitySupport 1
' ~+ A# K+ Y2 [, ?% \ Lowest fully-functional device speed is Full Speed (12Mbps)
( {9 o; ^) l, L/ K9 d# l bU1DevExitLat 10 micro seconds
9 s% U" H2 d! ], Q bU2DevExitLat 2047 micro seconds. _3 g7 i3 K( l7 }
Device Status: 0x0001
) J, j# G: v1 M: U7 x; y# X Self Powered6 e7 |% b& U, J; T
5 [: v2 x! r/ E0 n$ F+ s6 s编辑xml文件:
, v8 C; W/ w3 X% k
* D; b: r2 o! h8 J(nova-libvirt)[root@compute07 /]# vim usb.xml . j: Q7 |( C: ]% f' Y9 i. ?
<hostdev mode='subsystem' type='usb'>. `4 r, r4 v- k& z9 A' [
<source startupPolicy='optional'>
; r, D+ \" {8 u! m( \3 e4 P; M<vendor id='0x0781'/>2 r" P$ j$ } d9 _* \: I
<product id='0x5588'/>
+ i- [- U5 Z; g</source>( h* l- K- H: l5 ]- Y3 H# D
</hostdev>
' a4 E% k, P! A* M+ g; `8 f, g$ M0 \- V
添加usb到虚机; c9 m% f* V8 c) A2 \2 O1 B1 W
, }8 b& ]; H; S! c) ~4 y+ c
(nova-libvirt)[root@compute07 /]# virsh attach-device instance-00000162 usb.xml
, e$ B8 L/ m' i5 [& v" lDevice attached successfully
^" u1 |" Y' m! ?4 S
6 u6 W* ?2 H& S(nova-libvirt)[root@compute07 /]# virsh detach-device instance-00000162 usb.xml
3 a; Q& a! O5 \5 I4 z4 L5 hDevice detached successfully
3 Y+ N& l- R1 x' d% @$ r
! F" v1 S1 d' R# [5 r2 S& c3 q% F$ m k" B) Z5 q! C2 T
$ l. u2 P+ e) z4 y* l
2 q/ J! \5 I& F# F& s' {3 }2 ~* B
! W- o- Y% ^+ |5 A- a3 K; `4 x, P! {2 W
|
|