Replace EndpointDirection with a bool

This commit is contained in:
Sebastian Zagrodzki
2017-04-09 18:51:51 +02:00
parent 168b501d53
commit 3d62929e05
3 changed files with 23 additions and 8 deletions

View File

@@ -46,8 +46,12 @@ type EndpointInfo struct {
// String returns the human-readable description of the endpoint.
func (e EndpointInfo) String() string {
addr := e.Number
if e.Direction == EndpointDirectionIn {
addr |= 0x80
}
ret := make([]string, 0, 3)
ret = append(ret, fmt.Sprintf("Endpoint #%d %s (address 0x%02x) %s", e.Number, e.Direction, uint8(e.Number)|uint8(e.Direction), e.TransferType))
ret = append(ret, fmt.Sprintf("Endpoint #%d %s (address 0x%02x) %s", e.Number, e.Direction, addr, e.TransferType))
switch e.TransferType {
case TransferTypeIsochronous:
ret = append(ret, fmt.Sprintf("- %s %s", e.IsoSyncType, e.UsageType))