Move Control from Config to Device.

Rename Default to DefaultInterface.
This commit is contained in:
Sebastian Zagrodzki
2017-05-06 02:16:22 +02:00
parent 1c9a11b1ce
commit eb5500f387
2 changed files with 14 additions and 13 deletions

View File

@@ -18,7 +18,6 @@ package gousb
import (
"fmt"
"sync"
"time"
)
// ConfigInfo contains the information about a USB device configuration.
@@ -45,8 +44,7 @@ func (c ConfigInfo) String() string {
// Config represents a USB device set to use a particular configuration.
// Only one Config of a particular device can be used at any one time.
type Config struct {
Info ConfigInfo
ControlTimeout time.Duration
Info ConfigInfo
dev *Device
@@ -81,14 +79,6 @@ func (c *Config) String() string {
return fmt.Sprintf("%s,config=%d", c.dev.String(), c.Info.Config)
}
// Control sends a control request to the device.
func (c *Config) Control(rType, request uint8, val, idx uint16, data []byte) (int, error) {
if c.dev == nil {
return 0, fmt.Errorf("Control() called on %s after Close", c)
}
return libusb.control(c.dev.handle, c.ControlTimeout, rType, request, val, idx, data)
}
// Interface claims and returns an interface on a USB device.
func (c *Config) Interface(intf, alt int) (*Interface, error) {
if c.dev == nil {