USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
Loading...
Searching...
No Matches
hid_opts Struct Reference

Per-instance configuration for a generic HID interface. More...

#include <classes/hid.h>

Data Fields

const uint8_t * report_desc
 The Report descriptor bytes (required)

 
uint16_t report_desc_len
 Length of report_desc

 
uint8_t subclass
 HID_SUBCLASS_NONE or HID_SUBCLASS_BOOT

 
uint8_t protocol
 HID_PROTOCOL_NONE/HID_PROTOCOL_KEYBOARD/HID_PROTOCOL_MOUSE (boot)

 
uint8_t in_ep
 Interrupt IN address (0 -> 0x81)

 
uint16_t in_mps
 0 -> 64

 
uint8_t in_interval
 0 -> 10

 
uint8_t out_ep
 Interrupt OUT address (0 = none, e.g.
 
uint16_t out_mps
 0 -> 64

 
uint8_t out_interval
 0 -> 10

 
uint8_t country
 bCountryCode (usually 0)

 
const char * name
 iInterface string (optional)

 
int(* get_report )(hid_iface *iface, void *user, uint8_t type, uint8_t id, uint8_t *buf, uint16_t len)
 Answer a host GET_REPORT (optional).
 
void(* set_report )(hid_iface *iface, void *user, uint8_t type, uint8_t id, const void *data, int len)
 Receive a host SET_REPORT on endpoint 0 (optional).
 
void(* on_output )(hid_iface *iface, void *user, const void *data, int len)
 Receive an Output report (optional) - from the interrupt-OUT pipe, or via SET_REPORT(Output) when set_report is NULL (e.g.
 
void * user
 Opaque pointer passed to every callback above.
 

Detailed Description

Per-instance configuration for a generic HID interface.

Zero-fields take the documented defaults. Any callback may be NULL.

Field Documentation

◆ report_desc

const uint8_t* hid_opts::report_desc

The Report descriptor bytes (required)

◆ report_desc_len

uint16_t hid_opts::report_desc_len

Length of report_desc

◆ subclass

uint8_t hid_opts::subclass

◆ protocol

uint8_t hid_opts::protocol

HID_PROTOCOL_NONE/HID_PROTOCOL_KEYBOARD/HID_PROTOCOL_MOUSE (boot)

◆ in_ep

uint8_t hid_opts::in_ep

Interrupt IN address (0 -> 0x81)

◆ in_mps

uint16_t hid_opts::in_mps

0 -> 64

◆ in_interval

uint8_t hid_opts::in_interval

0 -> 10

◆ out_ep

uint8_t hid_opts::out_ep

Interrupt OUT address (0 = none, e.g.

0x01)

◆ out_mps

uint16_t hid_opts::out_mps

0 -> 64

◆ out_interval

uint8_t hid_opts::out_interval

0 -> 10

◆ country

uint8_t hid_opts::country

bCountryCode (usually 0)

◆ name

const char* hid_opts::name

iInterface string (optional)

◆ get_report

int(* hid_opts::get_report) (hid_iface *iface, void *user, uint8_t type, uint8_t id, uint8_t *buf, uint16_t len)

Answer a host GET_REPORT (optional).

Parameters
ifacethe HID interface.
userthe user pointer.
typereport type - 1 Input, 2 Output, 3 Feature (see HID_REPORT_INPUT).
idreport ID (0 when report IDs are not used).
bufbuffer to fill with the report (up to len bytes).
lencapacity of buf.
Returns
bytes written, or < 0 to fall back to echoing the last Input report sent.

◆ set_report

void(* hid_opts::set_report) (hid_iface *iface, void *user, uint8_t type, uint8_t id, const void *data, int len)

Receive a host SET_REPORT on endpoint 0 (optional).

If NULL while on_output is set, Output reports are delivered to on_output instead.

Parameters
ifacethe HID interface.
userthe user pointer.
typereport type (1 Input, 2 Output, 3 Feature).
idreport ID.
datathe report bytes from the host.
lennumber of bytes in data.

◆ on_output

void(* hid_opts::on_output) (hid_iface *iface, void *user, const void *data, int len)

Receive an Output report (optional) - from the interrupt-OUT pipe, or via SET_REPORT(Output) when set_report is NULL (e.g.

keyboard LED reports).

Parameters
ifacethe HID interface.
userthe user pointer.
datathe Output report bytes.
lennumber of bytes in data.

◆ user

void* hid_opts::user

Opaque pointer passed to every callback above.


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