Skip to content

Commit

Permalink
feat(XBOne BT): add support for XBox One Bluetooth controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Aug 5, 2024
1 parent 9df002f commit 8f9c03d
Show file tree
Hide file tree
Showing 8 changed files with 599 additions and 202 deletions.
37 changes: 37 additions & 0 deletions rootfs/usr/share/inputplumber/devices/60-xbox_one_bt_gamepad.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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: Microsoft X-Box One pad

# 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: []

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

# 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
blocked: true
evdev:
vendor_id: "045e"
product_id: "0b13"
handler: event*
- group: gamepad
hidraw:
vendor_id: 0x045e
product_id: 0x0b13

# The target input device(s) that the virtual device profile can use
target_devices:
- xbox-series
- mouse
- keyboard
290 changes: 252 additions & 38 deletions rootfs/usr/share/inputplumber/schema/capability_map_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,31 @@
"title": "CapabilityMap"
},
"Mapping": {
"title": "Mapping",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"source_events": {
"source_event": {
"$ref": "#/definitions/Event"
},
"target_events": {
"type": "array",
"items": {
"$ref": "#/definitions/Capability"
"$ref": "#/definitions/Event"
}
},
"target_event": {
"$ref": "#/definitions/Capability"
}
},
"required": [
"name",
"source_events",
"target_event"
],
"title": "Mapping"
"source_event",
"target_events"
]
},
"Capability": {
"Event": {
"title": "Event",
"type": "object",
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -233,30 +234,174 @@
"KeyProg1"
]
},
"mouse": {
"$ref": "#/definitions/MouseEvent"
},
"touchpad": {
"$ref": "#/definitions/TouchpadEvent"
},
"touchscreen": {
"$ref": "#/definitions/TouchEvent"
},
"dbus": {
"type": "string",
"enum": [
"ui_guide",
"ui_quick",
"ui_context",
"ui_option",
"ui_select",
"ui_accept",
"ui_back",
"ui_action",
"ui_left",
"ui_right",
"ui_up",
"ui_down",
"ui_l1",
"ui_l2",
"ui_l3",
"ui_r1",
"ui_r2",
"ui_r3",
"ui_volume_up",
"ui_volume_down",
"ui_volume_mute",
"ui_osk",
"ui_screenshot",
"ui_touch"
]
},
"gamepad": {
"$ref": "#/definitions/GamepadCapability"
"$ref": "#/definitions/GamepadEvent"
}
},
"required": []
},
"MouseEvent": {
"title": "MouseEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"motion": {
"$ref": "#/definitions/MouseMotionEvent"
},
"mouse": {
"$ref": "#/definitions/MouseCapability"
"button": {
"type": "string",
"enum": [
"Left",
"Right",
"Middle",
"WheelUp",
"WheelDown",
"WheelLeft",
"WheelRight",
"Extra1",
"Extra2"
]
}
},
"title": "Capability"
"required": []
},
"GamepadCapability": {
"MouseMotionEvent": {
"title": "MouseMotionEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"axis": {
"direction": {
"type": "string",
"enum": [
"LeftStick",
"RightStick",
"Hat0",
"Hat1",
"Hat2",
"Hat3"
"horizontal",
"vertical",
"left",
"right",
"up",
"down"
]
},
"speed_pps": {
"type": "number",
"description": "Speed of the target motion event in pixels per second",
"default": 800
}
}
},
"TouchpadEvent": {
"title": "TouchpadEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"LeftPad",
"RightPad",
"CenterPad"
]
},
"touch": {
"$ref": "#/definitions/TouchEvent"
}
}
},
"TouchEvent": {
"title": "TouchEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"motion": {
"$ref": "#/definitions/TouchMotionEvent"
},
"button": {
"type": "string",
"enum": [
"Touch",
"Press"
]
}
},
"required": []
},
"TouchMotionEvent": {
"title": "TouchMotionEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"region": {
"type": "string",
"description": "Map from a specific region of the touch device",
"enum": [
"left",
"right",
"top",
"bottom",
"top-left",
"top-right",
"bottom-left",
"bottom-right"
]
},
"speed_pps": {
"type": "number",
"description": "Speed of the target motion event in pixels per second",
"default": 800
}
}
},
"GamepadEvent": {
"title": "GamepadEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"axis": {
"$ref": "#/definitions/AxisEvent"
},
"gyro": {
"$ref": "#/definitions/GyroEvent"
},
"trigger": {
"$ref": "#/definitions/TriggerEvent"
},
"button": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -296,8 +441,55 @@
"Start",
"West"
]
}
},
"required": []
},
"GyroEvent": {
"title": "GyroEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"Gyro1",
"Gyro2",
"Gyro3"
]
},
"trigger": {
"direction": {
"type": "string",
"enum": [
"positive",
"negative"
]
},
"deadzone": {
"type": "number",
"default": 0.3,
"description": "Optional deadzone from 0.0 - 1.0. When this deadzone threshold is crossed, this input is considered 'pressed'."
},
"axis": {
"type": "string",
"description": "Pitch, roll, or yaw",
"enum": [
"pitch",
"roll",
"yaw"
]
}
},
"required": [
"name"
]
},
"TriggerEvent": {
"title": "TriggerEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"LeftTrigger",
Expand All @@ -307,33 +499,55 @@
"RightTouchpadForce",
"RightStickForce"
]
},
"deadzone": {
"type": "number",
"default": 0.3,
"description": "Optional deadzone from 0.0 - 1.0. When this deadzone threshold is crossed, this input is considered 'pressed'."
}
},
"title": "GamepadCapability"
"required": [
"name"
]
},
"MouseCapability": {
"AxisEvent": {
"title": "AxisEvent",
"type": "object",
"description": "Axis events such as LeftStick, RightStick, etc.",
"additionalProperties": false,
"properties": {
"button": {
"name": {
"type": "string",
"enum": [
"Left",
"Right",
"Middle",
"WheelUp",
"WheelDown",
"WheelLeft",
"WheelRight",
"Extra1",
"Extra2"
"LeftStick",
"RightStick",
"Hat0",
"Hat1",
"Hat2",
"Hat3"
]
},
"motion": {
"type": "string"
"direction": {
"type": "string",
"description": "Optional direction of the axis. Used when converting axis events into button events.",
"enum": [
"horizontal",
"vertical",
"left",
"right",
"up",
"down"
]
},
"deadzone": {
"type": "number",
"default": 0.3,
"description": "Optional deadzone from 0.0 - 1.0. When this deadzone threshold is crossed, this input is considered 'pressed'."
}
},
"title": "Mouse"
"required": [
"name"
]
}
}
}
Loading

0 comments on commit 8f9c03d

Please sign in to comment.