Allow the same endpoint number to be reused for IN and OUT endpoints

separately, effectively allowing two endpoints with the same number
- numbers are no unique, only endpoint addresses are.
This commit is contained in:
Sebastian Zagrodzki
2017-06-13 23:04:34 +02:00
parent 883910dd57
commit 2b78100ce3
7 changed files with 141 additions and 45 deletions

10
usb.go
View File

@@ -64,8 +64,12 @@ Config.Interface(num, altNum). The Interface struct is the representation
of the claimed interface with a particular alternate setting.
The descriptor of the interface is available through Interface.Setting.
An interface with a particular alternate setting defines up to 15
endpoints. An endpoint can be considered similar to a UDP/IP port,
An interface with a particular alternate setting defines up to 30 data
endpoints, each identified by a unique address. The endpoint address is a combination
of endpoint number (1..15) and endpoint directionality (IN/OUT).
IN endpoints have addresses 0x81..0x8f, while OUT endpoints 0x01..0x0f.
An endpoint can be considered similar to a UDP/IP port,
except the data transfers are unidirectional.
Endpoints are represented by the Endpoint struct, and all defined endpoints
@@ -74,6 +78,8 @@ can be obtained through the Endpoints field of the Interface.Setting.
Each endpoint descriptor (EndpointDesc) defined in the interface's endpoint
map includes information about the type of the endpoint:
- endpoint address
- endpoint number
- direction: IN (device-to-host) or OUT (host-to-device)