From 2bf5a9979badf614ba9460360f1f0335ab2d1c31 Mon Sep 17 00:00:00 2001 From: David Hoppenbrouwers Date: Thu, 8 Sep 2022 13:17:12 +0200 Subject: [PATCH] Add LICENSE, README --- LICENSE | 21 +++++++++++++++++++++ README.md | 5 +++++ report_descriptor/Cargo.toml | 5 +---- report_descriptor/README.md | 19 +++++++++++++++++++ report_descriptor/src/lib.rs | 5 +---- report_descriptor/src/usage/mod.rs | 4 ++-- 6 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 report_descriptor/README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3e9c748 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Hiroki Tokunaga + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6362826 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Utilities for working with USB HID devices + +## Crates + +* [`report_descriptor`](report_descriptor/) item parser for Report descriptors. diff --git a/report_descriptor/Cargo.toml b/report_descriptor/Cargo.toml index b16bfa4..0683ae9 100644 --- a/report_descriptor/Cargo.toml +++ b/report_descriptor/Cargo.toml @@ -2,7 +2,4 @@ name = "report_descriptor" version = "0.1.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] +license = "MIT" diff --git a/report_descriptor/README.md b/report_descriptor/README.md new file mode 100644 index 0000000..87812c7 --- /dev/null +++ b/report_descriptor/README.md @@ -0,0 +1,19 @@ +# Report descriptor item parser + +## Example + +```rs +const QEMU_USB_TABLET: &[u8] = &[ + 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, + 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, + 0x81, 0x01, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x15, 0x00, 0x26, 0xff, 0x7f, 0x35, 0x00, + 0x46, 0xff, 0x7f, 0x75, 0x10, 0x95, 0x02, 0x81, 0x02, 0x05, 0x01, 0x09, 0x38, 0x15, 0x81, + 0x25, 0x7f, 0x35, 0x00, 0x45, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0, +]; + +dbg!(usb_hid_report_descriptor::parse(QEMU_USB_TABLET).collect::>()); +``` + +## References + +* diff --git a/report_descriptor/src/lib.rs b/report_descriptor/src/lib.rs index 9ceb2eb..1727301 100644 --- a/report_descriptor/src/lib.rs +++ b/report_descriptor/src/lib.rs @@ -1,7 +1,4 @@ -//! ## References -//! -//! https://www.usb.org/sites/default/files/hid1_11.pdf - +#![doc = include_str!("../README.md")] #![cfg_attr(not(test), no_std)] pub mod usage; diff --git a/report_descriptor/src/usage/mod.rs b/report_descriptor/src/usage/mod.rs index b8ff191..a74aa9f 100644 --- a/report_descriptor/src/usage/mod.rs +++ b/report_descriptor/src/usage/mod.rs @@ -1,6 +1,6 @@ -//! # References +//! ## References //! -//! * https://www.usb.org/sites/default/files/hut1_3_0.pdf +//! * macro_rules! usage { { [$page:literal] $($i:literal $v:ident)* } => {