Below some notions about USB that could be useful to access USB devices programatically with libusb. For more details refer to USB2.0 specification.
- Host: Computer.
- USB device: Peripheral connected to computer via USB.
- Hub: USB device providing additionnal connections to the USB.
- IRQ (Interrupt request): a hardware signal from device requesting attention from host.
- Pipe: Logical abstraction for associating device's endpoint and host's software. There two types of pipes:
- Stream pipe: data no USB-defined structure.
- Message pipe: data has a USB-defined structure.
- Descriptors: Data structures providing information about USB device (stored on device).
- Configuration: Configuration descriptors are read by host from device (e.g. max power consumption).
- Interfaces: Each interface represents a feature/function provided by device (e.g. a multifunction printer has multiple functions: as a printer, a fax, a scanner). It may include one or more endpoints (multiple ones for simultenous communication, e.g. left & right audio streams).
- Endpoints: Communication channels via which data is transferred between host and device. The are the ultimate consumer (sink) or provider (source) of data.
- Unique address: Assigned by system to logical device on attachment.
A transfer type is chosen according to the intended use case:
- Control transfer: Used for device configuration and control (e.g. device initialization, its confguration). Guaranteed to be reliable.
- Bulk: Used for the non-time critical transfer of a large amount of data async (e..g file transfers). Guarantees data delivery.
- Interrupt: Used to send small time-sensitive data packets (e.g. periodic data updates in real-time from mouse).
- Isochronous: Used for streaming data continously (e.g. audio and video streaming). No error detection or retransmission.