usb- Communicate with USB devicesSource codeContentsIndex
MaintainerBas van Dijk <>
This module provides functionality for enumerating the USB devices currently attached to the system.
data Device
getDevices :: Ctx -> IO [Device]
busNumber :: Device -> Word8
deviceAddress :: Device -> Word8
deviceDesc :: Device -> DeviceDesc
data Device Source

Abstract type representing a USB device detected on the system, usually originating from getDevices.

Certain operations can be performed on a device, but in order to do any I/O you will have to first obtain a DeviceHandle using openDevice. Alternatively you can use the usb-safe package which provides type-safe device handling. See:

Just because you have a reference to a device does not mean it is necessarily usable. The device may have been unplugged, you may not have permission to operate such device, or another program or driver may be using the device.

To get additional information about a device you can retrieve its descriptor using deviceDesc.

getDevices :: Ctx -> IO [Device]Source

Returns a list of USB devices currently attached to the system.

This is your entry point into finding a USB device to operate.


busNumber :: Device -> Word8Source
Get the number of the bus that a device is connected to.
deviceAddress :: Device -> Word8Source
Get the address of the device on the bus it is connected to.
deviceDesc :: Device -> DeviceDescSource
Get the USB device descriptor for a given device.
Produced by Haddock version 2.6.0