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
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/ShadowBlip/InputPlumber/main/rootfs/usr/share/inputplumber/schema/capability_map_v1.json
# Schema version number
version: 1

# The type of configuration schema
kind: CapabilityMap

# Name for the device event map
name: OneXPlayer Type 10

# Unique identifier of the capability mapping
id: oxp10

# List of mapped events that are activated by a specific set of activation keys.
mapping:
- name: ONEX
source_events:
- keyboard: KeyLeftCtrl
- keyboard: KeyLeftAlt
- keyboard: KeyLeftMeta
target_event:
gamepad:
button: QuickAccess
- name: Keyboard
source_events:
- keyboard: KeyLeftCtrl
- keyboard: KeyLeftMeta
- keyboard: KeyO
target_event:
gamepad:
button: QuickAccess2

# List of events to filter from the source devices
filtered_events: []
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mapping:
button: Keyboard
target_event:
gamepad:
button: QuickAccess
button: QuickAccess2

# List of events to filter from the source devices
filtered_events: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/ShadowBlip/InputPlumber/main/rootfs/usr/share/inputplumber/schema/composite_device_v1.json
# Schema version number
version: 1

# The type of configuration schema
kind: CompositeDevice

# Name of the composite device mapping
name: ONEXPLAYER X2 Mini Pro

# Only allow a single source device per composite device of this type.
single_source: false

# Only use this profile if *any* of the given matches matches. If this list is
# empty, then the source devices will *always* be checked.
# /sys/class/dmi/id/product_name
matches:
- dmi_data:
product_name: ONEXPLAYER X2Mini PRO
sys_vendor: ONE-NETBOOK

# One or more source devices to combine into a single virtual device. The events
# from these devices will be watched and translated according to the key map.
source_devices:
- group: gamepad
evdev:
name: Microsoft X-Box 360 pad
phys_path: usb-0000:65:00.4-1.3/input0
handler: event*

- group: keyboard
evdev:
name: "HID 1a86:fe00"
phys_path: usb-0000:65:00.4-1.2/input0
handler: event*
events:
exclude:
- "*"
include:
- Keyboard:KeyLeftAlt
- Keyboard:KeyLeftCtrl
- Keyboard:KeyLeftMeta
- Keyboard:KeyO

- group: keyboard
evdev:
name: AT Translated Set 2 keyboard
phys_path: isa0060/serio0/input0
handler: event*
events:
exclude:
- "*"
include:
- Keyboard:KeyVolumeDown
- Keyboard:KeyVolumeUp

- group: gamepad
hidraw:
vendor_id: 0x1a86
product_id: 0xfe00
interface_num: 0

- group: gamepad
hidraw:
vendor_id: 0x1a86
product_id: 0xfe00
interface_num: 2

- group: imu
iio:
name: "{i2c-BMI0160:00,bmi260}"

# Optional configuration for the composite device
options:
# If true, InputPlumber will automatically try to manage the input device. If
# this is false, InputPlumber will not try to manage the device unless an
# external service enables management of the device. Defaults to 'false'
auto_manage: true

# The target input device(s) to emulate by default
target_devices:
- xbox-elite
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
capability_map_id: oxp10
19 changes: 5 additions & 14 deletions src/drivers/oxp_hid/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@ use std::ffi::CString;
use hidapi::HidDevice;
use packed_struct::prelude::*;

use super::event::{BinaryInput, ButtonEvent, Event};
use super::hid_report::{ButtonId, InputDataReport};

pub const VID: u16 = 0x1a86;
pub const PID: u16 = 0xfe00;
pub const IID: i32 = 0x02;

const PACKET_SIZE: usize = 64;

// HID buffer read timeout
const HID_TIMEOUT: i32 = 10;

// HID command IDs
const CMD_BUTTON: u8 = 0xB2;
use super::{
event::{BinaryInput, ButtonEvent, Event},
hid_report::{ButtonId, InputDataReport},
CMD_BUTTON, HID_TIMEOUT, PACKET_SIZE, PID, VID,
};

pub struct Driver {
device: HidDevice,
Expand Down
11 changes: 11 additions & 0 deletions src/drivers/oxp_hid/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
pub mod driver;
pub mod event;
pub mod hid_report;

pub const VID: u16 = 0x1a86;
pub const PID: u16 = 0xfe00;

const PACKET_SIZE: usize = 64;

// HID buffer read timeout
const HID_TIMEOUT: i32 = 10;

// HID command IDs
const CMD_BUTTON: u8 = 0xB2;
5 changes: 1 addition & 4 deletions src/input/source/hidraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,7 @@ impl HidRawDevice {
}

// OXP X1 HID Controller
if vid == drivers::oxp_hid::driver::VID
&& pid == drivers::oxp_hid::driver::PID
&& iid == drivers::oxp_hid::driver::IID
{
if vid == drivers::oxp_hid::VID && pid == drivers::oxp_hid::PID {
log::info!("Detected OXP X1 HID controller");
return DriverType::OxpHid;
}
Expand Down
Loading