什么usbusb driver stackUSB驱动程序堆栈.pdf
WhatisUSB
Thatisaconnectionbetweenahostcomputerandanumber
ofperipheraldevices.
USBBus
Topologically,aUSBsubsystemisnotlaidoutasabus;it
isratheratreebuiltoutofseveralpoint-to-pointlinks.
Thelinksarefour-wirecables(ground,power,andtwo
signalwires)thatconnectadeviceandahub,justlike
twisted-pairEthernet.
WorkMode
TheUSBhostcontrollerisinchargeofaskingeveryUSB
deviceifithasanydatatosend.
Becauseofthistopology,aUSBdevicecanneverstart
sendingdatawithoutfirstbeingaskedtobythehost
controller.
DriverLinuxdriversupport
TheLinuxkernelsupportstwomaintypesofUSBdrivers:
driversonahostsystemanddriversonadevice.
Fromthehost’spointofview,TheUSBdriversforahost
systemcontroltheUSBdevicesthatarepluggedintoit.
TheUSBdriversinadevice,controlhowthatsingledevice
lookstothehostcomputerasaUSBdevice.
USBdriverslivweenthedifferentkernelsubsytems
(block,net,char,etc.)andtheUSBhardwarecontrollers.
TheUSBcoreprovidesaninterfaceforUSBdriverstouseto
accessandcontroltheUSBhardware,withouthavingtoworry
aboutthedifferenttypesofUSBhardwarecontrollersthat
arepresentonthesystem.
Note:usbcoreimplementtheUSBbusspecification
TheFigureaboveshowshowUSBdevicesconsistof
configurations,interfaces,andendpointsandhowUSBdrivers
bindtoUSBinterfaces,nottheentireUSBdevice.
Endpoints
ThemostbasicformofUSBcommunicationisthroughsomething
calledanendpoint.AUSBendpointcancarrydatainonlyone
direction,eitherfromthehostcomputertothedevice
(calledanOUTendpoint)orfromthedevicetothehost
computer(calledanIN