The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
hid.h File Reference

a small HID report descriptor parser for pointing devices. More...

#include "common/stdint.h"

Go to the source code of this file.

Data Structures

struct  hid_field_t
struct  hid_pointer_t

Functions

bool hid_parse_pointer (const uint8_t *descriptor, uint32_t length, hid_pointer_t *out)
 find the pointer fields in a report descriptor.
int32_t hid_field_value (const hid_field_t *field, const uint8_t *report, uint32_t length)
 read a field from a report (the report id byte already skipped).

Detailed Description

a small HID report descriptor parser for pointing devices.

a USB mouse in the boot protocol sends a fixed report (buttons, x, y); other pointing devices (QEMU's tablet, graphics tablets, touch screens in mouse mode) describe their report in a report descriptor. this parser finds the buttons, x, y and the wheel in it: their bit offset, size and range, and whether x and y are absolute.

Function Documentation

◆ hid_parse_pointer()

bool hid_parse_pointer ( const uint8_t * descriptor,
uint32_t length,
hid_pointer_t * out )

find the pointer fields in a report descriptor.

Returns
true if it has an x and a y.

◆ hid_field_value()

int32_t hid_field_value ( const hid_field_t * field,
const uint8_t * report,
uint32_t length )

read a field from a report (the report id byte already skipped).

Parameters
lengththe bytes in the report.
Returns
the value, sign-extended when the field's range is signed.