Fix typos, more precise example for configurations.
This commit is contained in:
19
usb.go
19
usb.go
@@ -20,25 +20,26 @@ A Short Tutorial
|
|||||||
|
|
||||||
A Context manages all resources necessary for communicating with USB
|
A Context manages all resources necessary for communicating with USB
|
||||||
devices.
|
devices.
|
||||||
Through the Context users can iterate over available USB devices,
|
Through the Context users can iterate over available USB devices.
|
||||||
|
|
||||||
The USB standard defines a mechanism of discovering USB device functionality
|
The USB standard defines a mechanism of discovering USB device functionality
|
||||||
through a mechanism of descriptors. After the device is attached and
|
through descriptors. After the device is attached and
|
||||||
initialized by the host stack, it's possible to retrieve it's descriptor
|
initialized by the host stack, it's possible to retrieve its descriptor
|
||||||
(the device descriptor). It contains elements such as product and vendor IDs,
|
(the device descriptor). It contains elements such as product and vendor IDs,
|
||||||
bus number and device number (address) on the bus.
|
bus number and device number (address) on the bus.
|
||||||
|
|
||||||
In gousb Device struct represents the USB device, and Device.Desc
|
In gousb, the Device struct represents a USB device. The Device struct’s Desc
|
||||||
contains all the information known about the device.
|
field contains all known information about the device.
|
||||||
|
|
||||||
Among other information in the device descriptor is a list of configuration
|
Among other information in the device descriptor is a list of configuration
|
||||||
descriptors, accessible through Device.Desc.Configs.
|
descriptors, accessible through Device.Desc.Configs.
|
||||||
|
|
||||||
USB standard allows one physical USB device to switch between different
|
The USB standard allows one physical USB device to switch between different
|
||||||
sets of behaviors, or working modes, by selecting one of the offered configs
|
sets of behaviors, or working modes, by selecting one of the offered configs
|
||||||
(each device has at least one).
|
(each device has at least one).
|
||||||
This allows the same device to sometimes present itself as e.g. a 3G modem,
|
This allows the same device to sometimes present itself as e.g. a 3G modem,
|
||||||
and sometimes a flash drive. Configs are mutually exclusive, each device
|
and sometimes as a flash drive with the drivers for that 3G modem.
|
||||||
|
Configs are mutually exclusive, each device
|
||||||
can have only one active config at a time. Switching the active config performs
|
can have only one active config at a time. Switching the active config performs
|
||||||
a light-weight device reset. Each config in the device descriptor has
|
a light-weight device reset. Each config in the device descriptor has
|
||||||
a unique identification number.
|
a unique identification number.
|
||||||
@@ -48,7 +49,7 @@ It returns a Config struct that represents the device in this particular configu
|
|||||||
The configuration descriptor is accessible through Config.Desc.
|
The configuration descriptor is accessible through Config.Desc.
|
||||||
|
|
||||||
A config descriptor determines the list of available USB interfaces on the device.
|
A config descriptor determines the list of available USB interfaces on the device.
|
||||||
Each interface is a virtual device within the physical USB device and it's active
|
Each interface is a virtual device within the physical USB device and its active
|
||||||
config. There can be many interfaces active concurrently. Interfaces are
|
config. There can be many interfaces active concurrently. Interfaces are
|
||||||
enumerated sequentially starting from zero.
|
enumerated sequentially starting from zero.
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ interface level. Each interface can have only a single alternate setting
|
|||||||
active at any time. Alternate settings are enumerated sequentially starting from
|
active at any time. Alternate settings are enumerated sequentially starting from
|
||||||
zero.
|
zero.
|
||||||
|
|
||||||
In gousb an interface and it's alternate setting can be selected through
|
In gousb an interface and its alternate setting can be selected through
|
||||||
Config.Interface(num, altNum). The Interface struct is the representation
|
Config.Interface(num, altNum). The Interface struct is the representation
|
||||||
of the claimed interface with a particular alternate setting.
|
of the claimed interface with a particular alternate setting.
|
||||||
The descriptor of the interface is available through Interface.Setting.
|
The descriptor of the interface is available through Interface.Setting.
|
||||||
|
Reference in New Issue
Block a user