This commit is contained in:
Kyle Lemons
2012-03-26 22:51:47 -07:00
parent 86ebf94158
commit 2da2ce1e17
5 changed files with 12 additions and 11 deletions

View File

@@ -1,8 +1,8 @@
package main
import (
"fmt"
"flag"
"fmt"
"log"
"github.com/kylelemons/gousb/usb"

View File

@@ -32,9 +32,9 @@ func (e Endpoint) Direction() EndpointDirection {
func (e Endpoint) String() string {
return fmt.Sprintf("Endpoint %d %-3s %s - %s %s",
e.Number(), e.Direction(),
TransferType(e.Attributes) & TRANSFER_TYPE_MASK,
IsoSyncType(e.Attributes) & ISO_SYNC_TYPE_MASK,
IsoUsageType(e.Attributes) & ISO_USAGE_TYPE_MASK,
TransferType(e.Attributes)&TRANSFER_TYPE_MASK,
IsoSyncType(e.Attributes)&ISO_SYNC_TYPE_MASK,
IsoUsageType(e.Attributes)&ISO_USAGE_TYPE_MASK,
)
}

View File

@@ -9,9 +9,9 @@ type Descriptor struct {
Type DescriptorType // The type of this descriptor
Spec BCD // USB Specification Release Number
Class uint8 // The class of this device
SubClass uint8 // The sub-class (within the class) of this device
Protocol uint8 // The protocol (within the sub-class) of this device
Class uint8 // The class of this device
SubClass uint8 // The sub-class (within the class) of this device
Protocol uint8 // The protocol (within the sub-class) of this device
Vendor ID // The 8-bit Vendor identifer
Product ID // The 8-bit Product identifier
Device BCD // The device version

View File

@@ -89,7 +89,8 @@ func (d *Device) Reset() error {
return nil
}
var ControlTimeout = 5*time.Second
var ControlTimeout = 5 * time.Second
func (d *Device) Control(rType, request uint8, val, idx uint16, data []byte) (int, error) {
dataSlice := (*reflect.SliceHeader)(unsafe.Pointer(&data))
n := C.libusb_control_transfer(

View File

@@ -20,7 +20,7 @@ func (v Vendor) String() string {
}
type Product struct {
Name string
Name string
Interface map[usb.ID]string
}
@@ -29,7 +29,7 @@ func (p Product) String() string {
}
type Class struct {
Name string
Name string
SubClass map[uint8]*SubClass
}
@@ -38,7 +38,7 @@ func (c Class) String() string {
}
type SubClass struct {
Name string
Name string
Protocol map[uint8]string
}