Add constants for device speed.

This commit is contained in:
Sebastian Zagrodzki
2017-03-27 23:01:02 +02:00
parent f3b2f37e3a
commit d982ef5a37

View File

@@ -182,3 +182,25 @@ var requestTypeDescription = map[RequestType]string{
func (rt RequestType) String() string {
return requestTypeDescription[rt]
}
type DeviceSpeed int
const (
DeviceSpeedUnknown DeviceSpeed = C.LIBUSB_SPEED_UNKNOWN
DeviceSpeedLow DeviceSpeed = C.LIBUSB_SPEED_LOW
DeviceSpeedFull DeviceSpeed = C.LIBUSB_SPEED_FULL
DeviceSpeedHigh DeviceSpeed = C.LIBUSB_SPEED_HIGH
DeviceSpeedSuper DeviceSpeed = C.LIBUSB_SPEED_SUPER
)
var deviceSpeedDescription = map[DeviceSpeed]string{
DeviceSpeedUnknown: "unknown",
DeviceSpeedLow: "low",
DeviceSpeedFull: "full",
DeviceSpeedHigh: "high",
DeviceSpeedSuper: "super",
}
func (s DeviceSpeed) String() string {
return deviceSpeedDescription[s]
}