From 4c4ed17748bba25c652fbc673115e526f1b21dcc Mon Sep 17 00:00:00 2001 From: "Derek J. Clark" Date: Thu, 27 Aug 2026 14:05:52 -0700 Subject: [PATCH] fix(Hardware Support): Add OneXPlayer X2 Mini Pro Adds OneXPlayer X2 Mini Pro config. This device matches the X1 devices for the most part, with the exception that it has two hidraw endpoints for the controller. THe right controller uses bInterfaceNumber 00, so remove matching on IID in the hid-oxp driver --- .../capability_maps/onexplayer_type10.yaml | 34 ++++++++ .../capability_maps/onexplayer_type5.yaml | 2 +- .../devices/50-onexplayer_x2_mini_pro.yaml | 87 +++++++++++++++++++ src/drivers/oxp_hid/driver.rs | 19 ++-- src/drivers/oxp_hid/mod.rs | 11 +++ src/input/source/hidraw.rs | 5 +- 6 files changed, 139 insertions(+), 19 deletions(-) create mode 100644 rootfs/usr/share/inputplumber/capability_maps/onexplayer_type10.yaml create mode 100644 rootfs/usr/share/inputplumber/devices/50-onexplayer_x2_mini_pro.yaml diff --git a/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type10.yaml b/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type10.yaml new file mode 100644 index 00000000..a8f2197e --- /dev/null +++ b/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type10.yaml @@ -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: [] diff --git a/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type5.yaml b/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type5.yaml index 63e46c12..18bd58be 100644 --- a/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type5.yaml +++ b/rootfs/usr/share/inputplumber/capability_maps/onexplayer_type5.yaml @@ -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: [] diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_x2_mini_pro.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_x2_mini_pro.yaml new file mode 100644 index 00000000..f9b4dba9 --- /dev/null +++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_x2_mini_pro.yaml @@ -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 diff --git a/src/drivers/oxp_hid/driver.rs b/src/drivers/oxp_hid/driver.rs index a5f2cf8f..0a865ac4 100644 --- a/src/drivers/oxp_hid/driver.rs +++ b/src/drivers/oxp_hid/driver.rs @@ -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, diff --git a/src/drivers/oxp_hid/mod.rs b/src/drivers/oxp_hid/mod.rs index ee1b19b8..e192d539 100644 --- a/src/drivers/oxp_hid/mod.rs +++ b/src/drivers/oxp_hid/mod.rs @@ -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; diff --git a/src/input/source/hidraw.rs b/src/input/source/hidraw.rs index 5c8b1f44..29d9f586 100644 --- a/src/input/source/hidraw.rs +++ b/src/input/source/hidraw.rs @@ -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; }