You are on page 1of 169

USB 2.

0 Specification
Chapter 9
USB Device Framework
Macpaul Lin
1 USB 2.0 Specification - Chapter 9 -
Device Framework
Disclaim
ll the materials of this sli!e is onl" a !irective work #ase on
the materials liste! in $eference.
%he purpose of this sli!e is for knowle!&e sharin& an! for
people un!erstan!in& USB stan!ar! easier.
Most of the material of the Cop"ri&ht shoul! #elon& to Universal Serial Bus
Specification Cop"ri&ht ' 2000( Compa) Computer Corporation( *ewlett+
,ackar! Compan"( -ntel Corporation( Lucent %echnolo&ies -nc( Microsoft
Corporation( ./C Corporation( 0oninkli1ke ,hilips /lectronics ..2. ll ri&hts
reserve!.
%he !irective work part shoul! #e use! as Creative Commons license 3.0
4B5+.C+S6.
For !istri#utin& this sli!e( the Disclaim an! $eference shoul! #e inclu!e! in
the !istri#ution.
USB 2.0 Specification - Chapter 9 -
Device Framework
2
$eference
USB 2.0 specification
http788www.us#.or&8!evelopers8!ocs8us#92090:0;;2.<ip
USB in a .utshell
http788www.#e"on!lo&ic.or&8us#nutshell8us#;.shtml
USB 2.0 Specification - Chapter 9 -
Device Framework
3
=utline
9.; USB Device States
9.2 >eneric USB Device =perations
9.3 USB Device $e)uests
9.? Stan!ar! Device $e)uests
9.@ Descriptors
9.: Stan!ar! USB Descriptor Definitions
9.A Device Class Definitions
4 USB 2.0 Specification - Chapter 9 -
Device Framework
=verview

USB !evice ma" #e !ivi!e! into


three la"ers7

%he top la"er is the functionalit" provi!e! #"


the serial #us !evice( for instance( a mouse or
-SD. interface.

The middle layer handles routing data


between the bus interface and various
endpoints on the device.

An endpoint is the ultimate consumer or


provider of data. It may be thought of as
a source or sink for data.

%he #ottom la"er is a #us interface that


transmits an! receives packets.

%his chapter !escri#es the common


attributes an! operations of the
mi!!le la"er of a USB !evice.

%hese attri#utes an! operations are use! #"


the function+specific portions of the !evice to
communicate throu&h the #us interface an!
ultimatel" with the host.
5 USB 2.0 Specification - Chapter 9 -
Device Framework
=verview


USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice States
9.;.; 2isi#le Device States
9.;.2 BUS /numeration
! USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States


" USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States
Attached
9 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States
"owered
10 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States
"owered
%"pe

Self+,owere!

Bus+powere!
Both self+powere! or #us+powere! !evices
the" wonBt #e consi!ere! to #e in the
,owere! state until the" are attache! to
the USB an! 2BUS is applie! to the
!evice.
11 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States

"owered

Device

Devices report their power source capa#ilit"


throu&h the confi&uration !escriptor.

%he current power source is reporte! as part


of a !eviceBs status.

Both mo!e is supporte!

-f a confi&uration is capa#le of supportin& #oth


power mo!es( the power maCimum reporte! for that
confi&uration is the maCimum the !evice will !raw
from 2BUS in either mo!e.

%he !evice must o#serve this maCimum( re&ar!less


of its mo!e.

=nl" one mo!e is supporte!.

-f a confi&uration supports onl" one power mo!e


an! the power source of the !evice chan&es( the
!evice will lose its current confi&uration an! a!!ress
an! return to the ,owere! state.

-f a !evice is self+powere! an! its current


confi&uration re)uires more than ;00 m(
then if the !evice switches to #ein& #us+
powere!( it must return to the !!ress state.

Self+powere! hu#s that use 2BUS to power the


*u# Controller are allowe! to remain in the
Confi&ure! state if local power is lost.
12 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States
"owered
*UB

Bus powere! hu#s !o not provi!e an"


!ownstream power until the" are confi&ure!.

USB !evice must #e a#le to #e a!!resse!


within a specifie! time perio! from when power
is initiall" applie! Drefer to Chapter AE.

fter an attachment to a port has #een


!etecte!( the host ma" ena#le the port( which
will also reset the !evice attache! to the port.
13 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States
!efault
14 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States

!efault

!evice reset

After the device has been powered# it


must not respond to any bus
transactions until it has received a reset
from the bus.

After receiving a reset# the device is then


addressable at the default address.

!evice speed

$hen the reset process is complete# the


US device is operating at the correct
speed %i.e.# low&'full&'highspeed(.

The speed selection for low& and full&speed is


determined by the device termination
resistors.

A device that is capable of high&speed


operation determines whether it will operate
at high&speed as a part of the reset process
%see )hapter * for more details(.

!evice behavior

A device capable of high&speed operation


must reset successfully at full&speed
when in an electrical environment that is
operating at full&speed.

After the device is successfully reset# the


device must also respond successfully to
device and configuration descriptor
re+uests and return appropriate
information.

The device may or may not be able to


support its intended functionality when
operating at full&speed.
15 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States
Address
All US devices use the default
address when initially powered or
after the device has been reset.
,ach US device is assigned a
uni+ue address by the host after
attachment or after reset.
1 USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States

)onfigured

Before a USB !eviceBs function ma" #e use!(


the !evice must #e confi&ure!.

Confi&uration involves correctl" processin& a


SetConfi&urationDE re)uest with a non+<ero
confi&uration value.

Confi&urin& a !evice or chan&in& an alternate


settin& causes all of the status an!
confi&uration values associate! with
en!points in the affecte! interfaces to #e set
to their !efault values.

%his inclu!es settin& the !ata to&&le of an"


en!point usin& !ata to&&les to the value
D%0.
1! USB 2.0 Specification - Chapter 9 -
Device Framework
9.;.; 2isi#le Device States

Suspended

Fhen to automaticall" enter the Suspen!e!


state.

no #us traffic for a specifie! perio! ( eC7 3ms


Drefer to Chapter AE.

ttache! !evices must #e prepare! to


suspen! at an" time the" are powere!.

Suspen!8Selective suspen!.

Bus activit" ma" cease !ue to the host


enterin& a suspen! mo!e of its own.

-n a!!ition( a USB !evice shall also enter the


Suspen!e! state when the hu# port it is
attache! to is !isa#le!.

$esume

USB !evice ma" also re)uest the host to eCit


suspen! mo!e or selective suspen! #" usin&
electrical si&nalin& to in!icate remote wakeup.
D=ptionalE

-f a USB !evice is capa#le of remote wakeup


si&nalin&( the !evice must support the a#ilit"
of the host to ena#le an! !isa#le this
capa#ilit".

Fhen the !evice is reset( remote wakeup


si&nalin& must #e !isa#le!.
1" USB 2.0 Specification - Chapter 9 -
Device Framework
9.1.- us ,numeration
%he host uses this process to i!entif"
an! mana&e the !evice state chan&es
when a USB !evice is attache! to or
remove!.
19 USB 2.0 Specification - Chapter 9 -
Device Framework
9.1.- us ,numeration
.n !evice Attach
Default
!!ress
*=S% *UB
D/2-C
/
D0E Device is
attache! to a
powere! port.
D;E $eport event via a
repl" on status chan&e
pipe. D;;.;2.3E
D2E *ost )uer" hu# to !etermine
chan&e.
D;E ,ort
Disa#le!
D3E *ost wait ;00ms at least for
power to #e sta#le
D3E *ost issues a port ena#le an!
reset comman! to that port.
DA.;.A.@E
D?E ,ort $eset
D;;.@.;.@E
D;E ,owere!
State
D?E Default
State
D?E Device !raw no more than
;00m from 2BUS
D@E %he host assi&ns a uni)ue a!!ress to the USB !evice. D@E !!ress
State
D:E Default Control ,ipe is still accessi#le via the !efault a!!ress
D:E %he host rea!s the !evice !escriptor to !etermine what actual
maCimum !ata pa"loa! si<e this USB !eviceBs !efault pipe can use.
DAE %he host rea!s the confi&uration information from the !evice D0 to
n+; confi&urationsE G
msecs
DHE the host assi&ns a confi&uration value to the !evice. DHE Confi&ure! state
ll of the en!points shoul!
#e rea!"
DHE Device !raw 2BUS !epen!s on
confi&
20 USB 2.0 Specification - Chapter 9 -
Device Framework
9.1.- us ,numeration
.n !evice !etach.
*=S% *UB
D/2-C
/
D0E Device is
!ettache! to a
powere! port.
D;E Sen! notification to
*=S%
D;E ,ort
Disa#le!
D3E *ost up!ate its local
topolo&ical information.
D;E ,owere!
State
21 USB 2.0 Specification - Chapter 9 -
Device Framework
9.- /eneric US !evice
.perations
9.-.1 !ynamic Attachment and
0emoval
9.-.- Address Assignment
9.-.1 )onfiguration
9.-.2 !ata Transfer
9.-.3 "ower 4anagement
9.-.5 0e+uest "rocessing
9.-.* 0e+uest ,rror
22 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.1 !ynamic
Attachment and 0emoval

%he hu# that provi!es the


attachment point or port is
responsi#le for reportin& an" chan&e
in the state of the port.

Fhen host ena#les the hu# port


when !evice is attache!( will also
lea! !evice resettin&.

reset Dport resetE USB !evice has the


followin& characteristics7

$espon!s to the !efault USB a!!ress

-s not confi&ure!

-s not initiall" suspen!e!


23 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.- Address
Assignment
%he host is responsi#le for assi&nin& a
uni)ue a!!ress to the !evice.
%his is !one after the !evice has #een
reset #" the host( an! the hu# port
where the !evice is attache! has #een
ena#le!.
24 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.1 )onfiguration
%he host is responsi#le for confi&urin& a
USB !evice.
%he host t"picall" re)uests confi&uration
information from the USB !evice to
!etermine the !eviceBs capa#ilities.
s part of the confi&uration process( the
host sets the !evice confi&uration an!(
where necessar"( selects the appropriate
alternate settin&s for the interfaces.
25 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.1 )onfiguration
Fithin a sin&le confi&uration( a !evice
ma" support multiple interfaces.
2 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.1 )onfiguration
Single )onfiguration
*=S%
D/2-C
/
Fithin a sin&le confi&uration( a
!evice ma" support multiple
interfaces.
function
-nterface
0
/,
/,
/,
Sin&le
Feature
-nterface
;
/,
/,
/,
Sin&le
Feature
!evice class or ven!or+specific protocol
function
-nterface
.+;
/,
/,
/,
Sin&le
Feature
2! USB 2.0 Specification - Chapter 9 -
Device Framework
function
-nterface
0
/,
/,
/,
Sin&le
Feature
-nterface
;
/,
/,
/,
Sin&le
Feature
9.-.1 )onfiguration
Alternate settings
*=S%
D/2-C
/
An interface within a
configuration may
have alternate
settings that redefine
the number or
characteristics of the
associated
endpoints.
-f this is the case( the !evice
must support the >et-nterfaceDE
re)uest to report the current
alternate settin& for the specifie!
interface
-f this is the case( the !evice
must support Set-nterfaceDE
re)uest to select
the alternate settin& for the
specifie! interface.
function
-nterface
.+;
/,
/,
/,
Sin&le
Feature
2" USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.1 )onfiguration
Alternate settings
HOST
function
D/2-C
/
-nterface
0
/,
/,
/,
-nterface
0
/,
/,
/,
function
D/2-C
/
-nterface
0
/,
/,
/,
-nterface
0
/,
/,
/,
Device
Driver
-nterface !escriptors contain
Class, SubClass, and Protocol
fields to
i!entif" an! communication
with the functionDsE.
class co!e is assi&ne! to a &roup
of relate! !evices that has #een
characteri<e!
as a part of a USB Class
Specification.
29 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.2 !ata Transfer

Data ma" #e transferre! #etween a


USB !evice en!point an! the host in
one of ? wa"s. DChapter @E.

n en!point num#er ma" #e use! for !ifferent


t"pes of !ata transfers in !ifferent alternate
settin&s.

*owever( once an alternate settin& is selecte!


Dinclu!in& the !efault settin& of an interfaceE(
a USB !evice en!point uses onl" one !ata
transfer metho! until a !ifferent alternate
settin& is selecte!.
30 USB 2.0 Specification - Chapter 9 -
Device Framework
? t"pes of transfer7
Control
-sochronous
Bulk
-nterrupt
9.-.3 "ower
4anagement
9.-.3.1 "ower udgeting
9.-.3.- 0emote $akeup
31 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.3.1 "ower udgeting

Durin& !evice enumeration( a host


evaluates a !eviceBs power
re)uirements.

-f the power re)uirements of a particular


confi&uration eCcee! the power availa#le to
the !evice( *ost Software shall not select that
confi&uration.

USB !evices shall limit the power the"


consume from 2BUS to one unit loa!
D;00mIE or less until confi&ure!.

Depen!in& on the power capa#ilities of the


port to which the !evice is attache!( a USB
!evice ma" #e a#le to !raw up to five unit
loa!s D@00mIE from 2BUS after confi&uration.

Suspen!e! !evices( whether confi&ure! or


not( shall limit their #us power consumption as
!efine! in Chapter A.
32 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.3.- 0emote $akeup

$emote wakeup allows a suspen!e!


USB !evice to si&nal a host that ma"
also #e suspen!e!.

%his notifies the host that it shoul! resume


from its suspen!e! mo!e.

USB !evice reports its a#ilit" to support


remote wakeup in a confi&uration !escriptor.

-f a !evice supports remote wakeup( it must


also allow the capa#ilit" to #e ena#le! an!
!isa#le! usin& the stan!ar! USB re)uests.

$emote wakeup is accomplishe! usin&


electrical si&nalin& !escri#e! in Section
A.;.A.A.
33 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.: $e)uest ,rocessin&

!evice ma" #e&in processin& of a


re)uest as soon as the !evice
returns the C0 followin& the Setup.

eCcepts Set!!ressDE re)uests Dsee Section


9.?.:E.

%he !evice is eCpecte! to


4complete6 processin& of the
re)uest #efore it allows the Status
sta&e to complete successfull".

D,ollin&.E

Some re)uests initiate operations


that take man" millisecon!s to
complete.

D-n!ication.E

For re)uests such as this( the !evice class is


re)uire! to !efine a metho! other than Status
sta&e completion to in!icate that the
operation has complete!.

For eCample( a reset on a hu# port takes at


least ;0 ms DeC7 ;0 frames8H0 microframesEto
complete.

%he Set,ortFeatureD,=$%9$/S/%E Dsee Chapter


;;E re)uest 4completes6 when the reset on
the port is initiate!.

.ote7 D*i&h+spee!7 ;2@ Js microframe( Full+


Spee!7 ; ms frameE.
34 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.: $e)uest ,rocessin&


6igure 3&12. Transfers for
)ommunication 6lows
35 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.: $e)uest ,rocessin&

Completion of the reset operation is si&nale!


when the portBs status chan&e is set to
in!icate that the port is now ena#le!.
%his techni)ue prevents the host from
havin& to constantl" poll for a
completion when it is known that the
re)uest will take a relativel" lon&
perio! of time.
3 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.1 0e+uest
"rocessing Timing
USB sets an upper limit of @ secon!s as the upper limit
for an" comman! to #e processe!.
%his limit is not applica#le in all instances.
-t shoul! #e note! that the limitations &iven #elow are
inten!e! to encompass a wi!e ran&e of
implementations.
-mplementations shoul! strive to complete re)uests in
times that are as short as possi#le.
3! USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.- 0eset'0esume
0ecovery Time
fter a port is reset or resume!( the USB S"stem
Software is eCpecte! to provi!e a 4recover"6
interval of ;0 ms #efore the !evice attache! to the
port is eCpecte! to respon! to !ata transfers.
%he !evice ma" i&nore an" !ata transfers !urin&
the recover" interval.
fter the en! of the recover" interval( the !evice
must accept !ata transfers at an" time.
3" USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.- 0eset'0esume
0ecovery Time
*=S% *UB
D/2-C
/
*ost issues a port $eset8$esume. ,ort $eset8$esume
Data
%ransfer
$esponse Data
%ransfer
;0 ms
recover
"
interval
39 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.1 Set Address
"rocessing

fter the reset8resume recover"


interval if a !evice receives a
Set!!ressDE re)uest( the !evice
must #e a#le to complete processin&
of the re)uest an! #e a#le to
successfull" complete the Status
sta&e of the re)uest within @0 ms.

-n the case of the Set!!ressDE


re)uest( the Status sta&e
successfull" completes when the

!evice sen!s the <ero+len&th Status packet

or when the !evice sees the C0 in response


to the Status sta&e !ata packet.

fter successful completion of the


Status sta&e( the !evice is allowe! a
Set!!ressDE recover" interval of 2
ms.

t the en! of this interval( the !evice


must #e a#le to accept Setup packets
a!!resse! to the new a!!ress.

lso( at the en! of the recover"


interval( the !evice must not respon!
to tokens sent to the ol! a!!ress
Dunless( of course( the ol! an! new
a!!ress is the sameE.
40 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.1 Set Address
"rocessing
*=S% *UB
D/2-C
/
*ost issues a port $eset8$esume. ,ort $eset8$esume
;0 ms
recover
"
interval
@0
ms
D@E %he host sen! Set!!ressDE to the USB
!evice DSetupE
D@E !!ress
State
C0
D@E %he host check status to the USB !evice.
<ero+len&th Status
packet
C0
D@E %he host sen! .ew Set!!ressDE to the USB !evice
2 ms
Set!!ress
DE recover"
interval
Status
Sta&e
Fin
41 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.2 Standard !evice
0e+uests
%here are 3 kin!s of Stan!ar! !evice
re)uests.
$e)uire no Data sta&e.
$e)uire Data sta&e transfer to the host
$e)uire Data sta&e transfer to the Device.
42 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.2 Standard !evice
0e+uests

Stan!ar! !evice re)uests re)uire no


Data sta&e7

!evice must #e a#le to

complete the re)uest(

successfull" complete the Status sta&e of the


re)uest(

within @0 ms of receipt of the re)uest.

%his limitation applies to re)uests to the


re)uest t"pes

Device

-nterface

/n!point.
43 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.2 Standard !evice
0e+uests

Stan!ar! !evice re)uests re)uire


Data sta&e transfer to the host

!evice must #e a#le to

return the first !ata packet to the host within


@00 ms of receipt of the re)uest.

For su#se)uent !ata packets( if an"( the


!evice must #e a#le to return them within @00
ms of successful completion of the
transmission of the previous packet.

%he !evice must then #e a#le to successfull"


complete the status sta&e within @0 ms after
returnin& the last !ata packet.
44 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.2 Standard !evice
0e+uests
*=S% *UB
D/2-C
/
@00
ms
%he host sen! Stan!ar! Device $e)uests
DSetupE
C0
%he host check status to the USB !evice DStatusE
<ero+len&th Status
packet
C0 Status
Sta&e
Fin
@0
ms
%he host sen! Stan!ar! Device $e)uests
DDataE
D% 0
@00
ms
%he host sen! Stan!ar! Device $e)uests
DDataE
D% ;
45 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.2 Standard !evice
0e+uests

Stan!ar! !evice re)uests re)uire


Data sta&e transfer to the Device

%he @+secon! limit applies.

%his means that the !evice must #e capa#le


of acceptin& all !ata packets from the host
an! successfull" completin& the Status sta&e
if the host provi!es the !ata at the maCimum
rate at which the !evice can accept it.

Dela"s #etween packets intro!uce! #" the


host a!! to the time allowe! for the !evice to
complete the re)uest.
4 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.3 )lass&specific
0e+uests
Unless specificall" eCempte! in the class
!ocument( all class+specific re)uests must meet
the timin& limitations for stan!ar! !evice re)uests.
-f a class !ocument provi!es an eCemption( the
eCemption ma" onl" #e specifie! on a re)uest+#"+
re)uest #asis.
Faster response ma" #e re)uire! for stan!ar! an!
class+specific re)uests.
4! USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.5 Speed !ependent
!escriptors

%he !evice alwa"s knows its


operational spee! !ue to havin& to
mana&e its transceivers correctl" as
part of reset processin& DChapter AE

!evice also operates at a sin&le


spee! after completin& the reset
se)uence.

-n particular( there is no spee! switch !urin&


normal operation.

*owever( a hi&h+spee! capa#le !evice ma"


have confi&urations that are spee!
!epen!ent.

*i&h+spee! capa#le !evices must support


reportin& their spee! !epen!ent
confi&urations.
4" USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.5 Speed !ependent
!escriptors
hi&h+spee! capa#le !evice respon!s with
!escriptor information that is vali! for the
current operatin& spee!.
For eCample( when a !evice is aske! for
confi&uration !escriptors( it onl" returns those
for the current operatin& spee! De.&.( full
spee!E.
*owever( there must #e a wa" to !etermine
the capa#ilities for #oth hi&h+ an! full+spee!
operation.
49 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.5 Speed !ependent
!escriptors

%wo !escriptors allow a hi&h+spee!


capa#le !evice to report
confi&uration information a#out the
other operatin& spee!.

%he Dother9spee!E !evice9)ualifier !escriptor

%he other9spee!9confi&uration !escriptor.

%hese two !escriptors are retrieve!


#" the host #" usin& the
>etDescriptor re)uest with the
correspon!in& !escriptor t"pe
values.

.ote7 %hese !escriptors are not retrieve!


unless the host eCplicitl" issues the
correspon!in& >etDescriptor re)uests.

-f these two re)uests are not issue!( the


!evice woul! simpl" appear to #e a sin&le
spee! !evice.
50 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.5.5 Speed !ependent
!escriptors

Devices that are hi&h+spee! capa#le


must set the version num#er in the
#c!USB fiel! of their !escriptors to
0200*.

%his in!icates that such !evices support the


other9spee! re)uests !efine! #" USB 2.0.

!evice with !escriptor version num#ers less


than 0200* shoul! cause a $e)uest /rror
response if it receives these other9spee!
re)uests.

USB ;.C !evice shoul! not #e issue! the


other9spee! re)uests.
51 USB 2.0 Specification - Chapter 9 -
Device Framework
9.-.* 0e+uest ,rror

=ccurre! when re)uest is receive!


#" a !evice

that is not !efine! for the !evice(

is inappropriate for the current settin& of the


!evice(

has values that are not compati#le with the


re)uest.

%he !evice !eals with the $e)uest


/rror #" returnin& a S%LL ,-D in
response to

the neCt Data sta&e transaction

or in the Status sta&e of the messa&e. 52 USB 2.0 Specification - Chapter 9 -


Device Framework
9.1 US !evice 0e+uests
ll USB !evices respon! to re)uests from
the host on the !eviceBs Default Control
,ipe.
%he re)uest an! the re)uestBs parameters
are sent to the !evice in the Setup packet.
%he host is responsi#le for esta#lishin& the
values passe! in the fiel!s.
/ver" Setup packet has ei&ht #"tes.
53 USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice 0e+uests


54 USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice 0e+uests
Setup !ata

9.1.1 bm0e+uestType

Direction

this fiel! i!entifies the !irection of !ata


transfer in the secon! phase of the control
transfer.

%he state of the Direction #it is i&nore! if the


wLen&th fiel! is <ero( si&nif"in& there is no
Data sta&e.

%"pe

Stan!ar! D%a#le 9+3E( all !evices must support.

!evice class ma" !efine a!!itional re)uests.


!evice ven!or ma" also !efine re)uests
supporte! #" the !evice.

$ecipient

Fhen an interface or en!point is specifie!( the


w-n!eC fiel! i!entifies the interface or
en!point.
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
07 *+to+
D
;7 D+to+
*
07 Stan!ar!
;7 Class
27 2en!or
37 $eserve!
07 Device
;7 -nterface
27 /n!point
37 =ther
?..3;7 $eserve!
Direction $ecipient %"pe
A : @ ? 3 2 ; 0
bits
55 USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice 0e+uests
Setup !ata
9.1.- b0e+uest
%he %"pe #its in the
#m$e)uest%"pe fiel! mo!if" the
meanin& of this fiel!.
USB 2.0 specification onl"
!efines stan!ar! re)uests.
9.1.1 w7alue
%he contents of this fiel! var"
accor!in& to the re)uest.
-t is use! to pass a parameter to
the !evice( specific to the
re)uest.
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
5 USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice 0e+uests
Setup !ata
9.1.2 wInde8
-t is use! to pass a parameter to the !evice( specific to the re)uest.
For /n!point Case

Direction
0 for =U% en!point( ; for -. en!point.
Control ,ipe7

Shoul! #e set to 0.

But !evice ma" accept either value.


Direction /n!point .um#er $eserve! D$eset to KeroE
A : @ ? 3 2 ; 0
07 =U%
/,
;7 -. /,
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
$eserve! D$eset to KeroE
;@ ;? ;3 ;2 ;; ;0 9 H
bits
5! USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice 0e+uests
Setup !ata

9.1.2
wInde8

-t is use! to
pass a
parameter to
the !evice(
specific to
the re)uest.

For -nterface
Case
-nterface .um#er
A : @ ? 3 2 ; 0
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
$eserve! D$eset to KeroE
;@ ;? ;3 ;2 ;; ;0 9 H
bits
5" USB 2.0 Specification - Chapter 9 -
Device Framework
9.1 US !evice 0e+uests
9.1.3 w9ength
%his fiel! specifies the len&th of the !ata transferre! !urin& the secon! phase
of the control transfer.

=n an input re)uest( a !evice must never return more !ata than is in!icate! #" the wLen&th
valueL it ma" return less.

=n an output re)uest( wLen&th will alwa"s in!icate the eCact amount of !ata to #e sent #" the
host.
59 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2 Standard !evice
0e+uests
USB !evices must respon! to stan!ar!
!evice re)uests( even if the !evice has
not "et #een assi&ne! an a!!ress or
has not #een confi&ure!.
0 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2 Standard !evice
0e+uests


1 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2 Standard !evice
0e+uests

Feature selectors are


use! when ena#lin& or
settin& features( such
as remote wakeup(
specific to a !evice(
interface( or en!point.
2 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2 Standard !evice
0e+uests

Feature selectors are use! when


ena#lin& or settin& features( such as
remote wakeup( specific to a !evice(
interface( or en!point.

-f an unsupporte! or invali! re)uest is ma!e


to a USB !evice( the !evice respon!s #"
returnin& S%LL in the Data or Status sta&e of
the re)uest.

-f the !evice !etects the error in the Setup


sta&e( it is preferre! that the !evice returns
S%LL at the earlier of the Data or Status
sta&e.

$eceipt of an unsupporte! or invali! re)uest


!oes .=% cause the optional *alt feature on
the control pipe to #e set.

-f for an" reason( the !evice #ecomes una#le


to communicate via its Default Control ,ipe
!ue to an error con!ition( the !evice must #e
reset to clear the con!ition an! restart the
Default Control ,ipe.
3 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 )lear 6eature
%his re)uest is use! to clear or !isa#le
a specific feature.
Data
.one
Direction CL/$
F/%U$/
07 *+to+
D
07 /.D,=-.%9*L%
$ecipient7 /n!point
;7
D/2-C/9$/M=%/9F0/U
,
$ecipient7 Device
27 %/S%9M=D/
$ecipient7 Device
DIE7 -nterface
07 Device
;7
-nterface
27
/n!point
F/%U$/
Selector
Kero -nterface
/n!point
0
Kero
0
Must
#e
mappe
!
;
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
4 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 )lear 6eature

ClearFeatureDE
re)uest that
references

a feature

that cannot #e cleare!

that !oes not eCist

or an interface or
en!point that !oes
not eCist

will cause the


!evice to respon!
with a $e)uest
/rror.

!efault state:

;ot specified.

Address state:

7alid

references to
interfaces or to
en!points other
than en!point <ero
shall cause the
!evice to respon!
with a $e)uest
/rror.

)onfigured
state:

7alid.
5 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.- /et )onfiguration
%his re)uest returns the current !evice
confi&uration value.
Data
Confi&2al
ue
Direction
0CH0
>/%9
C=.F->
;7 D+to+
*
07 Device
Kero
0
Kero
0
=ne
;
H
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et )onfiguration
-f the returne! value
is <ero( the !evice is
not confi&ure!.
!efault state:
;ot specified.
Address state:
The value <ero must be
returned.
)onfigured state:
%he non+<ero
bConfigurationValue of the
current configuration must
be returned.
! USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et !escriptor
%his re)uest returns the current !evice
confi&uration value.
Data
Descripto
r
Direction
0CH0
>/%
D/SC$-,%
=$
;7 D+to+
*
07 Device
Descriptor %"pe D*-E
an!
Descriptor -n!eC
DL=E
Kero or Lan&ua&e -D
D9.:.AE
Descriptor Len&th
: *i&h #"te7 Descriptor
%"pes
;7 D/2-C/
27 C=.F->U$%-=.
37 S%$-.>
?7 -.%/$FC/
@7 /.D,=-.%
:7 D/2-C/9MUL-F-/$
A7 =%*/$9S,//D9C=.F->
H7 -.%/$FC/9,=F/$
Low B"te7 Descriptor
-n!eC
Strin& Descriptors7
Lan&ua&e -D
=thers7 Kero
%he num#er of #"tes to
return.
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
" USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et !escriptor

w2alue7

%he !escriptor in!eC is use! to select a


specific !escriptor Donl" for confi&uration an!
strin& !escriptorsE when several !escriptors of
the same t"pe are implemente! in a !evice.

For eCample( a !evice can implement several


confi&uration !escriptors.

%he ran&e of values use! for a !escriptor


in!eC is from 0 to one less than the num#er
Dn+;E of !escriptors of that t"pe implemente!
#" the !evice.

For other stan!ar! !escriptors that can #e


retrieve! via a >etDescriptorDE re)uest( a
!escriptor in!eC of <ero must #e use!.
9 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et !escriptor

w-n!eC

Lan&ua&e -D for strin& !escriptors

or is reset to <ero for other !escriptors.

wLen&th

-t specifies the num#er of #"tes to return.

-f the !escriptor is lon&er than the wLength


field, onl" the initial #"tes of the !escriptor
are returne!. Duse wLen&thE

-f the !escriptor is shorter than the wLen&th


fiel!( the !evice in!icates the en! of the
control transfer #" sen!in& a short packet
when further !ata is re)ueste!.

short packet is !efine! as a packet shorter than


the maCimum pa"loa! si<e or a <ero len&th !ata
packet Drefer to Chapter @E.
!0 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et !escriptor
%he stan!ar! re)uest to a !evice supports three t"pes of
!escriptors7
!evice Dalso !evice9)ualifierE

hi&h+spee! capa#le !evice supports the !evice9)ualifier !escriptor to


return information a#out the !evice for the spee! at which it is not
operatin& Dinclu!in& wMaxPacketSize for the default endpoint and the
number of configurations for the other speed.
Strin&
confi&uration Dalso other9spee!9confi&urationE
!1 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et !escriptor

confi&uration Dalso other9spee!9confi&urationE

%he other9spee!9confi&uration returns information in the same structure as


a confi&uration !escriptor( #ut for a confi&uration if the !evice were
operatin& at the other spee!.

re)uest for a confi&uration !escriptor returns the confi&uration !escriptor(


all interface !escriptors( an! en!point !escriptors for all of the interfaces in
a sin&le re)uest.

%he first interface !escriptor follows the confi&uration !escriptor.

%he en!point !escriptors for the first interface follow the first interface !escriptor.

-f there are a!!itional interfaces( their interface !escriptor an! en!point


!escriptors follow the first interfaceBs en!point !escriptors.

Class+specific an!8or ven!or+specific !escriptors follow the stan!ar!


!escriptors the" eCten! or mo!if".
USB in a .utShell( http788www.#e"on!lo&ic.or&8us#nutshell8us#@.shtml
!2 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1 /et !escriptor
ll !evices must
provi!e a !evice
!escriptor an! at least
one confi&uration
!escriptor.
-f a !evice !oes not
support a re)ueste!
!escriptor( it respon!s with
a $e)uest /rror.

!efault state:

%his is a vali!
re)uest when the
!evice is in the
Default state.

Address state:

%his is a vali!
re)uest when the
!evice is in the
!!ress state.

)onfigured
state:

%his is a vali!
re)uest when the
!evice is in the
Confi&ure! state.
!3 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.2 /et Interface
%his re)uest returns the selecte!
alternate settin& for the specifie!
interface.
Data
lternate
Settin&
Direction
0CH;
>/%
-nterface
;7 D+to+
*
;7
-nterface
Kero
0
-nterface
n
=ne
;
;0
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
!4 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.2 /et Interface

Some USB !evices


have
confi&urations with
interfaces that
have mutuall"
eCclusive settin&s.

%his re)uest allows


the host to
!etermine the
currentl" selecte!
alternate settin&.

-f the interface
specifie! !oes not
eCist( then the
!evice respon!s
with a $e)uest
/rror.

!efault state:

Device #ehavior
when this re)uest
is receive! while
the !evice is in the
Default state is not
specifie!.

Address state:

$e)uest /rror
response is &iven
#" the !evice.

)onfigured
state:

2ali!.
!5 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status
%his re)uest returns status for the specifie!
recipient.
%he !ata returne! is the current status of the specifie!
recipient.
Data
Device( -nterface( or
/n!point Status
Direction >/%
S%%US
;7 D+to+
*
07 Device
;7
-nterface
27
/n!point
Kero
0
Kero -nterface
/n!point
0
%wo
2
0
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
! USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status

-f an interface or
an en!point is
specifie! that !oes
not eCist( then the
!evice respon!s
with a $e)uest
/rror.

!efault state:

Device #ehavior
when this re)uest
is receive! while
the !evice is in the
Default state is not
specifie!.

Address state:

-f an interface or
an en!point other
than en!point <ero
is specifie!( then
the !evice
respon!s with a
$e)uest /rror.

)onfigured
state:

-f an interface or
en!point that !oes
not eCist is
specifie!( then the
!evice respon!s
with a $e)uest
/rror.
!! USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status

>etStatusDE re)uest to a !evice returns the


information shown in Fi&ure 9+?.

Self ,owere!

%he Self ,owere! fiel! ma" not #e chan&e! #" the


SetFeatureDE or ClearFeatureDE re)uests.

$emote Fakeup

-t in!icates whether the !evice is currentl" ena#le! to re)uest remote


wakeup.

%he !efault mo!e is !isa#le!.

-t can #e mo!ifie! #" the SetFeatureDE an! ClearFeatureDE re)uests


usin& the D/2-C/9$/M=%/9F0/U, feature selector.

%his fiel! is reset to <ero when the !evice is reset.


$eserve! D$eset to KeroE
;@ ;? ;3 ;2 ;; ;0 9 H
A : @ ? 3 2 ; 0
$emote
Fakeup
$eserve! D$eset to KeroE Self
,owere!
6igure 9&2# !ATA returned by device
07 #us
power
;7 Self
,ower
07
!isa#le!
;7 ena#le
!" USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status
>etStatusDE re)uest to an interface
returns the information shown in Fi&ure
9+@.
$eserve! D$eset to KeroE
;@ ;? ;3 ;2 ;; ;0 9 H
A : @ ? 3 2 ; 0
$eserve! D$eset to KeroE
6igure 9&3# !ATA returned by Interface
!9 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status
>etStatusDE re)uest to a en!point returns the information
shown in Fi&ure 9+?.
%he *alt feature is re)uire! to #e implemente! for all interrupt an!
#ulk en!point t"pes.
Set *alt

%he *alt feature ma" optionall" #e set with the


SetFeatureD/.D,=-.%9*L%E re)uest.

Fhen set #" the SetFeatureDE re)uest( the en!point eChi#its the same
stall #ehavior as if the fiel! ha! #een set #" a har!ware con!ition.
$eserve! D$eset to KeroE
;@ ;? ;3 ;2 ;; ;0 9 H
A : @ ? 3 2 ; 0
$eserve! D$eset to KeroE *alt
6igure 9&5# !ATA returned by ,ndpoint 07 .ormal
;7 *alte!
"0 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status
Clear *alt
-f the con!ition causin& a halt has #een remove!( clearin& the
!alt feature "ia a ClearFeatureD/.D,=-.%9*L%E re)uest
results in the en!point no lon&er returnin& a S%LL.
For en!points usin& !ata to&&le( re&ar!less of whether an
en!point has the !alt feature set, a
ClearFeatureD/.D,=-.%9*L%E re)uest alwa"s results in the
!ata to&&le #ein& reinitiali<e! to D%0.
%he !alt feature is reset to zero after either a
SetConfiguration# or Set$nterface# re%uest e"en if the
re)ueste! confi&uration or interface is the same as the current
confi&uration or interface.
"1 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.3 /et Status
-t is neither re)uire! nor recommen!e! that
the !alt feature be implemented for the
&efault Control Pipe.
*owever( !evices ma" set the !alt feature of the
&efault Control Pipe in order to reflect a functional
error con!ition.
-f the feature is set to one( the !evice will return S%LL
in the Data an! Status sta&es of each stan!ar!
re)uest to the pipe eCcept >etStatusDE( SetFeatureDE(
an! ClearFeatureDE re)uests.
%he !evice nee! not return S%LL for class+specific
an! ven!or+specific re)uests.
"2 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.5 Set Address

%his re)uest sets the !evice a!!ress for all future !evice
accesses.

%he w2alue fiel! specifies the !evice a!!ress to use for all
su#se)uent accesses.
Data
.one
Direction
0
S/%
DD$/S
S
07 *+to+
D
07 Device
Device
!!ress
Kero
0
ero
!
@
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
"3 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.5 Set Address

s note! elsewhere( re)uests actuall" ma" result


in up to three sta&es.

-n the first sta&e( the Setup packet is sent to the !evice.

-n the optional secon! sta&e( !ata is transferre!


#etween the host an! the !evice.

-n the final sta&e( status is transferre! #etween the host


an! the !evice.
6igure 3&12. Transfers for
)ommunication 6lows
"4 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.5 Set Address

%he !irection of !ata an! status transfer !epen!s


on whether the host is sen!in& !ata to the !evice
or the !evice is sen!in& !ata to the host.

%he Status sta&e transfer is alwa"s in the


opposite !irection of the Data sta&e.

-f there is no Data sta&e( the Status sta&e is from


the !evice to the host.
"5 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.5 Set Address
*=S% *UB
D/2-C
/
S/%U,
Status
*=S% *UB
D/2-C
/
S/%U,
D%
S%%US
*=S% *UB
D/2-C
/
S/%U,
D%
Status
" USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.5 Set Address

Sta&es after the initial Setup packet assume the


same !evice a!!ress as the Setup packet.

%he USB !evice !oes not chan&e its !evice


a!!ress until after the Status sta&e of Set!!ress
is complete! successfull".

.ote that this is a !ifference #etween this re)uest an!


all other re)uests.

For all other re)uests( the operation in!icate! must #e


complete! #efore the Status sta&e.

)heck 9.-.5.1
"! USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.5 Set Address

!efault state:

-f the a!!ress specifie!


is non+<ero( then the
!evice shall enter the
!!ress stateL

otherwise( the !evice


remains in the Default
state Dthis is not an
error con!itionE

Address state:

-f the a!!ress specifie!


is <ero( then the !evice
shall enter the Default
stateL

otherwise( the !evice


remains in the !!ress
state #ut uses the
newl"+specifie!
a!!ress.

)onfigured state:

.ot Specifie!.
"" USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.* Set )onfiguration

%his re)uest sets the !evice confi&uration.

%he lower #"te of the w2alue fiel! specifies the !esire! confi&uration.

%his confi&uration value must #e <ero or match a confi&uration value


from a confi&uration !escriptor.
Data
.one
Direction
0
S/%
C=.F->U$%-
=.
07 *+to+
D
07 Device
Confi&uration
2alue
Kero
0
ero
!
9
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
$eserve
!
*- L=
bytes
Confi&
2al
"f the configuration
value is #ero$ the
device is placed in
its Address state.
"9 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.* Set )onfiguration

!efault state:

.ot specifie!.

Address state:

-f the specifie! confi&uration value


is <ero( then the !evice remains in
the !!ress state.

-f the specifie! confi&uration value


matches the confi&uration value
from a confi&uration !escriptor(
then that confi&uration is selecte!
an! the !evice enters the
Confi&ure! state.

=therwise( the !evice respon!s with


a $e)uest /rror.

)onfigured state:

-f the specifie!
confi&uration value is
<ero( then the !evice
enters the !!ress
state.

-f the specifie!
confi&uration value
matches the
confi&uration value
from a confi&uration
!escriptor( then that
confi&uration is
selecte! an! the !evice
remains in the
Confi&ure! state.

=therwise( the !evice


respon!s with a
$e)uest /rror.
90 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.= Set !escriptor

%his re)uest is optional an! ma" #e use! to


up!ate eCistin& !escriptors or new !escriptors
ma" #e a!!e!.
Data
Descriptor
Direction
0
S/%
D/SC$-,%
=$
07 *+to+
D
07 Device
Descriptor %"pe an!
Descriptor -n!eC
Lan&ua&e -D D9.:.AE
or Kero 0
Descriptor %ength
A
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
*i&h #"te7 Descriptor
%"pes
;7 D/2-C/
27 C=.F->U$%-=.
37 S%$-.>
?7 -.%/$FC/
@7 /.D,=-.%
:7 D/2-C/9MUL-F-/$
A7 =%*/$9S,//D9C=.F->
H7 -.%/$FC/9,=F/$
Low B"te7 Descriptor
-n!eC
91 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.= Set !escriptor

w2alue

%he !escriptor in!eC is use! to select a specific


!escriptor Donl" for confi&uration an! strin&
!escriptorsE when several !escriptors of the
same t"pe are implemente! in a !evice.

For eCample( a !evice can implement several


confi&uration !escriptors.

For other stan!ar! !escriptors that can #e set via a


SetDescriptorDE re)uest( a !escriptor in!eC of <ero must
#e use!.
92 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.= Set !escriptor
w-n!eC
%he w-n!eC fiel! specifies the
Lan&ua&e -D for strin&
!escriptors or is reset to <ero
for other !escriptors.
wLen&th
%he wLen&th fiel! specifies the
num#er of #"tes to transfer
from the host to the !evice.
-f this re)uest is not
supporte!( the !evice will
respon! with a $e)uest
/rror.
!efault state:
.ot specifie!
Address state:
2ali! if supporte!.
)onfigured state:
2ali! if supporte!.
93 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.9 Set 6eature
%his re)uest is use! to set or ena#le a
specific feature.
Data
.one
Direction S/%
F/%U$/
07 *+to+
D
07 /.D,=-.%9*L%
$ecipient7 /n!point
;7
D/2-C/9$/M=%/9F0/U
,
$ecipient7 Device
27 %/S%9M=D/
$ecipient7 Device
DIE7 -nterface
07 Device
;7
-nterface
27
/n!point
F/%U$/
Selector
%est
Selector
Kero
0
Must
#e
mappe
!
3
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
Kero -nterface
/n!point
0
94 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.9 Set 6eature

%he %/S%9M=D/ feature is onl" !efine! for a


!evice recipient Di.e.( #m$e)uest%"pe N 0E an!
the lower #"te of w-n!eC must #e <ero.
Data
.one
Direction
0
S/%
F/%U$/
07 *+to+
D
27 %/S%9M=D/
$ecipient7 Device
07 Device
F/%U$/
Selector
%est
Selector
Kero
0
3
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
Kero
0
95 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.9 Set 6eature
Settin& the %/S%9M=D/ feature puts the !evice
upstream facin& port into test mo!e.
%he !evice will respon! with a re)uest error if the re)uest
contains an invali! test selector.
%he transition to test mo!e must #e complete no later than 3
ms after the completion of the status sta&e of the re)uest.
*=S% *UB
D/2-C
/
*ost sen! SetFeatureD%/S% M=D/E
3 ms
Device transition to
%/S%9M=D/
,=$% transition to
%/S%9M=D/
%he host check status to the USB !evice DStatusE
<ero+len&th Status
packet
C0 Status
Sta&e
Fin
9 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.9 Set 6eature
%he power to the !evice must #e c"cle! to eCit
test mo!e of an upstream facin& port of a !evice.
See Section A.;.20 for !efinitions of each test
mo!e.
!evice must support the %/S%9M=D/ feature
when in the
Default state
!!ress state
or Confi&ure! hi&h+spee! !evice states.
9! USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.9 Set 6eature
SetFeatureDE re)uest
that references a feature
that cannot #e set or
that !oes not eCist
causes a S%LL to #e
returne! in the Status
sta&e of the re)uest.
!efault state:
!evice must #e a#le to accept a
SetFeatureD%/S%9M=D/(
%/S%9S/L/C%=$E re)uest when in the
Default State.
Device #ehavior for other SetFeature
re)uests while the !evice is in the
Default state is not specifie!.
Address state:
-f an interface or an en!point other
than en!point <ero is specifie!( then
the !evice respon!s with a $e)uest
/rror.
)onfigured state:
2ali!.
9" USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1> Set Interface
%his re)uest allows the host to select
an alternate settin& for the specifie!
interface.
Data
.one
Direction
;
S/%
-nterface
07 *+to+
D
;7
-nterface
lternate
Settin&
-nterface
n
Kero
0
;;
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
99 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1> Set Interface
Some USB !evices have confi&urations with
interfaces that have mutuall" eCclusive
settin&s.
%his re)uest allows the host to select the !esire!
alternate settin&.
-f a !evice onl" supports a !efault settin& for the
specifie! interface( then a S%LL ma" #e returne! in the
Status sta&e of the re)uest.
%his re)uest cannot #e use! to chan&e the set of
confi&ure! interfaces Dthe SetConfi&urationDE re)uest
must #e use! instea!E.
100 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.1> Set Interface
-f the interface or the
alternate settin& !oes
not eCist( then the
!evice respon!s with a
$e)uest /rror.
-f wLen&th is non+<ero(
then the #ehavior of the
!evice is not specifie!.
!efault state:
.ot specifie!.
Address state:
%he !evice must respon! with
a $e)uest /rror.
)onfigured state:
2ali!.
101 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.11 Synch 6rame
%his re)uest is use! to set an! then
report an en!pointBs s"nchroni<ation
frame.
Data
Frame .um#er
Direction
H2
S5.C*
F$M/
;7 D+to+
*
27
/n!point
ero
!
/n!point
G
%wo
2
;;
#m$e)u
est%"pe
#$e)ues
t
w2alue w-n!eC wLen&th
0 ; 2 3 ? @ : A
bytes
102 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.11 Synch 6rame
Fhen an en!point supports isochronous transfers( the
en!point ma" also re)uire per+frame transfers to var" in si<e
accor!in& to a specific pattern.
%he host an! the en!point must a&ree on which frame the repeatin&
pattern #e&ins.
%he num#er of the frame in which the pattern #e&an is returne! to the
host.
-f a hi&h+spee! !evice supports the S"nch Frame re)uest( it
must internall" s"nchroni<e itself to the <eroth microframe
an! have a time notion of classic frame.
=nl" the frame num#er is use! to s"nchroni<e an! reporte! #" the !evice
en!point Di.e.( no microframe num#erE.
%he en!point must s"nchroni<e to the <eroth microframe.
103 USB 2.0 Specification - Chapter 9 -
Device Framework
9.2.11 Synch 6rame
%his value is onl" use! for
isochronous !ata transfers
usin& implicit pattern
s"nchroni<ation.
-f w2alue is non+<ero or
wLen&th is not two( then the
#ehavior of the !evice is not
specifie!.
-f the specifie! en!point
!oes not support this
re)uest( then the !evice will
respon! with a $e)uest
/rror.
!efault state:
.ot specifie!.
Address state:
%he !evice shall respon! with
a $e)uest /rror.
)onfigured state:
2ali!.
104 USB 2.0 Specification - Chapter 9 -
Device Framework
9.3 !escriptors
USB !evices report their attri#utes usin&
!escriptors.
!escriptor is a !ata structure with a
!efine! format.
/ach !escriptor #e&ins with a #"te+wi!e
fiel! that contains the total num#er of
#"tes in the !escriptor followe! #" a #"te+
wi!e fiel! that i!entifies the !escriptor
t"pe.
#Len&th
.
0 ; O .+2 .+;
#Descripto
r
%"pe
O
bytes 105 USB 2.0 Specification - Chapter 9 -
Device Framework
9.3 !escriptors
Usin& !escriptors allows concise stora&e of
the attri#utes of in!ivi!ual confi&urations
#ecause each confi&uration ma" reuse
!escriptors or portions of !escriptors from
other confi&urations that have the same
characteristics.
-n this manner( the !escriptors resem#le
in!ivi!ual !ata recor!s in a relational
!ata#ase.
10 USB 2.0 Specification - Chapter 9 -
Device Framework
9.3 !escriptors

Strin& Descriptors

Fhere appropriate( !escriptors contain


references to strin& !escriptors that provi!e
!ispla"a#le information !escri#in& a
!escriptor in human+rea!a#le form.

%he inclusion of strin& !escriptors is optional.

*owever( the reference fiel!s within


!escriptors are man!ator".

-f a !evice !oes not support strin& !escriptors(


strin& reference fiel!s must #e reset to <ero to
in!icate no strin& !escriptor is availa#le.
10! USB 2.0 Specification - Chapter 9 -
Device Framework
9.3 !escriptors

$eturn len&th of !escriptor

%he len&th P specification

-f a !escriptor returns with a value in its len&th


fiel! that is less than !efine! #" this
specification( the !escriptor is invali! an!
shoul! #e re1ecte! #" the host.

%he len&th Q specification

-f the !escriptor returns with a value in its


len&th fiel! that is &reater than !efine! #" this
specification( the eCtra #"tes are i&nore! #"
the host(

#ut the neCt !escriptor is locate! usin& the


len&th returne! rather than the len&th
eCpecte!.
10" USB 2.0 Specification - Chapter 9 -
Device Framework
9.3 !escriptors

Class or 2en!or specific !escriptors

!evice ma" return class+ or ven!or+specific !escriptors in two


wa"s7

;. -f the" use the same format as stan!ar! !escriptors De.&.(


start with #Len&th R #Descriptor #"tesE

the" must #e returne! interleave! with stan!ar! !escriptors in the confi&uration


information returne! #" a >etDescriptorDConfi&urationE re)uest.

-n this case( the class or ven!or+specific !escriptors must follow a relate!


stan!ar! !escriptor the" mo!if" or eCten!.

2. -f the" use in!epen!ent of confi&uration information or use a


nonstan!ar! format

a >etDescriptorDE re)uest specif"in& the class or ven!or specific !escriptor t"pe


an! in!eC ma" #e use! to retrieve the !escriptor from the !evice.

class or ven!or specification will !efine the appropriate wa" to retrieve these
!escriptors.
109 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5 Standard US
!escriptor !efinitions
9.5.1 !evice !escriptor
9.5.- !evice?@ualifier !escriptor
9.5.1 )onfiguration !escriptor
9.5.2 .ther?Speed?)onfiguration !escriptor
9.5.3 Interface !escriptor
9.5.5 ,ndpoint !escriptor
9.5.5 String !escriptor
110 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5 Standard US
!escriptor !efinitions

%he stan!ar! !escriptors !efine! in


this specification ma" onl" #e
mo!ifie! or eCten!e! #" revision of
the Universal Serial Bus
Specification.

.ote7 n eCtension to the USB ;.0


stan!ar! en!point !escriptor has
#een pu#lishe! in Device Class
Specification for u!io Devices
$evision ;.0.

%his is the onl" eCtension !efine! outsi!e USB


Specification that is allowe!.

Future revisions of the USB Specification that


eCten! the stan!ar! en!point !escriptor will
!o so as to not conflict with the eCtension
!efine! in the u!io Device Class Specification
$evision ;.0.
111 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
!evice !escriptor !escri#es &eneral information a#out a
USB !evice.
-t inclu!es information that applies &lo#all" to the !evice
an! all of the !eviceBs confi&urations.
USB !evice has onl" one !evice !escriptor.
hi&h+spee! capa#le !evice that has !ifferent !evice
information for full+spee! an! hi&h+spee! must also have
a !evice9)ualifier !escriptor Dsee Section 9.:.2E.
112 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor


113 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
iManufac
turer
i,ro!uct i!,ro!uct #c!Device i!2en!or
H 9 ;0 ;; ;2 ;3 ;? ;@
bytes
#Len&th
0C;2
#Descripto
r
%"pe
#c!USB #Device
Class
#MaC
,acketSi<e
0
0 ; 2 3 ? @ : A
bytes
bDevice
Sub&lass
bDevice
'rotocol
.um#er
0C;2
Device
;
2ersion .um#er
02GG*
Class
co!e
Su#Class
Co!e
,rotocol Si<eFor/
,0
DH(;:(32(
:?E
iSerial
.um#er
#.um
Confi&s
;: ;A bytes
2en!or -D ,ro!uct -D Device release
.um#er
-n!eC of
strin&
Desc
-n!eC of
strin&
Desc
114 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
#s!USB
%he D/2-C/ !escriptor of a hi&h+spee! capa#le !evice
has a version num#er of 2.0 D0200*E.

-f the !evice is full+spee! onl" or low+spee! onl"( this version


num#er in!icates that it will respon! correctl" to a re)uest for the
!evice9)ualifier !esciptor Di.e.( it will respon! with a re)uest errorE.
%he #c!USB fiel! contains a BCD version num#er.

%he value of the #c!USB fiel! is 0CSSM. for version SS.M.. DSS T ma1or version
num#er( M T minor version num#er( . T su#+minor version num#erE( e.&.(
version 2.;.3 is represente! with value 0C02;3 an! version 2.0 is
represente! with a value of 0C0200.
115 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
#DeviceClass
Kero

-f this fiel! is reset to <ero( each interface within a confi&uration


specifies its own class information an! the various interfaces
operate in!epen!entl".
0C0; + 0CF/

%he !evice supports !ifferent class specifications on !ifferent


interfaces an! the interfaces ma" not operate in!epen!entl".

%his value i!entifies the class !efinition use! for the a&&re&ate
interfaces.
0CFF

2en!or+specific !evice class.


11 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
#DeviceSu#Class
%hese co!es are )ualifie! #" the value of the
#DeviceClass fiel!.
Kero

-f the #DeviceClass fiel! is reset to <ero( this fiel! must


also #e reset to <ero.
-f the #DeviceClass fiel! is not set to FF*( all values
are reserve! for assi&nment #" the USB+-F.
11! USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
#Device,rotocol
%hese co!es are )ualifie! #" the value of the #DeviceClass an! the
#DeviceSu#Class fiel!s.

-f a !evice supports class+specific protocols on a !evice #asis as oppose!


to an interface #asis( this co!e i!entifies the protocols that the !evice uses
as !efine! #" the specification of the !evice class.
Kero

%he !evice !oes not use class+specific protocols on a !evice #asis.

*owever( it ma" use class specific protocols on an interface #asis.


0CFF

%he !evice uses a ven!or+specific protocol on a !evice #asis.


11" USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
#MaC,acketSi<e0
-f the !evice is operatin& at hi&h+
spee!( the bMaxPacketSize' field must
be () indicating a () b*te maCimum
packet.
*i&h+spee! operation !oes not allow
other maCimum packet si<es for the
control en!point Den!point 0E.
119 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
#.umConfi&urations
%his fiel! in!icates the num#er of confi&urations
at the current operatin& spee!.
Confi&urations for the other operatin& spee! are
not inclu!e! in the count.

-f there are specific confi&urations of the !evice for specific


spee!s( the #.umConfi&urations fiel! onl" reflects the
num#er of confi&urations for a sin&le spee!( not the total
num#er of confi&urations for #oth spee!s.
120 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 !evice !escriptor
Default Control ,ipe of the Device
ll USB !evices have a Default Control ,ipe.

%he maCimum packet si<e of a !eviceBs Default Control ,ipe is !escri#e!


in the !evice !escriptor.
/n!points specific to a confi&uration an! its interfaceDsE are
!escri#e! in the confi&uration !escriptor.
confi&uration an! its interfaceDsE !o not inclu!e an
en!point !escriptor for the Default Control ,ipe.
=ther than the maCimum packet si<e( the characteristics of
the Default Control ,ipe are !efine! #" this specification an!
are the same for all USB !evices.
121 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.- !evice?@ualifier
!escriptor
%he !evice9)ualifier !escriptor !escri#es
information a#out a hi&h+spee! capa#le
!evice that woul! chan&e if the !evice were
operatin& at the other spee!.
For eCample( if the !evice is currentl"
operatin& at full+spee!( the !evice9)ualifier
returns information a#out how it woul!
operate at hi&h+spee! an! vice+versa.
122 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.- !evice?@ualifier
!escriptor
#Len&th
#Descripto
r
%"pe
#c!USB #Device
Class
#MaC
,acketSi<e
0
0 ; 2 3 ? @ : A
bytes
bDevice
Sub&lass
bDevice
'rotocol
.um#er
0C0
Mualifier
0C0:
2ersion .um#er
02GG*
Class
co!e
Su#Class
Co!e
,rotocol Si<eFor/
,0
DH(;:(32(
:?E
#.um
Confi&s
#$eserv
e!
H 9 bytes
.um#er Kero
0
123 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.- !evice?@ualifier
!escriptor
%he version num#er for this !escriptor
must #e at least 2.0 D0200*E.
%he host accesses this !escriptor usin&
the >etDescriptorDE re)uest.
124 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.- !evice?@ualifier
!escriptor
-f a full+spee! onl" !evice Dwith a !evice
!escriptor version num#er e)ual to
0200*E receives a >etDescriptorDE
re)uest for a !evice9)ualifier( it must
respon! with a re)uest error.
%he host must not make a re)uest for
an other9spee!9confi&uration !escriptor
unless it first successfull" retrieves the
!evice9)ualifier !escriptor.
125 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
%he confi&uration !escriptor !escri#es
information a#out a specific !evice
confi&uration.
%he !escriptor contains a
#Confi&uration2alue fiel! with a value
that( when use! as a parameter to the
SetConfi&urationDE re)uest( causes the
!evice to assume the !escri#e!
confi&uration.
12 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor


12! USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
.um#er
0C09
Confi&urati
on
0C02
.um#er .um#er .um#er -n!eC ttri#ute
s
bytes
#Len&th
#Descripto
r
%"pe
w%otalLen&th #.um#e
r
-nterface
s
#Confi&
2alue
iConfi& #mttri#
0 ; 2 3 ? @ : A
DA7
$eserve
! DSet to
;E
D:7
Self+
powere!
D@7
$emote
Fakeup
D?+07
$eserve
!
Dreset to
0E
,ower
#MaC
,ower
DmE
H
12" USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
-nterface
%he !escriptor !escri#es the num#er of interfaces provi!e!
#" the confi&uration.

/ach interface ma" operate in!epen!entl".

For eCample(

;st Confi&uration( an -SD. !evice mi&ht #e confi&ure! with two


interfaces( each provi!in& :? 0#8s #i+!irectional channels that have
separate !ata sources or sinks on the host.

2n! Confi&uration mi&ht present the -SD. !evice as a sin&le


interface( #on!in& the two channels into one ;2H 0#8s #i+!irectional
channel.
Fhen the host re)uests the confi&uration !escriptor( all
relate! interface an! en!point !escriptors are returne! Drefer
to Section 9.?.3E.
129 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
/n!point
USB !evice has one or more confi&uration
!escriptors.

/ach confi&uration has one or more interfaces an! each


interface has <ero or more en!points.

n en!point is not share! amon& interfaces within a


sin&le confi&uration unless the en!point is use! #"
alternate settin&s of the same interface.

/n!points ma" #e share! amon& interfaces that are part


of !ifferent confi&urations without this restriction.
130 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
=nce confi&ure!( !evices ma" support
limite! a!1ustments to the
confi&uration.
-f a particular interface has alternate
settin&s( an alternate ma" #e selecte!
after confi&uration.
131 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
#mttri#utes
DA

is reserve! an! must #e set to one for historical reasons.


D: Self+,owere!

!evice confi&uration that uses power from the #us an! a local
source reports a non+<ero value in #MaC,ower to in!icate the
amount of #us power re)uire! an! sets D:.

%he actual power source at runtime ma" #e !etermine! usin& the


>etStatusDD/2-C/E re)uest Dsee Section 9.?.@E.
D@ $emote Fakeup

-f a !evice confi&uration supports remote wakeup( D@ is set to


one.
132 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
#MaC,ower
MaCimum power consumption of the USB !evice from
the #us in this specific confi&uration when the !evice is
full" operational.

/Cpresse! in 2 m units Di.e.( @0 N ;00 mE.


,ower !raw

-f a !evice is !isconnecte! from its eCternal power source( it up!ates


!evice status to in!icate that it is no lon&er self+powere!.

-f a !evice is !isconnecte! from its eCternal power source( it up!ates


!evice status to in!icate that it is no lon&er self+powere!.
133 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.1 )onfiguration
!escriptor
#MaC,ower
,ower !raw

-f a !evice can continue to operate when


!isconnecte! from its eCternal power source( it
continues to !o so.

-f the !evice cannot continue to operate( it fails


operations it can no lon&er support.

%he USB S"stem Software ma" !etermine the


cause of the failure #" checkin& the status an!
notin& the loss of the !eviceBs power source.
134 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.2
.ther?Speed?)onfigurati
on !escriptor
%he other9spee!9confi&uration !escriptor
shown in %a#le 9+;; !escri#es a confi&uration
of a hi&hspee! capa#le !evice if it were
operatin& at its other possi#le spee!.
%he structure of the
other9spee!9confi&uration is i!entical to a
confi&uration !escriptor.
%he host accesses this !escriptor usin& the
>etDescriptorDE re)uest.
135 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.2
.ther?Speed?)onfigurati
on !escriptor


13 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.2
.ther?Speed?)onfigurati
on !escriptor
.um#er
0C09
=ther9Spee
!
0C0A
.um#er .um#er .um#er -n!eC ttri#ute
s
bytes
#Len&th
#Descripto
r
%"pe
w%otalLen&th #.um#e
r
-nterface
s
#Confi&
2alue
iConfi& #mttri#
0 ; 2 3 ? @ : A
DA7
$eserve
! DSet to
;E
D:7
Self+
powere!
D@7
$emote
Fakeup
D?+07
$eserve
!
Dreset to
0E
,ower
#MaC
,ower
DmE
H
13! USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
%he interface !escriptor !escri#es a specific interface
within a confi&uration.
confi&uration provi!es one or more interfaces( each with <ero or
more en!point !escriptors !escri#in& a uni)ue set of en!points
within the confi&uration.
Fhen a confi&uration supports more than one interface( the
en!point !escriptors for a particular interface follow the interface
!escriptor in the !ata returne! #" the >etConfi&urationDE re)uest.
n interface !escriptor is alwa"s returne! as part of a confi&uration
!escriptor.
-nterface !escriptors cannot #e !irectl" accesse! with a
>etDescriptorDE or SetDescriptorDE re)uest.
13" USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
USB in a .utShell( http788www.#e"on!lo&ic.or&8us#nutshell8us#@.shtml
139 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
n interface !escriptor is alwa"s
returne! as part of a confi&uration
!escriptor.
-nterface !escriptors cannot #e !irectl"
accesse! with a >etDescriptorDE or
SetDescriptorDE re)uest.
140 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor


141 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
-n!eC
i-nterfac
e
H
bytes
0 ; 2 3 ? @ : A
#Len&th
#Descripto
r
%"pe
#-nterfac
e
.um#er
#.um
/n!point
s
#-nterfac
e
Class
#-nterfac
e
Su#Class
#-nterfac
e
,rotocol
#lternat
e
Settin&
.um#er
0C09
-nterface
0C0?
.um#er .um#er Class Su#Class ,rotocol .um#er
142 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
lternate Settin&s
n interface ma" inclu!e alternate settin&s that
allow the en!points an!8or their characteristics to #e
varie! after the !evice has #een confi&ure!.
%he !efault settin& for an interface is alwa"s
alternate settin& <ero.
%he Set-nterfaceDE re)uest is use! to select an
alternate settin& or to return to the !efault settin&.
%he >et-nterfaceDE re)uest returns the selecte!
alternate settin&.
143 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
lternate Settin&s
lternate settin&s allow a portion of the !evice
confi&uration to #e varie! while other
interfaces remain in operation.
-f a confi&uration has alternate settin&s for
one or more of its interfaces( a separate
interface !escriptor an! its associate!
en!points are inclu!e! for each settin&.
144 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
lternate Settin&s
-f a !evice confi&uration supporte! a sin&le interface
with two alternate settin&s( the confi&uration !escriptor
woul! #e followe! #"

%he first interface !escriptor with the b$nterface+umber and


b,lternateSetting fiel!s set to <ero an! then the en!point
!escriptors for that settin&(

followe! #" another interface !escriptor an! its associate! en!point


!escriptors.

%he secon! interface !escriptorBs b$nterface+umber field


would also #e set to <ero( #ut the b,lternateSetting field of
the second interface descriptor would be set to one.
145 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
/n!point
-f an interface uses onl" en!point <ero(
no en!point !escriptors follow the
interface !escriptor.

-n this case( the b+um-ndpoints field must be set


to zero.
n interface !escriptor never inclu!es
en!point <ero in the num#er of
en!points.
14 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
#-nterfaceClass
value of <ero is reserve! for future stan!ar!i<ation.
-f this fiel! is set to FF*( the interface class is ven!or+specific.
#-nterfaceSu#Class
%hese co!es are )ualifie! #" the value of the #-nterfaceClass
fiel!.
-f the #-nterfaceClass fiel! is reset to <ero( this fiel! must also
#e reset to <ero.
-f the #-nterfaceClass fiel! is not set to FF*( all values are
reserve! for assi&nment #" the USB+-F.
14! USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.3 Interface
!escriptor
#-nterface,rotocol
%hese co!es are )ualifie! #" the value of the #-nterfaceClass an! the
#-nterfaceSu#Class fiel!s.
-f an interface supports class+specific re)uests( this co!e i!entifies the
protocols that the !evice uses as !efine! #" the specification of the
!evice class.
Kero

the !evice !oes not use a class+specific protocol on this interface.


0CFF

the !evice uses a ven!or+specific protocol for this interface.


i-nterface
-n!eC of strin& !escriptor !escri#in& this interface.
14" USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
/ach en!point use! for an interface has its own
!escriptor.
%his !escriptor contains the information re)uire! #" the host
to !etermine the #an!wi!th re)uirements of each en!point.
n en!point !escriptor is alwa"s returne! as part of the
confi&uration information returne! #" a
>etDescriptorDConfi&urationE re)uest.
n en!point !escriptor cannot #e !irectl" accesse! with a
>etDescriptorDE or SetDescriptorDE re)uest.
%here is never an en!point !escriptor for en!point <ero.
149 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor


150 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
bytes
0 ; 2 3 ? @ :
#Len&th
#Descripto
r
%"pe
#/n!poi
nt!!res
s
wMaC,acketSi<e #-nterval
#mttri#ut
es
.um#er
0C09
/n!point
0C0@
/n!point .um#er .um#er .um#er
/n!point .um#er Directio
n
$eserve! D$eset to KeroE
A : @ ? 3 2 ; 0
07 =U%
;7 -.
(eserved )(eset to ero*
%ransfer %"pe Usa&e %"pe
A : @ ? 3 2 ; 0
S"nchroni<ation
%"pe
007 Control
0;7 -sochronous
;07 Bulk
;;7 -nterrupt
007 .o
S"nchroni<ation
0;7 s"nchronous
;07 !aptive
;;7 S"nchronous
007 Data en!point
0;7 Fee!#ack
en!point
;07 -mplicit
Fee!#ack
;;7 $eserve!
.ot <ero onl" for isochronous transfers
151 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
bytes
0 ; 2 3 ? @ :
#Len&th
#Descripto
r
%"pe
#/n!poi
nt!!res
s
wMaC,acketSi<e #-nterval
#mttri#ut
es
.um#er
0C09
/n!point
0C0@
/n!point .um#er .um#er .um#er
A : @ ? 3 2 ; 0
+a,imum 'ac-et Si#e )in bytes*
w4AA"acketSi<e
$eserve! D$eset to KeroE
;@ ;? ;3 ;2 ;; ;0 9 H
!!itional
%ransaction
MaCimum ,acket Si<e Din
#"tesE
007 .one
D;
%ransaction8microfra
meE
0;7 ; a!!itional
D2 per microframE
027 2 a!!itional
D3 per microframE
;;7 $eserve!
For hi&h+
spee!
isochronous
an! interrupt
en!points
152 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
bytes
0 ; 2 3 ? @ :
#Len&th
#Descripto
r
%"pe
#/n!poi
nt!!res
s
wMaC,acketSi<e #-nterval
#mttri#ut
es
.um#er
0C09
/n!point
0C0@
/n!point .um#er .um#er .um#er
For full+8hi&h+spee!
isochronous
en!points(
this value must #e in
the ran&e from ; to
;:.
%he #-nterval value is
use! as the eCponent
for a 2#-nterval+;
valueL e.&.(
a #-nterval of ?
means a perio! of H
D2?+;E.
For full+8low+spee!
interrupt en!points(
the value of this fiel!
ma" #e from ; to
2@@.
For hi&h+spee!
interrupt en!points(
the #-nterval value is
use! as the eCponent
for a 2#-nterval+;
valueL e.&.(
a #-nterval of ?
means a perio! of H
D2?+;E.
%his value must #e
from ; to ;:.
For hi&h+spee!
#ulk8control =U%
en!points(
the #-nterval must
specif" the maCimum
.0 rate of the
en!point.
value of 0 in!icates
the en!point never
.0s.
=ther values in!icate
at most ; .0 each
#-nterval num#er of
microframes.
%his value must #e
in the ran&e from 0 to
2@@.
153 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
#mttri#ute
-sochronous

DB@..2E are onl" meanin&ful for isochronous


en!points an! must #e reset to <ero for all other
transfer t"pes.

-f the en!point is use! as an eCplicit fee!#ack


en!point D#its @..?N0;BE(

then the %ransfer %"pe must #e set to isochronous D#its;..0 N


0;BE

an! the S"nchroni<ation %"pe must #e set to .o


S"nchroni<ation D#its 3..2N00BE.
154 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
#mttri#ute
%his fiel! !escri#es the en!pointBs
attri#utes when it is confi&ure! usin& the
#Confi&uration2alue.

%ransfer %"pe DB;..0E

S"nchroni<ation %"pe DB3..2E

Usa&e %"pe DB@..?E


-f not an isochronous en!point( DB@..2E are
reserve! an! must #e set to <ero.
155 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
#mttri#ute
Fee!#ack

fee!#ack en!point DeCplicit or implicitE nee!s to #e associate! with one


Dor moreE isochronous !ata en!points to which it provi!es fee!#ack
service.
%he association is #ase! on en!point num#er matchin&.

fee!#ack en!point alwa"s has the opposite !irection from the !ata
en!pointDsE it services.
-f multiple !ata en!points are to #e service! #" the same fee!#ack en!point( the !ata
en!points must have ascen!in& or!ere!T#ut not necessaril" consecutiveTen!point
num#ers.

%he first !ata en!point an! the fee!#ack en!point must have the same en!point
num#er Dan! opposite !irectionE.

%his ensures that a !ata en!point can uni)uel" i!entif" its fee!#ack en!point #"
searchin& for the first fee!#ack en!point that has an en!point num#er e)ual or less
than its own en!point num#er.
15 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
#mttri#ute
Fee!#ack

/Cample7

Consi!er the eCtreme case where there is a nee! for five &roups
of =U% as"nchronous isochronous en!points an! at the same time
four &roups of -. a!aptive isochronous en!points.

/ach &roup nee!s a separate fee!#ack en!point an! the &roups


are compose! as shown in Fi&ure 9+A.
15! USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
#mttri#ute
Fee!#ack
15" USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
wMaC,acketSi<e
MaCimum packet si<e this en!point is
capa#le of sen!in& or receivin& when this
confi&uration is selecte!.

For isochronous en!points( this value is use! to


reserve the #us time in the sche!ule( re)uire! for
the per+DmicroEframe !ata pa"loa!s.

%he pipe ma"( on an on&oin& #asis( actuall" use less


#an!wi!th than that reserve!.

%he !evice reports( if necessar"( the actual #an!wi!th use!


via its normal( non+USB !efine! mechanisms.
159 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
wMaC,acketSi<e
*i&h+spee! isochronous an! interrupt en!points use
BD;2..;;E of wMaC,acketSi<e to specif" multiple
transactions for each microframe specifie! #"
#-nterval.

-f #its ;2..;; of wMaC,acketSi<e are <ero( the maCimum


packet si<e for the en!point can #e an" allowe! value
Das !efine! in Chapter @E.

-f #its ;2..;; of wMaC,acketSi<e are not <ero D0E( the


allowe! values for wMaC,acketSi<e #its ;0..0 are
limite! as shown in %a#le 9+;?.
Table 9-14. Allowed wMaxPacketSize Values
for Different u!bers of Transactions "er
Microfra!e 10 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.5 ,ndpoint
!escriptor
#-nterval
-nterval for pollin& en!point for !ata transfers.

/Cpresse! in frames or microframes !epen!in& on the


!evice operatin& spee! Di.e.( either ; millisecon! or ;2@
Js unitsE.

For hi&h+spee! #ulk an! control =U% en!points(

the #-nterval fiel! is onl" use! for compliance purposesL

the host controller is not re)uire! to chan&e its #ehavior #ase!


on the value in this fiel!.
11 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.* String !escriptor
Strin& !escriptors are optional.
-f a !evice !oes not support strin&
!escriptors( all references to strin&
!escriptors within !evice(
confi&uration( an! interface
!escriptors must #e reset to <ero.
12 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.* String !escriptor
Strin& !escriptors use
U.-C=D/ enco!in&s as
!efine! #" %he Unico!e
Stan!ar!( 23.0
%he strin&s in a USB !evice
ma" support multiple
lan&ua&es.
Fhen re)uestin& a strin&
!escriptor( the re)uester
specifies the !esire! lan&ua&e
usin& a ;: #its lan&ua&e -D
DL.>-DE !efine! #" the USB+
-F.


13 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.* String !escriptor
Strin& in!eC <ero for all lan&ua&es returns a strin& !escriptor
that contains an arra" of two+#"te L.>-D co!es supporte! #"
the !evice.
USB !evice ma" omit all strin& !escriptors.
USB !evices that omit all strin& !escriptors must not return an arra" of
L.>-D co!es.
%he arra" of L.>-D co!es is not .ULL+terminate!.
%he si<e of the arra" Din #"tesE is compute! #" su#tractin& two from the
value of the first #"te of the !escriptor.
%he U.-C=D/ strin& !escriptor Dshown in %a#le 9+;:E is not
.ULL+terminate!.
%he strin& len&th is compute! #" su#tractin& two from the value of the first
#"te of the !escriptor.
14 USB 2.0 Specification - Chapter 9 -
Device Framework
9.5.* String !escriptor
bytes
0 ; 2 3 ? @ : A
#Len&th
#Descripto
r
%"pe
wL.>-DU0V wL.>-DUOV wL.>-DUG+;V
.um#er
.R2
D2GR2E
-nterface
0C03
.um#er .um#er .um#er
bytes
0 ; 2 3 ? @ : A
#Len&th
#Descripto
r
%"pe
wL.>-DU0V
.um#er
.R2
-nterface
0C03
.um#er
.
Table 9-1#. Strin$ Descri"tor %ero& S"ecif'in$ (an$ua$es Su""orted b' t)e
De*ice
Table 9-1+. ,-./D0 Strin$ Descri"tor
15 USB 2.0 Specification - Chapter 9 -
Device Framework
9.* !evice )lass
!efinitions

ll !evices must support the


re)uests an! !escriptor !efinitions
!escri#e! in this chapter DChapter
9E.

Most !evices provi!e a!!itional


re)uests an!( possi#l"( !escriptors
for !evice+specific eCtensions.

-n a!!ition( !evices ma" provi!e eCten!e!


services that are common to a &roup of
!evices.

-n or!er to !efine a class of !evices( the


followin& information must #e provi!e! to
completel" !efine the appearance an!
#ehavior of the !evice class.

9.*.1 !escriptors

9.*.- Interface%s( and ,ndpoint Usage

9.*.1 0e+uests
1 USB 2.0 Specification - Chapter 9 -
Device Framework
9.*.1 !escriptors

-f the class re)uires an" specific


!efinition of the stan!ar!
!escriptors( the class !efinition must
inclu!e those re)uirements as part
of the class !efinition.

-n a!!ition( if the class !efines a stan!ar!


eCten!e! set of !escriptors( the" must also #e
full" !efine! in the class !efinition.

n" eCten!e! !escriptor !efinitions must


follow the approach use! for stan!ar!
!escriptorsL for eCample( all !escriptors must
#e&in with a len&th fiel!. 1! USB 2.0 Specification - Chapter 9 -
Device Framework
9.*.- Interface%s( and
,ndpoint Usage
Fhen a class of !evices is stan!ar!i<e!(
the interfaces use! #" the !evices(
inclu!in& how en!points are use!( must
#e inclu!e! in the !evice class
!efinition.
Devices ma" further eCten! a class
!efinition with proprietar" features as
lon& as the" meet the #ase !efinition of
the class.
1" USB 2.0 Specification - Chapter 9 -
Device Framework
9.*.1 0e+uests
ll of the re)uests specific to the class
must #e !efine!.
19 USB 2.0 Specification - Chapter 9 -
Device Framework

You might also like