Skip to content

Commit

Permalink
fix(CompositeDevice): create target devices outside of composite devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Feb 16, 2024
1 parent 51b6a3c commit 4d2a2ed
Show file tree
Hide file tree
Showing 18 changed files with 509 additions and 220 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

10 changes: 6 additions & 4 deletions rootfs/usr/share/inputplumber/devices/gamepads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ source_devices:
evdev:
handler: js*

# The target input device(s) that the virtual device profile can use
target_devices:
- gamepad
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
event_map_id: xb360

# The default output device that the virtual device profile should use if
# 'auto' is selected.
output_device: gamepad
10 changes: 6 additions & 4 deletions rootfs/usr/share/inputplumber/devices/onexplayer_amd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ source_devices:
name: AT Translated Set 2 keyboard
phys_path: isa0060/serio0/input0

# The target input device(s) that the virtual device profile can use
target_devices:
- gamepad
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
event_map_id: oxp2

# The default output device that the virtual device profile should use if
# 'auto' is selected.
output_device: gamepad
9 changes: 6 additions & 3 deletions rootfs/usr/share/inputplumber/devices/onexplayer_intel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ source_devices:
name: AT Translated Set 2 keyboard
phys_path: isa0060/serio0/input0

# The target input device(s) that the virtual device profile can use
target_devices:
- gamepad
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
event_map_id: oxp1

# Default output device
output_device: gamepad
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ source_devices:
name: AT Translated Set 2 keyboard
phys_path: isa0060/serio0/input0

# The target input device(s) that the virtual device profile can use
target_devices:
- gamepad
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
event_map_id: oxp3
10 changes: 6 additions & 4 deletions rootfs/usr/share/inputplumber/devices/steam_deck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ source_devices:
product_id: 0x1205
interface_num: 2

# The target input device(s) that the virtual device profile can use
target_devices:
- gamepad
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
event_map_id: deck

# The default output device that the virtual device profile should use if
# 'auto' is selected.
output_device: gamepad
10 changes: 6 additions & 4 deletions rootfs/usr/share/inputplumber/devices/xbox360.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ source_devices:
evdev:
name: Xbox 360 Wireless Receiver (XBOX)

# The target input device(s) that the virtual device profile can use
target_devices:
- gamepad
- mouse
- keyboard

# The ID of a device event mapping in the 'event_maps' folder
event_map_id: xb360

# The default output device that the virtual device profile should use if
# 'auto' is selected.
output_device: gamepad
19 changes: 12 additions & 7 deletions rootfs/usr/share/inputplumber/schema/composite_device_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@
"description": "The ID of a device event mapping in the 'event_maps' directory",
"type": "string"
},
"output_device": {
"description": "Output device to emulate",
"type": "string",
"enum": [
"gamepad",
"xb360"
]
"target_devices": {
"description": "Target input device(s) to emulate. Can be one of ['mouse', 'keyboard', 'gamepad', 'xb360'].",
"type": "array",
"items": {
"type": "string",
"enum": [
"mouse",
"keyboard",
"gamepad",
"xb360"
]
}
}
},
"required": [
Expand Down
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ pub struct CompositeDeviceConfig {
pub kind: String,
pub name: String,
pub matches: Vec<Match>,
pub source_devices: Vec<SourceDevice>,
pub event_map_id: String,
pub output_device: Option<String>,
pub source_devices: Vec<SourceDevice>,
pub target_devices: Option<Vec<String>>,
}

impl CompositeDeviceConfig {
Expand Down
2 changes: 2 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pub const BUS_NAME: &str = "org.shadowblip.InputPlumber";
pub const BUS_PREFIX: &str = "/org/shadowblip/InputPlumber";
pub const BUS_SOURCES_PREFIX: &str = "/org/shadowblip/InputPlumber/devices/source";
pub const BUS_TARGETS_PREFIX: &str = "/org/shadowblip/InputPlumber/devices/target";
Loading

0 comments on commit 4d2a2ed

Please sign in to comment.