hid v0.1.4 HID
NIF wrapper for hidapi library.
Summary
Functions
Closes the HID device
Enumerates the HID devices
Opens the HID device
Reads an Input report from a HID device
Writes an Output report to a HID device
Types
write_result :: {:ok, non_neg_integer} | {:error, :ehidwrite} | {:error, :ehidwrite, String.t}
Functions
Closes the HID device.
See original docs for details.
device is a device handle, returned by open.
enumerate(vendor_id :: byte, product_id :: byte) :: enum_result
Enumerates the HID devices.
See original docs for details.
vendor_id and product_id are the positive integer masks for enumeration.
0x00 means any value. Both arguments have 0x00 as a default value.
Opens the HID device.
See original docs for details.
You can open device by path ("/dev/hidraw0" for example)
or by vendor_id, product_id and optionally serial arguments.
path can be string or char list.
vendor_id and product_id are positive integers.
serial can be a string or charlist.
Function returns device handle that can be used in other device reading/writing functions.
open(vendor_id :: byte, product_id :: byte, serial :: String.t | charlist) :: open_result
Reads an Input report from a HID device.
See original docs for details.
Reads at most size bytes from HID device. Note that first byte of data would
be a HID Report ID, so you should include this byte into size.
Writes an Output report to a HID device.
See original docs for details.
Writes data to HID device. Note that first byte of data must be a HID Report ID.
If device supports a single reports only this byte must be set to 0x00.
Returns a number of actually written bytes.