ds4-rs

Crates.iods4-rs
lib.rsds4-rs
version0.1.1
created_at2025-08-30 18:12:41.026587+00
updated_at2025-08-30 18:28:55.118341+00
descriptionRead Dualshock4 controller data by using hidapi
homepagehttps://github.com/theyash14/ds4-rs
repositoryhttps://github.com/theyash14/ds4-rs
max_upload_size
id1817810
size46,643
Yashwanth R (theyash14)

documentation

https://github.com/theyash14/ds4-rs

README

Dualshock4 controller

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

Usage

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);
    }
}
Commit count: 0

cargo fmt