.\" man page for Munts Technologies Linux Simple I/O Library .\" .\" Copyright (C)2016-2023, Philip Munts dba Munts Technologies. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions are met: .\" .\" * Redistributions of source code must retain the above copyright notice, .\" this list of conditions and the following disclaimer. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .TH libhidraw 2 "4 December 2020" "version 1" "Linux Simple I/O Library" .SH NAME .B libhidraw \-\- Linux Simple I/O Library: Raw HID Module .SH SYNOPSIS .nf .B #include .BI "void HIDRAW_open1(const char *" name ", int32_t *" fd ", int32_t *" error ");" .BI "void HIDRAW_open2(int32_t " VID ", int32_t " PID ", int32_t *" fd "," .BI " int32_t *" error ");" .BI "void HIDRAW_open3(int32_t " VID ", int32_t " PID ", const char *" serial "," .BI " int32_t *" fd ", int32_t *" error ");" .BI "void HIDRAW_close(int32_t " fd ", int32_t *" error ");" .BI "void HIDRAW_get_name(int32_t " fd ", char *" name ", int32_t " namesize ", .BI " int32_t *" error ");" .BI "void HIDRAW_get_info(int32_t " fd ", int32_t *" bustype ", int32_t *" vendor "," .BI " int32_t *" product ", int32_t *" error ");" .BI "void HIDRAW_send(int32_t " fd ", void *" buf ", int32_t " bufsize "," .BI " int32_t *" count ", int32_t *" error ");" .BI "void HIDRAW_receive(int32_t " fd ", void *" buf ", int32_t " bufsize "," .BI " int32_t *" count ", int32_t *" error ");" .fi Link with .BR -lsimpleio . .SH DESCRIPTION .nh All functions return either .B 0 (upon success) or an .B errno value (upon failure) in .IR *error . .PP .BR HIDRAW_open1() " opens a raw HID device by name. The device node name (" /dev/hidrawN ")" must be passed in .IR name . Upon success, a file descriptor for the raw HID device is returned in .IR *fd . .PP .BR HIDRAW_open2() " opens the first raw HID device that matches the vendor ID and product ID passed in .IR VID " and " PID . Upon success, a file descriptor for the raw hid device is returned in .IR *fd . .PP .BR HIDRAW_open3() " opens the raw HID device that matches the vendor ID, product ID, and serial number passed in .IR VID ", " PID ", and " serial . Upon success, a file descriptor for the raw hid device is returned in .IR *fd . .PP .B HIDRAW_close() closes a previously opened raw HID device. The HID device file descriptor must be passed in .IR fd . .PP .B HIDRAW_get_name() fetches an information string from the raw HID device. The HID device file descriptor must be passed in .IR fd . The destination buffer address must be passed in .I *name and the destination buffer size must be passed in .IR namesize . The minimum size for the destination buffer is 16 bytes. .PP .B HIDRAW_get_info() fetches the bus type, vendor ID and product ID from the raw HID device. The HID device file descriptor must be passed in .IR fd . The bus type is returned in .IR *bustype , and may be .BR BUS_USB , .BR BUS_HIL , .BR BUS_BLUETOOTH " or" .BR BUS_VIRTUAL . These values are defined in .BR /usr/include/linux/input.h . The vendor and product ID's are returned in .IR *vendor " and " *product " respectively." .PP .B HIDRAW_send() sends a message (also known as a HID report) to the raw HID device. The HID device file descriptor must be passed in .IR fd . The address of the message buffer must be passed in .IR buf and the size of the message buffer must be passed in .IR bufsize . The message size will typically be either 64 or 65 bytes, depending on whether the particular raw HID device uses the first byte for the report number. Upon success, the number of bytes actually sent will be returned in .IR *count . .PP .B HIDRAW_receive() receives a message (i.e. a HID report) from the raw HID device. The HID device file descriptor must be passed in .IR fd . The address of the message buffer must be passed in .IR buf and the size of the message buffer must be passed in .IR bufsize . The message size will typically be either 64 or 65 bytes, depending on whether the particular raw HID device uses the first byte for the report number. Upon success, the number of bytes actually received will be returned in .IR *count . .SH SEE ALSO .BR libsimpleio "(2), " libadc "(2), " libdac "(2), " libevent "(2), " libgpio "(2)," .br .BR libi2c "(2), " libipv4 "(2), " liblinux "(2), " liblinx "(2), " libpwm "(2)," .br .BR libserial "(2), " libspi "(2), " libstream "(2), " libwatchdog "(2)" .SH AUTHOR Philip Munts dba Munts Technologies.