Rename the rest of the constants.
This commit is contained in:
@@ -30,22 +30,22 @@ type EndpointInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e EndpointInfo) Number() int {
|
func (e EndpointInfo) Number() int {
|
||||||
return int(e.Address) & EndpointNumMask
|
return int(e.Address & EndpointNumMask)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e EndpointInfo) TransferType() TransferType {
|
func (e EndpointInfo) TransferType() TransferType {
|
||||||
return TransferType(e.Attributes) & TransferTypeMask
|
return TransferType(e.Attributes & TransferTypeMask)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e EndpointInfo) Direction() EndpointDirection {
|
func (e EndpointInfo) Direction() EndpointDirection {
|
||||||
return EndpointDirection(e.Address) & EndpointDirectionMask
|
return EndpointDirection(e.Address & EndpointDirectionMask)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e EndpointInfo) String() string {
|
func (e EndpointInfo) String() string {
|
||||||
return fmt.Sprintf("Endpoint #%d %-3s %s - %s %s [%d %d]",
|
return fmt.Sprintf("Endpoint #%d %-3s %s - %s %s [%d %d]",
|
||||||
e.Number(), e.Direction(), e.TransferType(),
|
e.Number(), e.Direction(), e.TransferType(),
|
||||||
IsoSyncType(e.Attributes)&ISO_SYNC_TYPE_MASK,
|
IsoSyncType(e.Attributes)&IsoSyncTypeMask,
|
||||||
IsoUsageType(e.Attributes)&ISO_USAGE_TYPE_MASK,
|
IsoUsageType(e.Attributes)&IsoUsageTypeMask,
|
||||||
e.MaxPacketSize, e.MaxIsoPacket,
|
e.MaxPacketSize, e.MaxIsoPacket,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -126,18 +126,18 @@ func (tt TransferType) String() string {
|
|||||||
type IsoSyncType uint8
|
type IsoSyncType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ISO_SYNC_TYPE_NONE IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_NONE << 2
|
IsoSyncTypeNone IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_NONE << 2
|
||||||
ISO_SYNC_TYPE_ASYNC IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_ASYNC << 2
|
IsoSyncTypeAsync IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_ASYNC << 2
|
||||||
ISO_SYNC_TYPE_ADAPTIVE IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_ADAPTIVE << 2
|
IsoSyncTypeAdaptive IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_ADAPTIVE << 2
|
||||||
ISO_SYNC_TYPE_SYNC IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_SYNC << 2
|
IsoSyncTypeSync IsoSyncType = C.LIBUSB_ISO_SYNC_TYPE_SYNC << 2
|
||||||
ISO_SYNC_TYPE_MASK IsoSyncType = 0x0C
|
IsoSyncTypeMask = 0x0C
|
||||||
)
|
)
|
||||||
|
|
||||||
var isoSyncTypeDescription = map[IsoSyncType]string{
|
var isoSyncTypeDescription = map[IsoSyncType]string{
|
||||||
ISO_SYNC_TYPE_NONE: "unsynchronized",
|
IsoSyncTypeNone: "unsynchronized",
|
||||||
ISO_SYNC_TYPE_ASYNC: "asynchronous",
|
IsoSyncTypeAsync: "asynchronous",
|
||||||
ISO_SYNC_TYPE_ADAPTIVE: "adaptive",
|
IsoSyncTypeAdaptive: "adaptive",
|
||||||
ISO_SYNC_TYPE_SYNC: "synchronous",
|
IsoSyncTypeSync: "synchronous",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ist IsoSyncType) String() string {
|
func (ist IsoSyncType) String() string {
|
||||||
@@ -147,16 +147,16 @@ func (ist IsoSyncType) String() string {
|
|||||||
type IsoUsageType uint8
|
type IsoUsageType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ISO_USAGE_TYPE_DATA IsoUsageType = C.LIBUSB_ISO_USAGE_TYPE_DATA << 4
|
IsoUsageTypeData IsoUsageType = C.LIBUSB_ISO_USAGE_TYPE_DATA << 4
|
||||||
ISO_USAGE_TYPE_FEEDBACK IsoUsageType = C.LIBUSB_ISO_USAGE_TYPE_FEEDBACK << 4
|
IsoUsageTypeFeedback IsoUsageType = C.LIBUSB_ISO_USAGE_TYPE_FEEDBACK << 4
|
||||||
ISO_USAGE_TYPE_IMPLICIT IsoUsageType = C.LIBUSB_ISO_USAGE_TYPE_IMPLICIT << 4
|
IsoUsageTypeImplicit IsoUsageType = C.LIBUSB_ISO_USAGE_TYPE_IMPLICIT << 4
|
||||||
ISO_USAGE_TYPE_MASK IsoUsageType = 0x30
|
IsoUsageTypeMask = 0x30
|
||||||
)
|
)
|
||||||
|
|
||||||
var isoUsageTypeDescription = map[IsoUsageType]string{
|
var isoUsageTypeDescription = map[IsoUsageType]string{
|
||||||
ISO_USAGE_TYPE_DATA: "data",
|
IsoUsageTypeData: "data",
|
||||||
ISO_USAGE_TYPE_FEEDBACK: "feedback",
|
IsoUsageTypeFeedback: "feedback",
|
||||||
ISO_USAGE_TYPE_IMPLICIT: "implicit data",
|
IsoUsageTypeImplicit: "implicit data",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (iut IsoUsageType) String() string {
|
func (iut IsoUsageType) String() string {
|
||||||
@@ -166,17 +166,17 @@ func (iut IsoUsageType) String() string {
|
|||||||
type RequestType uint8
|
type RequestType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
REQUEST_TYPE_STANDARD = C.LIBUSB_REQUEST_TYPE_STANDARD
|
RequestTypeStandard = C.LIBUSB_REQUEST_TYPE_STANDARD
|
||||||
REQUEST_TYPE_CLASS = C.LIBUSB_REQUEST_TYPE_CLASS
|
RequestTypeClass = C.LIBUSB_REQUEST_TYPE_CLASS
|
||||||
REQUEST_TYPE_VENDOR = C.LIBUSB_REQUEST_TYPE_VENDOR
|
RequestTypeVendor = C.LIBUSB_REQUEST_TYPE_VENDOR
|
||||||
REQUEST_TYPE_RESERVED = C.LIBUSB_REQUEST_TYPE_RESERVED
|
RequestTypeReserved = C.LIBUSB_REQUEST_TYPE_RESERVED
|
||||||
)
|
)
|
||||||
|
|
||||||
var requestTypeDescription = map[RequestType]string{
|
var requestTypeDescription = map[RequestType]string{
|
||||||
REQUEST_TYPE_STANDARD: "standard",
|
RequestTypeStandard: "standard",
|
||||||
REQUEST_TYPE_CLASS: "class",
|
RequestTypeClass: "class",
|
||||||
REQUEST_TYPE_VENDOR: "vendor",
|
RequestTypeVendor: "vendor",
|
||||||
REQUEST_TYPE_RESERVED: "reserved",
|
RequestTypeReserved: "reserved",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rt RequestType) String() string {
|
func (rt RequestType) String() string {
|
||||||
|
Reference in New Issue
Block a user