23 releases (13 stable)

2022.12.24 Dec 25, 2022
1.2024.4 Jul 8, 2024
1.2024.3 Apr 26, 2024
1.2024.2 Jan 31, 2024
0.0.2 Dec 27, 2020

#39 in Hardware support

Download history 150/week @ 2024-07-20 794/week @ 2024-07-27 539/week @ 2024-08-03 663/week @ 2024-08-10 503/week @ 2024-08-17 636/week @ 2024-08-24 403/week @ 2024-08-31 512/week @ 2024-09-07 344/week @ 2024-09-14 561/week @ 2024-09-21 421/week @ 2024-09-28 543/week @ 2024-10-05 447/week @ 2024-10-12 354/week @ 2024-10-19 607/week @ 2024-10-26 283/week @ 2024-11-02

1,839 downloads per month
Used in 11 crates (9 directly)

MIT license

270KB
958 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