Type Alias usb_ids::HidUsage

source ·
pub type HidUsage = UsbId<HID_USAGE_TAG, u16>;
Expand description

Represents a HID usage type in the USB database.

use usb_ids::{HidUsage, HidUsagePage, FromId};

let hid_usage_page = HidUsagePage::from_id(0x01).unwrap();
for usage in hid_usage_page.usages() {
   println!("usage: {}", usage.name());
}

Aliased Type§

struct HidUsage { /* private fields */ }

Implementations§

source§

impl HidUsage

source

pub fn from_pageid_uid(page_id: u8, id: u16) -> Option<&'static Self>

Returns the HidUsage corresponding to the given usage page and usage ID, or None if no such usage exists in the DB.

use usb_ids::HidUsage;
let hid_usage = HidUsage::from_pageid_uid(0x01, 0x002).unwrap();
assert_eq!(hid_usage.name(), "Mouse");