40 stable releases

2.6.5 Feb 25, 2026
2.6.4 Dec 20, 2025
2.6.3 Aug 7, 2024
2.6.1 Mar 2, 2024
0.2.0 Mar 12, 2016

#14 in Hardware support

Download history 19893/week @ 2025-12-28 44597/week @ 2026-01-04 53642/week @ 2026-01-11 46060/week @ 2026-01-18 48493/week @ 2026-01-25 59695/week @ 2026-02-01 50885/week @ 2026-02-08 52446/week @ 2026-02-15 68415/week @ 2026-02-22 95047/week @ 2026-03-01 93899/week @ 2026-03-08 66071/week @ 2026-03-15 77524/week @ 2026-03-22 72672/week @ 2026-03-29 70141/week @ 2026-04-05 65872/week @ 2026-04-12

293,003 downloads per month
Used in 372 crates (175 directly)

MIT license

435KB
9K SLoC

C 5.5K SLoC // 0.2% comments Rust 4K SLoC // 0.1% comments Automake 28 SLoC Snakemake 2 SLoC // 0.9% comments

hidapi Version License: MIT Documentation Chat

This crate provides a rust abstraction over the features of the C library hidapi. Based off of hidapi-rs by Osspial.

Usage

This crate is on crates.io and can be used by adding hidapi to the dependencies in your project's Cargo.toml.

In case you are downloading / checking out this repository directly via git, make sure to initialize the git submodules after cloning!

git submodule update --init

Example

extern crate hidapi;

let api = hidapi::HidApi::new().unwrap();
// Print out information about all connected devices
for device in api.device_list() {
    println!("{:#?}", device);
}

// Connect to device using its VID and PID
let (VID, PID) = (0x0123, 0x3456);
let device = api.open(VID, PID).unwrap();

// Read data from device
let mut buf = [0u8; 8];
let res = device.read(&mut buf[..]).unwrap();
println!("Read: {:?}", &buf[..res]);

// Write data to device
let buf = [0u8, 1, 2, 3, 4];
let res = device.write(&buf).unwrap();
println!("Wrote: {:?} byte(s)", res);

Documentation

Available at docs.rs.

Dependencies

~0–3.5MB
~67K SLoC