Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ assets = [
auto-req = "no"

[package.metadata.generate-rpm.requires]
libiio = "*"
libevdev = "*"

# debian package needs pkg-config, libclang-dev, libiio-dev and libudev-dev to build
# while runtime dependencies are libiio0 and libudev1
# debian package needs pkg-config, libclang-dev, and libudev-dev to build
# while runtime dependencies are libudev1
# libevdev2 and libevdev-dev are listed but not needed
[package.metadata.deb]
license-file = ["LICENSE", "4"]
Expand Down Expand Up @@ -65,6 +64,11 @@ assets = [
"usr/share/polkit-1/rules.d/org.shadowblip.InputPlumber.rules",
"644",
],
[
"rootfs/usr/lib/modules-load.d/*",
"usr/lib/modules-load.d/",
"644",
],
[
"rootfs/usr/lib/systemd/system/*",
"usr/lib/systemd/system/",
Expand Down Expand Up @@ -116,7 +120,6 @@ evdev = { git = "https://github.com/emberian/evdev.git", features = [
futures = "0.3.31"
glob-match = "0.2.1"
hidapi = "2.6.4"
industrial-io = "0.6.1"
#evdev = { version = "0.12.1", features = ["tokio"] }
inotify = "0.11.0"
# Omit trace logging for release builds
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ RUN apt-get update && apt-get install -y \
zstd \
libclang-dev \
libudev-dev \
libiio-dev \
squashfs-tools

RUN apt-get install -y \
g++-aarch64-linux-gnu \
libc6-dev-arm64-cross \
libudev-dev:arm64 \
libiio-dev:arm64
libudev-dev:arm64

RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup toolchain install --force-non-host stable-aarch64-unknown-linux-gnu
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ install: build ## Install inputplumber to the given prefix (default: PREFIX=/usr
rootfs/usr/share/polkit-1/actions/*
install -D -m 644 -t $(PREFIX)/share/polkit-1/rules.d/ \
rootfs/usr/share/polkit-1/rules.d/*
install -D -m 644 -t $(PREFIX)/lib/modules-load.d/ \
rootfs/usr/lib/modules-load.d/*
install -D -m 644 -t $(PREFIX)/lib/systemd/system/ \
rootfs/usr/lib/systemd/system/*
install -D -m 644 -t $(PREFIX)/lib/udev/hwdb.d/ \
Expand All @@ -83,6 +85,7 @@ uninstall: ## Uninstall inputplumber
rm $(PREFIX)/share/dbus-1/system.d/$(DBUS_NAME).conf
rm $(PREFIX)/share/polkit-1/actions/$(DBUS_NAME).policy
rm $(PREFIX)/share/polkit-1/rules.d/$(DBUS_NAME).rules
rm $(PREFIX)/lib/modules-load.d/inputplumber-hrtimer.conf
rm $(PREFIX)/lib/systemd/system/$(NAME).service
rm $(PREFIX)/lib/systemd/system/$(NAME)-suspend.service
rm $(PREFIX)/lib/udev/hwdb.d/59-inputplumber.hwdb
Expand Down
1 change: 0 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
InputPlumber requires the following system dependencies:

- `libevdev`
- `libiio`
- `rust`

To install the package, first visit the [release page](https://github.com/ShadowBlip/InputPlumber/releases) and download
Expand Down
2 changes: 1 addition & 1 deletion pkg/archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkgdesc="Open source input router and remapper daemon for Linux"
arch=('x86_64')
url="https://github.com/ShadowBlip/inputplumber"
license=('GPL')
depends=('dbus' 'libevdev' 'libiio')
depends=('dbus' 'libevdev')
optdepends=('polkit')
provides=('inputplumber')
conflicts=('inputplumber-git')
Expand Down
2 changes: 0 additions & 2 deletions pkg/rpm/inputplumber.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ URL: https://github.com/ShadowBlip/InputPlumber
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz

BuildRequires: libevdev-devel
BuildRequires: libiio-devel
BuildRequires: git
BuildRequires: make
BuildRequires: cargo
Expand All @@ -16,7 +15,6 @@ BuildRequires: llvm-devel
BuildRequires: clang-devel
BuildRequires: systemd-rpm-macros
Requires: libevdev
Requires: libiio
Requires: polkit
Recommends: linuxconsoletools
Provides: inputplumber
Expand Down
1 change: 1 addition & 0 deletions rootfs/usr/lib/modules-load.d/inputplumber-hrtimer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iio_trig_hrtimer
36 changes: 20 additions & 16 deletions rootfs/usr/lib/udev/rules.d/99-inputplumber-device-setup.rules
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
# AOKZOE/OneXPlayer
# Turbo button takeover
ACTION=="add|change", KERNEL=="oxp-platform", SUBSYSTEM=="platform", DRIVER=="oxp-platform", ATTR{tt_toggle}="1", GOTO="end"
ACTION=="add|change", KERNEL=="oxp-platform", SUBSYSTEM=="platform", DRIVER=="oxp-platform", ATTR{tt_toggle}="1", GOTO="inputplumber_setup_end"

# Lenovo
# Legion Go S Controller Settings
ACTION=="add|change|bind", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e31[01]", SUBSYSTEM=="hid", DRIVER=="lenovo-legos-hid", ATTR{gamepad/auto_sleep_time}="0", ATTR{gamepad/dpad_mode}="8-way", ATTR{gamepad/mode}="xinput", ATTR{gamepad/poll_rate}="250", ATTR{os_mode}="linux", ATTR{touchpad/linux_mode}="absolute", GOTO="end"
ACTION=="add|change|bind", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e31[01]", SUBSYSTEM=="hid", DRIVER=="hid-lenovo-go-s", ATTR{gamepad/auto_sleep_time}="0", ATTR{gamepad/dpad_mode}="8-way", ATTR{gamepad/mode}="xinput", ATTR{gamepad/poll_rate}="250", ATTR{os_mode}="linux", ATTR{touchpad/linux_mode}="absolute", GOTO="end"
ACTION=="add|change|bind", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e31[01]", SUBSYSTEM=="hid", DRIVER=="lenovo-legos-hid", ATTR{gamepad/auto_sleep_time}="0", ATTR{gamepad/dpad_mode}="8-way", ATTR{gamepad/mode}="xinput", ATTR{gamepad/poll_rate}="250", ATTR{os_mode}="linux", ATTR{touchpad/linux_mode}="absolute", GOTO="inputplumber_setup_end"
ACTION=="add|change|bind", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e31[01]", SUBSYSTEM=="hid", DRIVER=="hid-lenovo-go-s", ATTR{gamepad/auto_sleep_time}="0", ATTR{gamepad/dpad_mode}="8-way", ATTR{gamepad/mode}="xinput", ATTR{gamepad/poll_rate}="250", ATTR{os_mode}="linux", ATTR{touchpad/linux_mode}="absolute", GOTO="inputplumber_setup_end"

# Legion Go/Go2 Controller Settings
ACTION=="add|change|bind", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="61e[bcde]", SUBSYSTEM=="hid", DRIVER=="hid-lenovo-go", ATTR{os_mode}="linux", ATTR{left_handle/imu_bypass_enable}="true", ATTR{right_handle/imu_bypass_enable}="true", ATTR{touchpad/vibration_enable}="false", GOTO="end"
ACTION=="add|change|bind", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="61e[bcde]", SUBSYSTEM=="hid", DRIVER=="hid-lenovo-go", ATTR{os_mode}="linux", ATTR{left_handle/imu_bypass_enable}="true", ATTR{right_handle/imu_bypass_enable}="true", ATTR{touchpad/vibration_enable}="false", GOTO="inputplumber_setup_end"

# ASUS
# ROG Ally Controller Settings
## asus_ally_hid uses string values for gamepad_mode, i.e. "gamepad", asus_rog_ally uses numeric values, i.e. "1"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="gamepad", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="1", ATTR{apply_all}="1", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="gamepad", GOTO="inputplumber_setup_end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="inputplumber_setup_end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="1", ATTR{apply_all}="1", GOTO="inputplumber_setup_end"
#ACTION=="add|change", KERNEL=="0003:0B05:1ABE*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="inputplumber_setup_end"
#
## ROG Ally X Controller Settings
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="gamepad", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="1", ATTR{apply_all}="1", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="gamepad", GOTO="inputplumber_setup_end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_ally_hid", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="inputplumber_setup_end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="02", ATTR{btn_m1/remap}="KB_F15", ATTR{btn_m2/remap}="KB_F14", ATTR{gamepad_mode}="1", ATTR{apply_all}="1", GOTO="inputplumber_setup_end"
#ACTION=="add|change", KERNEL=="0003:0B05:1B4C*", SUBSYSTEM=="hid", DRIVER=="asus_rog_ally", ATTRS{bInterfaceNumber}=="05", ATTR{qam_mode}="0", GOTO="inputplumber_setup_end"

# MSI Claw Settings
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="190[1-3]", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{button_m1}="KEY_RIGHTBRACE", ATTR{button_m2}="KEY_LEFTBRACE", GOTO="claw_desktop"
LABEL="claw_desktop"
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="1901", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{gamepad_mode}=="desktop", ATTR{gamepad_mode}="xinput", GOTO="end"
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="1902", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{gamepad_mode}=="desktop", ATTR{gamepad_mode}="dinput", GOTO="end"
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="1903", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{gamepad_mode}="xinput", GOTO="end"
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="1901", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{gamepad_mode}=="desktop", ATTR{gamepad_mode}="xinput", GOTO="inputplumber_setup_end"
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="1902", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{gamepad_mode}=="desktop", ATTR{gamepad_mode}="dinput", GOTO="inputplumber_setup_end"
ACTION=="add|change|bind", ATTRS{idVendor}=="0db0", ATTRS{idProduct}=="1903", SUBSYSTEM=="hid", DRIVER=="hid-msi", ATTR{gamepad_mode}="xinput", GOTO="inputplumber_setup_end"

LABEL="end"
# IMUs, block iio-sensor-proxy if inputplumber autostarts on that device
ACTION=="add|change", SUBSYSTEM=="iio", ENV{IIO_SENSOR_PROXY_TYPE}!="", IMPORT{builtin}="hwdb '$attr{[dmi/id]modalias}'"
ACTION=="add|change", SUBSYSTEM=="iio", ENV{USE_INPUTPLUMBER}=="1", ENV{IIO_SENSOR_PROXY_TYPE}="", ENV{SYSTEMD_WANTS}="", GOTO="inputplumber_setup_end"

LABEL="inputplumber_setup_end"
7 changes: 7 additions & 0 deletions rootfs/usr/share/inputplumber/devices/50-legion_go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ source_devices:
x: [0, 1, 0]
y: [1, 0, 0]
z: [0, 0, 1]
- group: imu
iio:
name: accel_3d
mount_matrix:
x: [0, 1, 0]
y: [1, 0, 0]
z: [0, 0, 1]

# Optional configuration for the composite device
options:
Expand Down
14 changes: 10 additions & 4 deletions rootfs/usr/share/inputplumber/devices/50-msi_claw_a8_bz2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,16 @@ source_devices:
iio:
name: gyro_3d
mount_matrix:
# TODO: Verify
x: [0, 1, 0]
y: [-1, 0, 0]
z: [0, 0, -1]
x: [1, 0, 0]
y: [0, -1, 0]
z: [0, 0, 1]
- group: imu
iio:
name: accel_3d
mount_matrix:
x: [1, 0, 0]
y: [0, -1, 0]
z: [0, 0, 1]

# Optional configuration for the composite device
options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ source_devices:
- group: imu
iio:
name: "{i2c-BMI0160:00,bmi260}"
mount_matrix:
x: [0, -1, 0]
y: [1, 0, 0]
z: [0, 0, -1]

# Optional configuration for the composite device
options:
Expand Down
2 changes: 1 addition & 1 deletion rootfs/usr/share/inputplumber/devices/50-rog_ally.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ source_devices:
name: bmi323-imu
mount_matrix:
x: [1, 0, 0]
y: [0, -1, 0]
y: [0, 1, 0]
z: [0, 0, -1]
- group: led
udev:
Expand Down
2 changes: 1 addition & 1 deletion rootfs/usr/share/inputplumber/devices/50-rog_ally_x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ source_devices:
name: bmi323-imu
mount_matrix:
x: [1, 0, 0]
y: [0, -1, 0]
y: [0, 1, 0]
z: [0, 0, -1]
- group: led
udev:
Expand Down
62 changes: 12 additions & 50 deletions src/drivers/dualsense/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,11 @@ use crate::drivers::dualsense::{
};

use super::{
event::{AccelerometerEvent, AccelerometerInput, AxisEvent, AxisInput, Event, TouchAxisInput},
event::{AxisEvent, AxisInput, Event, InertialInput, IntertialEvent, TouchAxisInput},
hid_report::{PackedInputDataReport, SetStatePackedOutputData, UsbPackedOutputReport},
DS5_ACCEL_TO_SI, DS5_GYRO_TO_RADS, DS5_VID, INPUT_REPORT_BT_SIZE, PIDS,
};

// Source: https://github.com/torvalds/linux/blob/master/drivers/hid/hid-playstation.c
pub const DS5_EDGE_NAME: &str = "Sony Interactive Entertainment DualSense Edge Wireless Controller";
pub const DS5_EDGE_VERSION: u16 = 256;
pub const DS5_EDGE_VID: u16 = 0x054c;
pub const DS5_EDGE_PID: u16 = 0x0df2;

pub const DS5_NAME: &str = "Sony Interactive Entertainment DualSense Wireless Controller";
pub const DS5_VERSION: u16 = 0x8111;
pub const DS5_VID: u16 = 0x054c;
pub const DS5_PID: u16 = 0x0ce6;

pub const PIDS: [u16; 2] = [DS5_EDGE_PID, DS5_PID];

pub const FEATURE_REPORT_PAIRING_INFO: u8 = 0x09;
pub const FEATURE_REPORT_FIRMWARE_INFO: u8 = 0x20;
pub const FEATURE_REPORT_CALIBRATION: u8 = 0x05;

pub const INPUT_REPORT_USB: u8 = 0x01;
pub const INPUT_REPORT_USB_SIZE: usize = 64;
pub const INPUT_REPORT_BT: u8 = 0x31;
pub const INPUT_REPORT_BT_SIZE: usize = 78;
pub const OUTPUT_REPORT_USB: u8 = 0x02;
pub const OUTPUT_REPORT_USB_SIZE: usize = 63;
pub const OUTPUT_REPORT_USB_SHORT_SIZE: usize = 48;
pub const OUTPUT_REPORT_BT: u8 = 0x31;
pub const OUTPUT_REPORT_BT_SIZE: usize = 78;

// Input report axis ranges
pub const STICK_X_MIN: f64 = u8::MIN as f64;
pub const STICK_X_MAX: f64 = u8::MAX as f64;
pub const STICK_Y_MIN: f64 = u8::MIN as f64;
pub const STICK_Y_MAX: f64 = u8::MAX as f64;
pub const TRIGGER_MAX: f64 = u8::MAX as f64;

// DualSense hardware limits
pub const DS5_ACC_RES_PER_G: u32 = 8192;
pub const DS5_TOUCHPAD_WIDTH: f64 = 1919.0;
pub const DS5_TOUCHPAD_HEIGHT: f64 = 1079.0;

/// PS5 Dualsense controller driver for reading gamepad input
pub struct Driver {
state: Option<PackedInputDataReport>,
Expand Down Expand Up @@ -420,18 +382,18 @@ impl Driver {
}

// Accelerometer events
events.push(Event::Accelerometer(AccelerometerEvent::Accelerometer(
AccelerometerInput {
x: state.accel_x.to_primitive(),
y: state.accel_y.to_primitive(),
z: state.accel_z.to_primitive(),
events.push(Event::Accelerometer(IntertialEvent::Accelerometer(
InertialInput {
x: state.accel_x.to_primitive() as f64 * DS5_ACCEL_TO_SI,
y: state.accel_y.to_primitive() as f64 * DS5_ACCEL_TO_SI,
z: state.accel_z.to_primitive() as f64 * DS5_ACCEL_TO_SI,
},
)));
events.push(Event::Accelerometer(AccelerometerEvent::Gyro(
AccelerometerInput {
x: state.pitch.to_primitive(),
y: state.yaw.to_primitive(),
z: state.roll.to_primitive(),
events.push(Event::Accelerometer(IntertialEvent::Gyroscope(
InertialInput {
x: state.pitch.to_primitive() as f64 * DS5_GYRO_TO_RADS,
y: state.yaw.to_primitive() as f64 * DS5_GYRO_TO_RADS,
z: state.roll.to_primitive() as f64 * DS5_GYRO_TO_RADS,
},
)));

Expand Down
18 changes: 9 additions & 9 deletions src/drivers/dualsense/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[derive(Clone, Debug)]
pub enum Event {
Button(ButtonEvent),
Accelerometer(AccelerometerEvent),
Accelerometer(IntertialEvent),
Axis(AxisEvent),
Trigger(TriggerEvent),
}
Expand Down Expand Up @@ -78,18 +78,18 @@ pub enum TriggerEvent {
R2(TriggerInput),
}

/// AccelerometerInput represents the state of the accelerometer (x, y, z) values
/// InertialInput represents the state of the IMU (x, y, z) values
#[derive(Clone, Debug)]
pub struct AccelerometerInput {
pub x: i16,
pub y: i16,
pub z: i16,
pub struct InertialInput {
pub x: f64,
pub y: f64,
pub z: f64,
}

/// AccelerometerEvent has data from the accelerometer
#[derive(Clone, Debug)]
pub enum AccelerometerEvent {
Accelerometer(AccelerometerInput),
pub enum IntertialEvent {
Accelerometer(InertialInput),
/// Pitch, yaw, roll
Gyro(AccelerometerInput),
Gyroscope(InertialInput),
}
2 changes: 1 addition & 1 deletion src/drivers/dualsense/hid_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{error::Error, fmt::Display};

use packed_struct::prelude::*;

use super::driver::*;
use super::{INPUT_REPORT_BT, INPUT_REPORT_BT_SIZE, INPUT_REPORT_USB, INPUT_REPORT_USB_SIZE};

/// DualSense input report for USB and Bluetooth
#[derive(Debug, Copy, Clone)]
Expand Down
Loading
Loading