This is the version 5e2e040afbc0c3316430523d from 2020-01-26 21:26:34 comment: 'stuff...'
USB ed
Table of Contents
Theory ed
Definitions ed
- Device
- The physical thing (mostly).
- Identified by a vendor-id and a product-id, each 2 bytes, e.g. 0x256c / 0x006e.
- Can also be identified by its physical connection path, e.g. 1/7/2 for bus#1, port#7, sub-port#2.
- Function
- A logical device.
- A webcam might contain a camera and a microphone. Both will be presented as separate devices (functions).
- Let's just keep calling them devices...
- Endpoint
- A communication point.
- Identified by an address number 0x00-0x0f for output (device -> host) and 0x80-0x8f for input (host -> device).
- Communication type an be either control, isochronous, interrupt or bulk.
- Interface
- A collection of endpoints in one device. Each device can have several interfaces.
- Configuration
- A device can only be in one configuration state at a time.
- Identified by a 1-byte value.
- Defines power consumption etc. And also interfaces.
- Alternate setting
- Each interface (within a configuration) can be in one of several alternate settings, each defining a set of endpoints.
Graph ed
[device]
vendor-id: ...
product-id: ...
class: ...
sub-class: ...
[configuration]
value: 1
power: ...
[interface]
number: 0
[alt setting]
number: 0
[endpoint]
address: 0x81
attributes: control/iso/bulk/interrupt
[endpoint]
address: 0x82
[alt setting]
number: 1
...
[interface]
number: 1
...
[configuration]
value: 2
...Communication ed
All communication is initiated by the host!
Control transfer ed
This is usually sent to the "default" endpoint 0.
The host sends an 8-byte packet:
1b type 1b request 2b value 2b index 2b length
For example, "SET-CONFIGURATION" is
0x00 0x09 #CONFIG 0 0
0x01 0x11 #ALT #INTERFACE 0
0x80 0x06 (0x00 0x01) 0 18
0x80 0x06 (#CONFIG 0x02) 0 59..
Categories: Computer, Programmieren