Monado OpenXR Runtime
Loading...
Searching...
No Matches
h_hid_device Interface Reference

Representing a single hid interface on a device. More...

#include <hid/h_hid.h>

Inheritance diagram for h_hid_device:
Collaboration diagram for h_hid_device:

Public Member Functions

int h_hid_open_hidraw (const char *path, struct h_hid_device **out_hid)
 Open the given path as a hidraw device.
 

Static Public Member Functions

static int h_hid_read (struct h_hid_device *hid_dev, uint8_t *data, size_t size, int milliseconds)
 Read the next input report, if any, from the given hid device.
 
static int h_hid_write (struct h_hid_device *hid_dev, const uint8_t *data, size_t size)
 Write an output report to the given device.
 
static int h_hid_get_feature (struct h_hid_device *hid_dev, uint8_t report_num, uint8_t *data, size_t size)
 Get a numbered feature report.
 
static int h_hid_get_feature_timeout (struct h_hid_device *hid_dev, void *data, size_t size, uint32_t timeout)
 Get a feature report with a timeout.
 
static int h_hid_set_feature (struct h_hid_device *hid_dev, const uint8_t *data, size_t size)
 Set a feature report.
 
static int h_hid_get_physical_address (struct h_hid_device *hid_dev, uint8_t *data, size_t size)
 Get the physical address.
 
static void h_hid_destroy (struct h_hid_device *hid_dev)
 Close and free the given device.
 

Data Fields

int(* read )(struct h_hid_device *hid_dev, uint8_t *data, size_t size, int milliseconds)
 
int(* write )(struct h_hid_device *hid_dev, const uint8_t *data, size_t size)
 
int(* get_feature )(struct h_hid_device *hid_dev, uint8_t report_num, uint8_t *data, size_t size)
 
int(* get_feature_timeout )(struct h_hid_device *hid_dev, void *data, size_t size, uint32_t timeout)
 
int(* set_feature )(struct h_hid_device *hid_dev, const uint8_t *data, size_t size)
 
int(* get_physical_address )(struct h_hid_device *hid_dev, uint8_t *data, size_t size)
 
void(* destroy )(struct h_hid_device *hid_dev)
 

Detailed Description

Representing a single hid interface on a device.

Member Function Documentation

◆ h_hid_destroy()

static void h_hid_destroy ( struct h_hid_device *  hid_dev)
inlinestatic

Close and free the given device.

Referenced by hydra_found().

◆ h_hid_get_feature()

static int h_hid_get_feature ( struct h_hid_device *  hid_dev,
uint8_t  report_num,
uint8_t *  data,
size_t  size 
)
inlinestatic

Get a numbered feature report.

If the device doesn't have more than one feature report, request report 0.

◆ h_hid_get_feature_timeout()

static int h_hid_get_feature_timeout ( struct h_hid_device *  hid_dev,
void *  data,
size_t  size,
uint32_t  timeout 
)
inlinestatic

Get a feature report with a timeout.

◆ h_hid_get_physical_address()

static int h_hid_get_physical_address ( struct h_hid_device *  hid_dev,
uint8_t *  data,
size_t  size 
)
inlinestatic

Get the physical address.

For USB devices, the string contains the physical path to the device (the USB controller, hubs, ports, etc). For Bluetooth *devices, the string contains the hardware (MAC) address of the device.

◆ h_hid_open_hidraw()

int h_hid_open_hidraw ( const char *  path,
struct h_hid_device **  out_hid 
)

Open the given path as a hidraw device.

See also
hid_hidraw

References U_TYPED_CALLOC.

◆ h_hid_read()

static int h_hid_read ( struct h_hid_device *  hid_dev,
uint8_t *  data,
size_t  size,
int  milliseconds 
)
inlinestatic

Read the next input report, if any, from the given hid device.

If milliseconds are negative, this call blocks indefinitely, 0 polls, and positive will block for that amount of milliseconds.

◆ h_hid_set_feature()

static int h_hid_set_feature ( struct h_hid_device *  hid_dev,
const uint8_t *  data,
size_t  size 
)
inlinestatic

Set a feature report.

The first byte of the buffer is the report number, to be followed by the data of the report.

◆ h_hid_write()

static int h_hid_write ( struct h_hid_device *  hid_dev,
const uint8_t *  data,
size_t  size 
)
inlinestatic

Write an output report to the given device.


The documentation for this interface was generated from the following file: