Remove "libusb" from the comments.

This commit is contained in:
Sebastian Zagrodzki
2017-05-06 00:31:04 +02:00
parent 9623c1ba8d
commit 1c9a11b1ce
3 changed files with 15 additions and 10 deletions

View File

@@ -172,8 +172,8 @@ func (d *Device) GetStringDescriptor(descIndex int) (string, error) {
return libusb.getStringDesc(d.handle, descIndex)
}
// SetAutoDetach enables/disables libusb's automatic kernel driver detachment.
// When autodetach is enabled libusb will automatically detach the kernel driver
// SetAutoDetach enables/disables automatic kernel driver detachment.
// When autodetach is enabled gousb will automatically detach the kernel driver
// on the interface and reattach it when releasing the interface.
// Automatic kernel driver detachment is disabled on newly opened device handles by default.
func (d *Device) SetAutoDetach(autodetach bool) error {

View File

@@ -22,7 +22,7 @@ import (
// #include <libusb.h>
import "C"
// Error is an error code returned by libusb.
// Error is an error code from a USB operation. See the list of Error constants below.
type Error C.int
// Error implements the error interface.
@@ -38,7 +38,7 @@ func fromErrNo(errno C.int) error {
return err
}
// Error codes defined by libusb.
// Defined result codes.
const (
Success Error = C.LIBUSB_SUCCESS
ErrorIO Error = C.LIBUSB_ERROR_IO
@@ -48,6 +48,8 @@ const (
ErrorNotFound Error = C.LIBUSB_ERROR_NOT_FOUND
ErrorBusy Error = C.LIBUSB_ERROR_BUSY
ErrorTimeout Error = C.LIBUSB_ERROR_TIMEOUT
// ErrorOverflow indicates that the device tried to send more data than was
// requested and that could fit in the packet buffer.
ErrorOverflow Error = C.LIBUSB_ERROR_OVERFLOW
ErrorPipe Error = C.LIBUSB_ERROR_PIPE
ErrorInterrupted Error = C.LIBUSB_ERROR_INTERRUPTED
@@ -76,7 +78,7 @@ var errorString = map[Error]string{
// TransferStatus contains information about the result of a transfer.
type TransferStatus uint8
// Transfer status values provided by libusb.
// Defined Transfer status values.
const (
TransferCompleted TransferStatus = C.LIBUSB_TRANSFER_COMPLETED
TransferError TransferStatus = C.LIBUSB_TRANSFER_ERROR

13
usb.go
View File

@@ -13,21 +13,24 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package usb provides a wrapper around libusb-1.0.
// Package gousb provides an low-level interface to attached USB devices.
//
// A Context represents a new
package gousb
// Context is the libusb context instance.
// Context manages all resources related to USB device handling.
type Context struct {
ctx *libusbContext
done chan struct{}
}
// Debug changes the libusb debug level.
// Debug changes the debug level. Level 0 means no debug, higher levels
// will print out more debugging information.
func (c *Context) Debug(level int) {
libusb.setDebug(c.ctx, level)
}
// NewContext initializes libusb and returns a new context instance.
// NewContext returns a new Context instance.
func NewContext() *Context {
c, err := libusb.init()
if err != nil {
@@ -100,7 +103,7 @@ func (c *Context) OpenDeviceWithVIDPID(vid, pid ID) (*Device, error) {
return devs[0], nil
}
// Close releases the libusb context.
// Close releases the Context and all associated resources.
func (c *Context) Close() error {
c.done <- struct{}{}
if c.ctx != nil {