Monado OpenXR Runtime
|
Representing a single hid interface on a device. More...
#include <os/os_hid.h>
Public Member Functions | |
static int | os_hid_read (struct os_hid_device *hid_dev, uint8_t *data, size_t size, int milliseconds) |
Read the next input report, if any, from the given hid device. More... | |
static int | os_hid_write (struct os_hid_device *hid_dev, const uint8_t *data, size_t size) |
Write an output report to the given device. More... | |
static int | os_hid_get_feature (struct os_hid_device *hid_dev, uint8_t report_num, uint8_t *data, size_t size) |
Get a numbered feature report. More... | |
static int | os_hid_get_feature_timeout (struct os_hid_device *hid_dev, void *data, size_t size, uint32_t timeout) |
Get a feature report with a timeout. More... | |
static int | os_hid_set_feature (struct os_hid_device *hid_dev, const uint8_t *data, size_t size) |
Set a feature report. More... | |
static int | os_hid_get_physical_address (struct os_hid_device *hid_dev, uint8_t *data, size_t size) |
Get the physical address. More... | |
static void | os_hid_destroy (struct os_hid_device *hid_dev) |
Close and free the given device. More... | |
int | os_hid_open_hidraw (const char *path, struct os_hid_device **out_hid) |
Open the given path as a hidraw device. More... | |
Data Fields | |
int(* | read )(struct os_hid_device *hid_dev, uint8_t *data, size_t size, int milliseconds) |
int(* | write )(struct os_hid_device *hid_dev, const uint8_t *data, size_t size) |
int(* | get_feature )(struct os_hid_device *hid_dev, uint8_t report_num, uint8_t *data, size_t size) |
int(* | get_feature_timeout )(struct os_hid_device *hid_dev, void *data, size_t size, uint32_t timeout) |
int(* | set_feature )(struct os_hid_device *hid_dev, const uint8_t *data, size_t size) |
int(* | get_physical_address )(struct os_hid_device *hid_dev, uint8_t *data, size_t size) |
void(* | destroy )(struct os_hid_device *hid_dev) |
Representing a single hid interface on a device.
|
inline |
Close and free the given device.
|
inline |
Get a numbered feature report.
If the device doesn't have more than one feature report, request report 0.
|
inline |
Get a feature report with a timeout.
|
inline |
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.
int os_hid_open_hidraw | ( | const char * | path, |
struct os_hid_device ** | out_hid | ||
) |
|
inline |
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.
Referenced by psmv_read_one_packet(), and pssense_read_one_packet().
|
inline |
Set a feature report.
The first byte of the buffer is the report number, to be followed by the data of the report.
Referenced by hydra_system_enter_motion_control().
|
inline |
Write an output report to the given device.
Referenced by psmv_send_led_control_locked().