libhidraw

Section: Linux Simple I/O Library (2)
Updated: 21 December 2018
Index Return to Main Contents
 

NAME

libhidraw -- Linux Simple I/O Library: Raw HID Module  

SYNOPSIS

#include <libsimpleio/libhidraw.h>

void HIDRAW_open(const char *name, int32_t *fd, int32_t *error);

void HIDRAW_open_id(int32_t VID, int32_t PID, int32_t *fd,
  int32_t *error);

void HIDRAW_close(int32_t fd, int32_t *error);

void HIDRAW_get_name(int32_t fd, char *name, int32_t namesize,
  int32_t *error);

void HIDRAW_get_info(int32_t fd, int32_t *bustype, int32_t *vendor,
  int32_t *product, int32_t *error);

void HIDRAW_send(int32_t fd, void *buf, int32_t bufsize,
  int32_t *count, int32_t *error);

void HIDRAW_receive(int32_t fd, void *buf, int32_t bufsize,
  int32_t *count, int32_t *error);

Link with -lsimpleio.  

DESCRIPTION

All functions return either 0 (upon success) or an errno value (upon failure) in *error.

HIDRAW_open() opens a raw HID device by name. The device node name (/dev/hidrawN) must be passed in name. Upon success, a file descriptor for the raw HID device is returned in *fd.

HIDRAW_open_id() opens the first raw HID device that matches the specified vendor and product ID numbers passed in VID and PID. Upon success, a file descriptor for the raw hid device is returned in *fd.

HIDRAW_close() closes a previously opened raw HID device. The HID device file descriptor must be passed in fd.

HIDRAW_get_name() fetches an information string from the raw HID device. The HID device file descriptor must be passed in fd. The destination buffer address must be passed in *name and the destination buffer size must be passed in namesize. The minimum size for the destination buffer is 16 bytes.

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 fd. The bus type is returned in *bustype, and may be BUS_USB, BUS_HIL, BUS_BLUETOOTH or BUS_VIRTUAL. These values are defined in /usr/include/linux/input.h. The vendor and product ID's are returned in *vendor and *product respectively.

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 fd. The address of the message buffer must be passed in buf and the size of the message buffer must be passed in 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 *count.

HIDRAW_receive() receives a message (i.e. a HID report) from the raw HID device. The HID device file descriptor must be passed in fd. The address of the message buffer must be passed in buf and the size of the message buffer must be passed in 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 *count.  

SEE ALSO

libsimpleio(2), libadc(2), libdac(2), libevent(2), libgpio(2),
libi2c(2), libipv4(2), liblinux(2), liblinx(2), libpwm(2),
libserial(2), libspi(2), libstream(2), libwatchdog(2)  

AUTHOR

Philip Munts, President, Munts AM Corp dba Munts Technologies


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 09:41:20 GMT, December 21, 2018