Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
USBD HID device API

USBD HID Device API . More...

Data Structures

struct  hid_device_ops
 HID device user callbacks. More...
 

Enumerations

enum  { HID_REPORT_TYPE_INPUT = 1 , HID_REPORT_TYPE_OUTPUT , HID_REPORT_TYPE_FEATURE }
 HID report types Report types used in Get/Set Report requests. More...
 

Functions

int hid_device_register (const struct device *dev, const uint8_t *const rdesc, const uint16_t rsize, const struct hid_device_ops *const ops)
 Register HID device report descriptor and user callbacks.
 
int hid_device_submit_report (const struct device *dev, const uint16_t size, const uint8_t *const report)
 Submit new input report.
 

Detailed Description

USBD HID Device API .

Since
3.7
Version
0.1.0

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <zephyr/usb/class/usbd_hid.h>

HID report types Report types used in Get/Set Report requests.

Enumerator
HID_REPORT_TYPE_INPUT 
HID_REPORT_TYPE_OUTPUT 
HID_REPORT_TYPE_FEATURE 

Function Documentation

◆ hid_device_register()

int hid_device_register ( const struct device * dev,
const uint8_t *const rdesc,
const uint16_t rsize,
const struct hid_device_ops *const ops )

#include <zephyr/usb/class/usbd_hid.h>

Register HID device report descriptor and user callbacks.

The device must register report descriptor and user callbacks before USB device support is initialized and enabled.

Parameters
[in]devPointer to HID device
[in]rdescPointer to HID report descriptor
[in]rsizeSize of HID report descriptor
[in]opsPointer to HID device callbacks

◆ hid_device_submit_report()

int hid_device_submit_report ( const struct device * dev,
const uint16_t size,
const uint8_t *const report )

#include <zephyr/usb/class/usbd_hid.h>

Submit new input report.

Submit a new input report to be sent via the interrupt IN pipe. If sync is true, the functions will block until the report is sent. If the device does not provide input_report_done() callback, hid_device_submit_report() will be processed synchronously.

Parameters
[in]devPointer to HID device
[in]sizeSize of the input report
[in]reportInput report buffer. Report buffer must be aligned.
Returns
0 on success, negative errno code on fail.