Documentation
¶
Index ¶
Constants ¶
View Source
const ( ScannerModeUnknown = 0 /* bInterfaceClass 3 Human Interface Device bInterfaceSubClass 1 Boot Interface Subclass bInterfaceProtocol 1 Keyboard iInterface 15 HID Keyboard Emulation */ ScannerModeHIDKeyboardEmulation = 1 /* bDeviceClass 0 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 33 HID POS */ ScannerModeHIDDevice = 2 /* bDeviceClass 239 Miscellaneous Device bInterfaceClass 2 Communications bInterfaceSubClass 2 Abstract (modem) bInterfaceProtocol 1 AT-commands iInterface 41 CDC-ACM Comm */ ScannerModeCOMEmulation = 3 )
Variables ¶
This section is empty.
Functions ¶
func NewUsbContext ¶
Types ¶
type DeviceDesc ¶
type DeviceDesc struct { ManufacturerDesc string ProductDesc string Serial string gousb.DeviceDesc }
DeviceDesc is an extended representation of a USB device descriptor (gousb.DeviceDesc).
func GetUsbDevices ¶
func GetUsbDevices(ctx *gousb.Context) ([]DeviceDesc, error)
GetUsbDevices enum all usb devices
func (*DeviceDesc) GetScanner ¶
func (dd *DeviceDesc) GetScanner(ctx *gousb.Context) (*Scanner, error)
GetScanner returns a device with vendor, product and serial values
type Scanner ¶
type Scanner struct { // open device *gousb.Device // device info Info ScannerInfo }
Scanner is a representation of a barcode scanner.
type ScannerInfo ¶
type ScannerInfo struct { Config int Interface int Setup int Endpoint int Class gousb.Class SubClass gousb.Class Protocol gousb.Protocol MaxPacketSize int Mode ScannerMode }
ScannerInfo this is extended information of Scanner
type ScannerMode ¶
type ScannerMode uint8
func (ScannerMode) String ¶
func (sm ScannerMode) String() string
Click to show internal directories.
Click to hide internal directories.