22 releases (12 stable)

2022.12.24 Dec 25, 2022
1.2024.3 Apr 26, 2024
1.2024.2 Jan 31, 2024
1.2023.7 Nov 19, 2023
0.0.2 Dec 27, 2020

#50 in Hardware support

Download history 17/week @ 2024-01-24 97/week @ 2024-01-31 227/week @ 2024-02-07 51/week @ 2024-02-14 64/week @ 2024-02-21 264/week @ 2024-02-28 96/week @ 2024-03-06 122/week @ 2024-03-13 183/week @ 2024-03-20 498/week @ 2024-03-27 488/week @ 2024-04-03 559/week @ 2024-04-10 477/week @ 2024-04-17 807/week @ 2024-04-24 759/week @ 2024-05-01 436/week @ 2024-05-08

2,571 downloads per month
Used in 9 crates (7 directly)

MIT license

270KB
965 lines

usb-ids

CI Crates.io

Cross-platform Rust wrappers for the USB ID Repository.

This library bundles the USB ID database, allowing platforms other than Linux to query it as a source of canonical USB metadata.

Usage

Iterating over all known vendors:

use usb_ids::Vendors;

for vendor in Vendors::iter() {
    for device in vendor.devices() {
        println!("vendor: {}, device: {}", vendor.name(), device.name());
    }
}

See the documentation for more details.


lib.rs:

Rust wrappers for the USB ID Repository.

The USB ID Repository is the canonical source of USB device information for most Linux userspaces; this crate vendors the USB ID database to allow non-Linux hosts to access the same canonical information.

Usage

Iterating over all known vendors:

use usb_ids::Vendors;

for vendor in Vendors::iter() {
    for device in vendor.devices() {
        println!("vendor: {}, device: {}", vendor.name(), device.name());
    }
}

Iterating over all known classes:

use usb_ids::Classes;

for class in Classes::iter() {
    println!("class: {}", class.name());
    for subclass in class.sub_classes() {
        println!("\tsubclass: {}", subclass.name());
        for protocol in subclass.protocols() {
           println!("\t\tprotocol: {}", protocol.name());
        }
    }
}

See the individual documentation for each structure for more details.

Dependencies