-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Interface to hidapi library
--
-- Requires the hidapi-libusb C API and pkg-config.
--
-- For information here
@package hid
@version 0.2.2
module System.HID
-- | Initialize the library.
--
-- This function initializes the library. Calling it is not strictly
-- necessary, as it will be called automatically when enumerating or
-- opening devices if it’s needed. This function should be called at the
-- beginning of execution however, if there is a chance of handles being
-- opened by different threads simultaneously.
init :: (MonadIO m) => m Bool
-- | Finalize the library.
--
-- This function frees all of the static data associated with the
-- library. It should be called at the end of execution to avoid memory
-- leaks.
exit :: (MonadIO m) => m Bool
-- | Information on a device.
data DeviceInfo
-- | Enumerate all devices for a given vendor ID and product ID. If you
-- need to get all available devices, use detectDevices.
enumerate :: (MonadIO m) => Word32 -> Word32 -> m [DeviceInfo]
-- | Enumerate all plugged in devices.
detectDevices :: (MonadIO m) => m [DeviceInfo]
-- | An opaque device.
data Device
-- | Get a Device from the vendor ID, product ID and an optional
-- serial number.
vendorProductSerialDevice :: (MonadIO m) => Word16 -> Word16 -> Maybe String -> m (Maybe Device)
-- | Get a Device from a path.
pathDevice :: (MonadIO m) => String -> m (Maybe Device)
-- | Write an Output report to a HID device.
--
-- The first byte of data must contain the Report ID. For devices which
-- only support a single report, this must be set to 0x0. The remaining
-- bytes contain the report data. Since the Report ID is mandatory, calls
-- to writeOutputReport will always contain one more byte(s) than
-- the report contains. For example, if a hid report is 16 bytes long, 17
-- bytes must be passed to writeOutputReport, the Report ID (or
-- 0x0, for devices with a single report), followed by the report data
-- (16 bytes). In that example, the length passed in would be 17.
--
-- writeOutputReport will send the data on the first OUT endpoint,
-- if one exists. If it does not, it will send the data through the
-- Control Endpoint Endpoint 0).
writeOutputReport :: (MonadIO m) => Device -> ByteString -> m Int
-- | Send a Feature report to the device.
--
-- Feature reports are sent over the Control endpoint as a Set_Report
-- transfer. The first byte of data must contain the Report ID. For
-- devices which only upport a single report, this must be set to 0x0.
-- The remaining bytes contain the report data. Since the Report ID is
-- mandatory, calls to sendFeatureReport will always contain one
-- more byte than the report contains. For example, if a hid report is 16
-- bytes long, 17 bytes must be passed to sendFeatureReport: the
-- Report ID (or 0x0, for devices which do not use numbered reports),
-- followed by the report data (16 bytes). In that example, the length
-- passed in would be 17.
sendFeatureReport :: (MonadIO m) => Device -> ByteString -> m Int
-- | Read an Input report from a HID device.
--
-- Input reports are returned to the host through the INTERRUPT IN
-- endpoint. The first byte will contain the Report number if the device
-- uses numbered reports.
readInputReport :: (MonadIO m) => Device -> m (Maybe ByteString)
-- | Read an Input report from a HID device with timeout.
--
-- Input reports are returned to the host through the INTERRUPT IN
-- endpoint. The first byte will contain the Report number if the device
-- uses numbered reports.
readInputReportTimeout :: (MonadIO m) => Device -> Int -> m (Maybe ByteString)
-- | Get a feature report from a HID device.
--
-- Set the first byte of data to the Report ID of the report to be read.
-- Make sure to allow space for this extra byte in data. Upon return, the
-- first byte will still contain the Report ID, and the report data will
-- start in data[1].
getFeatureReport :: (MonadIO m) => Device -> m (Maybe ByteString)
-- | Get the manufacturer string from a HID device.
getManufacturer :: (MonadIO m) => Device -> m String
-- | Get the product name from a HID device.
getProductName :: (MonadIO m) => Device -> m String
-- | Get the serial number string from a HID device.
getSerialNumber :: (MonadIO m) => Device -> m String
-- | Get an indexed string from a HID device.
getIndexedString :: (MonadIO m) => Device -> Int -> m String
-- | Set the blocking mode of a device.
setBlocking :: (MonadIO m) => Device -> Bool -> m Bool
-- | Get last error.
getError :: (MonadIO m) => Device -> m String
instance GHC.Show.Show System.HID.DeviceInfo
instance GHC.Classes.Eq System.HID.DeviceInfo