diff --git a/usb.go b/usb.go index 0474488..12bf104 100644 --- a/usb.go +++ b/usb.go @@ -20,25 +20,26 @@ A Short Tutorial A Context manages all resources necessary for communicating with USB 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 -through a mechanism of descriptors. After the device is attached and -initialized by the host stack, it's possible to retrieve it's descriptor +through descriptors. After the device is attached and +initialized by the host stack, it's possible to retrieve its descriptor (the device descriptor). It contains elements such as product and vendor IDs, bus number and device number (address) on the bus. -In gousb Device struct represents the USB device, and Device.Desc -contains all the information known about the device. +In gousb, the Device struct represents a USB device. The Device struct’s Desc +field contains all known information about the device. Among other information in the device descriptor is a list of configuration 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 (each device has at least one). 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 a light-weight device reset. Each config in the device descriptor has 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. 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 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 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 of the claimed interface with a particular alternate setting. The descriptor of the interface is available through Interface.Setting.