hid-decode 0.1.0

HID report descriptor decoding utilities
Documentation
  • Coverage
  • 100%
    11 out of 11 items documented1 out of 7 items with examples
  • Size
  • Source code size: 69.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 315.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ericseppanen

hid-decode crate

This crate contains tools for decoding USB HID report descriptors.

At this time it's only able to decode to text-- in the future it may permit decoding to types from the hid-types crate.

Example

// This was generated by an example in the `hid-descriptor` crate sources.
static GAMEPAD_DESCRIPTOR: &[u8] = include_bytes!("gamepad.bin");
let mut output = Vec::new();
hid_decode::decode(&mut output, GAMEPAD_DESCRIPTOR.iter().copied()).expect("write error");
let output = String::try_from(output).expect("non-UTF8 output");
assert_eq!(
    output.lines().collect::<Vec<_>>(),
    [
        "Usage Page: GenericDesktop",
        "Usage: Gamepad",
        "Collection: Application",
        "Usage Page: Button",
        "Usage Minimum: 1",
        "Usage Maximum: 8",
        "Logical Minimum: 0",
        "Logical Maximum: 1",
        "Report Size: 1",
        "Report Count: 8",
        "Input: Data Variable Absolute No-Wrap Linear Preferred-State No-Null-Position Bit-Field",
        "EndCollection",
    ]
);