uploaded 2 months ago
USB Host HID driver

readme

# USB Host HID (Human Interface Device) Driver

[![Component Registry](https://components.espressif.com/components/espressif/usb_host_hid/badge.svg)](https://components.espressif.com/components/espressif/usb_host_hid)

This directory contains an implementation of a USB HID Driver implemented on top of the [USB Host Library](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_host.html).

HID driver allows access to HID devices.

## Usage

The following steps outline the typical API call pattern of the HID Class Driver:

1. Install the USB Host Library via 'usb_host_install()'
2. Install the HID driver via 'hid_host_install()'
3. The HID Host driver device callback provide the following events (via two callbacks):
    - HID_HOST_DRIVER_EVENT_CONNECTED
    - HID_HOST_INTERFACE_EVENT_INPUT_REPORT
    - HID_HOST_INTERFACE_EVENT_TRANSFER_ERROR
    - HID_HOST_INTERFACE_EVENT_DISCONNECTED

4. Specific HID device can be opened or closed with:
    - 'hid_host_device_open()'
    - 'hid_host_device_close()'
5. To enable / disable data receiving in case of event (keyboard key was pressed or mouse device was moved e.t.c) use:
    - 'hid_host_device_start()'
    - 'hid_host_device_stop()'
6. HID Class specific device requests:
    - 'hid_host_interface_get_report_descriptor()'
    - 'hid_class_request_get_report()'
    - 'hid_class_request_get_idle()'
    - 'hid_class_request_get_protocol()'
    - 'hid_class_request_set_report()'
    - 'hid_class_request_set_idle()'
    - 'hid_class_request_set_protocol()'
7. When HID device event occurs the driver call an interface callback with events:
    - HID_HOST_INTERFACE_EVENT_INPUT_REPORT
    - HID_HOST_INTERFACE_EVENT_TRANSFER_ERROR
    - HID_HOST_INTERFACE_EVENT_DISCONNECTED
8. The HID driver can be uninstalled via 'hid_host_uninstall()'

## Known issues

- Empty

## Examples

- For an example, refer to [hid_host_example](https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/hid)

## Supported Devices

- HID Driver support any HID compatible device with a USB bIterfaceClass 0x03 (Human Interface Device).
- There are two options to handle HID device input data: either in RAW format or via special event handlers (which are available only for HID Devices which support Boot Protocol).

Links

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "espressif/usb_host_hid^1.0.3"

or download archive

Stats

  • Archive size
    Archive size: 30.75 KB
  • Downloaded in total
    Downloaded in total 13.8k times
  • Downloaded this version
    This version: 794 times

Badge

espressif/usb_host_hid version: 1.0.3
|