package hidapi
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=750d03623fe39a5ff13f206a182163a18a65d529f9ea4431d3daab9ccf438f1a
sha512=d352e7d75f702b1a36db858ac7117fcb928a11a100b231fbd8c4e1f4dd7219cf496cb6f4184236d87a4eb22b208df389e43e29946ac3681aab7486faf519f749
doc/hidapi/Hidapi/index.html
Module Hidapi
Source
type device_info = {
path : string;
vendor_id : int;
product_id : int;
serial_number : string option;
release_number : int;
manufacturer_string : string option;
product_string : string option;
usage_page : int;
usage : int;
interface_number : int;
}
init ()
initializes the HIDAPI library. Calling it is not strictly necessary, however this function should be called at the beginning of execution however, if there is a chance of HIDAPI handles being opened by different threads simultaneously.
deinit ()
frees all of the static data associated with HIDAPI. It should be called at the end of execution to avoid memory leaks.
enumerate ?vendor_id ?product_id ()
is the list of HID devices attached to the system. The optional arguments are a way to filter the results returned.
open_id ~vendor_id ~product_id
is the device handle of HID device (vendor_id, product_id), or None if no such device exist or in case of error.
open_path path
is the device handle of HID device of path path
, or None if no such device exist or in case of error. path
can be discovered with enumerate
or a platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
write t buf
is Ok nb_bytes_written
on success, or Error description
in case of error.
read ?timeout t buf len
is Ok nb_bytes_read
on success, or Error description
in case of error.
set_nonblocking t v
sets nonblocking mode if v
is true
, or sets blocking mode otherwise.