ds4-rs 0.1.1

Read Dualshock4 controller data by using hidapi
Documentation

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);
    }
}