| Crates.io | ds4-rs |
| lib.rs | ds4-rs |
| version | 0.1.1 |
| created_at | 2025-08-30 18:12:41.026587+00 |
| updated_at | 2025-08-30 18:28:55.118341+00 |
| description | Read Dualshock4 controller data by using hidapi |
| homepage | https://github.com/theyash14/ds4-rs |
| repository | https://github.com/theyash14/ds4-rs |
| max_upload_size | |
| id | 1817810 |
| size | 46,643 |
This library is used to read dualshock4 controller data.
Fork of https://bitbucket.org/unessa/dualshock4-rust/src/master/
Dualshock4 event data documentation: http://www.psdevwiki.com/ps4/DS4-USB
Connect dualshock4 controller to your computer by using USB or bluetooth connection.
Add the following dependencies:
[dependencies]
hidapi = "2.6.3"
ds4-rs = "0.1.1"
Start reading device data:
use hidapi::{HidApi};
fn main() {
let api = HidApi::new().expect("Failed to create HID API instance.");
let controller = ds4_rs::get_device(&api).expect("Failed to open device");
loop {
let data = ds4_rs::read(&controller)
.expect("Failed to read data");
println!("{:?}", data);
}
}