diff --git a/PKGBUILD/inputplumber/003-add-configuration-option-to-auto_manage-devices.patch b/PKGBUILD/inputplumber/003-add-configuration-option-to-auto_manage-devices.patch new file mode 100644 index 0000000..9b10140 --- /dev/null +++ b/PKGBUILD/inputplumber/003-add-configuration-option-to-auto_manage-devices.patch @@ -0,0 +1,918 @@ +From bcc8d6f8f3dc571e54f0d0556af2fec01a658ed1 Mon Sep 17 00:00:00 2001 +From: William Edwards +Date: Sat, 21 Sep 2024 20:48:18 -0700 +Subject: [PATCH 1/2] fix(Service): remove 'After=graphical-session.target' in + systemd service + +--- + rootfs/usr/lib/systemd/system/inputplumber.service | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/rootfs/usr/lib/systemd/system/inputplumber.service b/rootfs/usr/lib/systemd/system/inputplumber.service +index ae25755e..58eb077c 100644 +--- a/rootfs/usr/lib/systemd/system/inputplumber.service ++++ b/rootfs/usr/lib/systemd/system/inputplumber.service +@@ -1,6 +1,5 @@ + [Unit] + Description=InputPlumber Service +-After=graphical-session.target + + [Service] + ExecStart=/usr/bin/inputplumber + +From b1936b922893a9b86f7abd67708aad370fcab620 Mon Sep 17 00:00:00 2001 +From: William Edwards +Date: Sat, 21 Sep 2024 22:17:07 -0700 +Subject: [PATCH 2/2] feat(Manager): add configuration option to auto-manage + devices and DBus property to toggle all device management + +--- + .../devices/50-anbernic_win600.yaml | 7 ++ + .../inputplumber/devices/50-aokzoe_a1.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_2.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_2021.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_2s.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_air.yaml | 7 ++ + .../devices/50-ayaneo_air_1s.yaml | 7 ++ + .../devices/50-ayaneo_air_plus.yaml | 7 ++ + .../devices/50-ayaneo_air_plus_mendo.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_flip.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_kun.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_next.yaml | 7 ++ + .../inputplumber/devices/50-ayaneo_slide.yaml | 7 ++ + .../inputplumber/devices/50-ayn_loki_max.yaml | 7 ++ + .../devices/50-ayn_loki_mini_pro.yaml | 7 ++ + .../devices/50-ayn_loki_zero.yaml | 7 ++ + .../inputplumber/devices/50-gpd_win3.yaml | 7 ++ + .../inputplumber/devices/50-gpd_win4.yaml | 7 ++ + .../inputplumber/devices/50-gpd_winmax2.yaml | 7 ++ + .../inputplumber/devices/50-gpd_winmini.yaml | 7 ++ + .../inputplumber/devices/50-legion_go.yaml | 7 ++ + .../inputplumber/devices/50-msi_claw.yaml | 7 ++ + .../inputplumber/devices/50-onexplayer_2.yaml | 7 ++ + .../devices/50-onexplayer_amd.yaml | 7 ++ + .../devices/50-onexplayer_intel.yaml | 7 ++ + .../devices/50-onexplayer_mini_a07.yaml | 7 ++ + .../devices/50-onexplayer_mini_pro.yaml | 7 ++ + .../devices/50-onexplayer_onexfly.yaml | 7 ++ + .../inputplumber/devices/50-orangepi_neo.yaml | 7 ++ + .../inputplumber/devices/50-rog_ally.yaml | 7 ++ + .../inputplumber/devices/50-rog_ally_x.yaml | 7 ++ + .../inputplumber/devices/50-steam_deck.yaml | 7 ++ + .../schema/composite_device_v1.json | 16 +++ + src/config/mod.rs | 13 ++- + src/dbus/interface/manager.rs | 31 +++++ + src/input/manager.rs | 106 ++++++++++++++++-- + 36 files changed, 379 insertions(+), 11 deletions(-) + +diff --git a/rootfs/usr/share/inputplumber/devices/50-anbernic_win600.yaml b/rootfs/usr/share/inputplumber/devices/50-anbernic_win600.yaml +index ef5ecaa5..21474110 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-anbernic_win600.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-anbernic_win600.yaml +@@ -33,6 +33,13 @@ source_devices: + phys_path: isa0060/serio0/input0 + handler: event* + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-aokzoe_a1.yaml b/rootfs/usr/share/inputplumber/devices/50-aokzoe_a1.yaml +index b7f2134f..a74062e7 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-aokzoe_a1.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-aokzoe_a1.yaml +@@ -44,6 +44,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_2.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_2.yaml +index 19044b2c..851a1e99 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_2.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_2.yaml +@@ -48,6 +48,13 @@ source_devices: + y: [0, 0, -1] + z: [1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_2021.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_2021.yaml +index f48c8af0..34a3575b 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_2021.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_2021.yaml +@@ -52,6 +52,13 @@ source_devices: + y: [0, 0, -1] + z: [1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_2s.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_2s.yaml +index f0bdfbd8..11b20ddd 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_2s.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_2s.yaml +@@ -48,6 +48,13 @@ source_devices: + y: [0, 0, -1] + z: [1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air.yaml +index 4abf518c..7fbbd392 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air.yaml +@@ -43,6 +43,13 @@ source_devices: + # y: [0, 0, -1] + # z: [1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_1s.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_1s.yaml +index ebe41899..13447ef8 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_1s.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_1s.yaml +@@ -44,6 +44,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus.yaml +index 222f986c..b9d27a37 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus.yaml +@@ -55,6 +55,13 @@ source_devices: + y: [0, 0, 1] + z: [-1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus_mendo.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus_mendo.yaml +index 5458fc54..cde4967e 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus_mendo.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_air_plus_mendo.yaml +@@ -46,6 +46,13 @@ source_devices: + y: [0, 0, 1] + z: [-1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_flip.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_flip.yaml +index e4eaeb26..2571b0e3 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_flip.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_flip.yaml +@@ -48,6 +48,13 @@ source_devices: + y: [0, 0, -1] + z: [1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_kun.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_kun.yaml +index c1b21f72..f5d4c001 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_kun.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_kun.yaml +@@ -41,6 +41,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_next.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_next.yaml +index 238068f8..ee0f75a2 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_next.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_next.yaml +@@ -58,6 +58,13 @@ source_devices: + y: [0, 0, -1] + z: [1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayaneo_slide.yaml b/rootfs/usr/share/inputplumber/devices/50-ayaneo_slide.yaml +index 125a55ba..8c9bf4dc 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayaneo_slide.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayaneo_slide.yaml +@@ -41,6 +41,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayn_loki_max.yaml b/rootfs/usr/share/inputplumber/devices/50-ayn_loki_max.yaml +index 6b2838f9..269785b1 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayn_loki_max.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayn_loki_max.yaml +@@ -40,6 +40,13 @@ source_devices: + y: [0, 0, -1] + z: [0, 1, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayn_loki_mini_pro.yaml b/rootfs/usr/share/inputplumber/devices/50-ayn_loki_mini_pro.yaml +index bee3bdf2..7e0efeac 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayn_loki_mini_pro.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayn_loki_mini_pro.yaml +@@ -40,6 +40,13 @@ source_devices: + y: [0, 0, -1] + z: [0, 1, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-ayn_loki_zero.yaml b/rootfs/usr/share/inputplumber/devices/50-ayn_loki_zero.yaml +index bb6b5be9..047f7d03 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-ayn_loki_zero.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-ayn_loki_zero.yaml +@@ -40,6 +40,13 @@ source_devices: + # y: [0, 0, -1] + # z: [0, 1, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-gpd_win3.yaml b/rootfs/usr/share/inputplumber/devices/50-gpd_win3.yaml +index fbb54c57..a995aaa8 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-gpd_win3.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-gpd_win3.yaml +@@ -36,6 +36,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-gpd_win4.yaml b/rootfs/usr/share/inputplumber/devices/50-gpd_win4.yaml +index f49edf7d..4882a0bd 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-gpd_win4.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-gpd_win4.yaml +@@ -36,6 +36,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-gpd_winmax2.yaml b/rootfs/usr/share/inputplumber/devices/50-gpd_winmax2.yaml +index d1651f14..2f332d78 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-gpd_winmax2.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-gpd_winmax2.yaml +@@ -36,6 +36,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-gpd_winmini.yaml b/rootfs/usr/share/inputplumber/devices/50-gpd_winmini.yaml +index 41f4152d..3fb6ad64 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-gpd_winmini.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-gpd_winmini.yaml +@@ -36,6 +36,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-legion_go.yaml b/rootfs/usr/share/inputplumber/devices/50-legion_go.yaml +index 208556a3..16251bf8 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-legion_go.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-legion_go.yaml +@@ -149,6 +149,13 @@ source_devices: + y: [0, 0, -1] + z: [-1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-msi_claw.yaml b/rootfs/usr/share/inputplumber/devices/50-msi_claw.yaml +index 189e2ebb..a0e38bd4 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-msi_claw.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-msi_claw.yaml +@@ -51,6 +51,13 @@ source_devices: + y: [0, 0, -1] + z: [-1, 0, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_2.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_2.yaml +index 2a9a536b..dd205f93 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-onexplayer_2.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_2.yaml +@@ -47,6 +47,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_amd.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_amd.yaml +index 2a164b32..a9f78052 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-onexplayer_amd.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_amd.yaml +@@ -58,6 +58,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_intel.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_intel.yaml +index 54dc8336..8eba4cf8 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-onexplayer_intel.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_intel.yaml +@@ -38,6 +38,13 @@ source_devices: + phys_path: isa0060/serio0/input0 + handler: event* + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_a07.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_a07.yaml +index 8d8206af..1cdb44b9 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_a07.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_a07.yaml +@@ -37,6 +37,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_pro.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_pro.yaml +index caf772b4..4e64ec40 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_pro.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_mini_pro.yaml +@@ -36,6 +36,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-onexplayer_onexfly.yaml b/rootfs/usr/share/inputplumber/devices/50-onexplayer_onexfly.yaml +index 171bca88..5e4054aa 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-onexplayer_onexfly.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-onexplayer_onexfly.yaml +@@ -36,6 +36,13 @@ source_devices: + iio: + name: i2c-BMI0160:00 + ++# 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) that the virtual device profile can use + target_devices: + - xb360 +diff --git a/rootfs/usr/share/inputplumber/devices/50-orangepi_neo.yaml b/rootfs/usr/share/inputplumber/devices/50-orangepi_neo.yaml +index 8269056b..c60e69c8 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-orangepi_neo.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-orangepi_neo.yaml +@@ -65,6 +65,13 @@ source_devices: + y: [0, 0, -1] + z: [0, -1, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-rog_ally.yaml b/rootfs/usr/share/inputplumber/devices/50-rog_ally.yaml +index 65164ca1..55ea482c 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-rog_ally.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-rog_ally.yaml +@@ -54,6 +54,13 @@ source_devices: + y: [0, 0, -1] + z: [0, 1, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-rog_ally_x.yaml b/rootfs/usr/share/inputplumber/devices/50-rog_ally_x.yaml +index a93568e9..ad42f5ce 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-rog_ally_x.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-rog_ally_x.yaml +@@ -53,6 +53,13 @@ source_devices: + y: [0, 0, -1] + z: [0, 1, 0] + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/devices/50-steam_deck.yaml b/rootfs/usr/share/inputplumber/devices/50-steam_deck.yaml +index a2ee38a9..d6fe0810 100644 +--- a/rootfs/usr/share/inputplumber/devices/50-steam_deck.yaml ++++ b/rootfs/usr/share/inputplumber/devices/50-steam_deck.yaml +@@ -51,6 +51,13 @@ source_devices: + phys_path: isa0060/serio0/input0 + handler: event* + ++# 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) that the virtual device profile can use + target_devices: + - xbox-elite +diff --git a/rootfs/usr/share/inputplumber/schema/composite_device_v1.json b/rootfs/usr/share/inputplumber/schema/composite_device_v1.json +index ddfe3916..5fab4ce9 100644 +--- a/rootfs/usr/share/inputplumber/schema/composite_device_v1.json ++++ b/rootfs/usr/share/inputplumber/schema/composite_device_v1.json +@@ -42,6 +42,9 @@ + "description": "The ID of a device event mapping in the 'capability_maps' directory", + "type": "string" + }, ++ "options": { ++ "$ref": "#/definitions/Options" ++ }, + "target_devices": { + "description": "Target input device(s) to emulate. Can be one of ['mouse', 'keyboard', 'gamepad', 'xb360', 'xbox-elite', 'xbox-series', 'deck', 'ds5', 'ds5-edge', 'touchscreen', 'touchpad'].", + "type": "array", +@@ -72,6 +75,19 @@ + ], + "title": "CompositeDevice" + }, ++ "Options": { ++ "description": "Optional configuration for the composite device", ++ "type": "object", ++ "additionalProperties": false, ++ "properties": { ++ "auto_manage": { ++ "description": "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'", ++ "type": "boolean", ++ "default": false ++ } ++ }, ++ "title": "Options" ++ }, + "Match": { + "description": "Only use this configuration if *any* of the given items match the system. If this list is empty, then matching source devices will always create a CompositeDevice.", + "type": "object", +diff --git a/src/config/mod.rs b/src/config/mod.rs +index 583fe90b..6b0c7b55 100644 +--- a/src/config/mod.rs ++++ b/src/config/mod.rs +@@ -268,7 +268,17 @@ pub struct TouchMotionCapability { + pub speed_pps: Option, + } + +-/// Defines a platform match for loading a [CompositeDevice] ++/// Defines available options for loading a [CompositeDeviceConfig] ++#[derive(Debug, Deserialize, Clone, PartialEq)] ++#[serde(rename_all = "snake_case")] ++pub struct CompositeDeviceConfigOptions { ++ /// 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 all devices. ++ pub auto_manage: Option, ++} ++ ++/// Defines a platform match for loading a [CompositeDeviceConfig] + #[derive(Debug, Deserialize, Clone, PartialEq)] + #[serde(rename_all = "snake_case")] + pub struct Match { +@@ -352,6 +362,7 @@ pub struct CompositeDeviceConfig { + pub capability_map_id: Option, + pub source_devices: Vec, + pub target_devices: Option>, ++ pub options: Option, + } + + impl CompositeDeviceConfig { +diff --git a/src/dbus/interface/manager.rs b/src/dbus/interface/manager.rs +index ee634341..030c7180 100644 +--- a/src/dbus/interface/manager.rs ++++ b/src/dbus/interface/manager.rs +@@ -29,6 +29,37 @@ impl ManagerInterface { + Ok("InputPlumber".to_string()) + } + ++ /// If set to 'true', InputPlumber will try to manage all input devices ++ /// on the system that have a Composite Device configuration. ++ #[zbus(property)] ++ async fn manage_all_devices(&self) -> fdo::Result { ++ let (sender, mut receiver) = mpsc::channel(1); ++ self.tx ++ .send_timeout( ++ ManagerCommand::GetManageAllDevices { sender }, ++ Duration::from_millis(500), ++ ) ++ .await ++ .map_err(|err| fdo::Error::Failed(err.to_string()))?; ++ ++ // Read the response from the manager ++ let Some(response) = receiver.recv().await else { ++ return Err(fdo::Error::Failed("No response from manager".to_string())); ++ }; ++ Ok(response) ++ } ++ #[zbus(property)] ++ async fn set_manage_all_devices(&self, value: bool) -> zbus::Result<()> { ++ self.tx ++ .send_timeout( ++ ManagerCommand::SetManageAllDevices(value), ++ Duration::from_millis(500), ++ ) ++ .await ++ .map_err(|err| zbus::Error::Failure(err.to_string()))?; ++ Ok(()) ++ } ++ + /// Returns a list of supported target device names. E.g. ["InputPlumber Mouse", "Microsoft + /// XBox 360 Gamepad"] + #[zbus(property)] +diff --git a/src/input/manager.rs b/src/input/manager.rs +index d094ca49..6c9b3a6f 100644 +--- a/src/input/manager.rs ++++ b/src/input/manager.rs +@@ -89,6 +89,10 @@ pub enum ManagerCommand { + path: String, + }, + CompositeDeviceStopped(String), ++ GetManageAllDevices { ++ sender: mpsc::Sender, ++ }, ++ SetManageAllDevices(bool), + } + + /// Manages input devices +@@ -142,6 +146,9 @@ pub struct Manager { + /// Mapping of target devices to their respective handles + /// E.g. {"/org/shadowblip/InputPlumber/devices/target/dbus0": } + target_devices: HashMap, ++ /// Defines whether or not InputPlumber should try to automatically manage all ++ /// input devices that have a [CompositeDeviceConfig] definition ++ manage_all_devices: bool, + } + + impl Manager { +@@ -177,6 +184,7 @@ impl Manager { + used_configs: HashMap::new(), + composite_device_sources: HashMap::new(), + composite_device_targets: HashMap::new(), ++ manage_all_devices: false, + } + } + +@@ -291,6 +299,48 @@ impl Manager { + log::error!("Error removing device: {e:?}"); + } + } ++ ManagerCommand::SetManageAllDevices(manage_all_devices) => { ++ log::debug!("Setting management of all devices to: {manage_all_devices}"); ++ if self.manage_all_devices == manage_all_devices { ++ continue; ++ } ++ self.manage_all_devices = manage_all_devices; ++ ++ // If management of all devices was enabled, trigger device discovery ++ if manage_all_devices { ++ let cmd_tx = self.tx.clone(); ++ tokio::task::spawn(async move { ++ if let Err(e) = Manager::discover_all_devices(&cmd_tx).await { ++ log::error!("Failed to trigger device discovery: {e:?}"); ++ } ++ }); ++ continue; ++ } ++ ++ // If management was disabled, stop any composite devices that ++ // are not auto-managed. ++ for (dbus_path, config) in self.used_configs.iter() { ++ if let Some(options) = config.options.as_ref() { ++ let auto_managed = options.auto_manage.unwrap_or(false); ++ if auto_managed { ++ continue; ++ } ++ } ++ ++ log::debug!("Found composite device that should not be managed anymore: {dbus_path}"); ++ let Some(device) = self.composite_devices.get(dbus_path) else { ++ continue; ++ }; ++ if let Err(e) = device.stop().await { ++ log::error!("Failed to stop composite device: {e:?}"); ++ } ++ } ++ } ++ ManagerCommand::GetManageAllDevices { sender } => { ++ if let Err(e) = sender.send(self.manage_all_devices).await { ++ log::error!("Failed to send response: {e:?}"); ++ } ++ } + } + } + +@@ -822,6 +872,22 @@ impl Manager { + for config in configs { + log::trace!("Checking config {:?} for device", config.name); + ++ // Check to see if 'auto_manage' is enabled for this config. ++ let auto_manage = { ++ if let Some(options) = config.options.as_ref() { ++ options.auto_manage.unwrap_or(false) ++ } else { ++ false ++ } ++ }; ++ if !self.manage_all_devices && !auto_manage { ++ log::trace!( ++ "Config {:?} does not have 'auto_manage' option enabled. Skipping.", ++ config.name ++ ); ++ continue; ++ } ++ + // Check to see if this configuration matches the system + if !config.has_valid_matches(&self.dmi_data, &self.cpu_info) { + log::trace!("Configuration does not match system"); +@@ -1327,17 +1393,14 @@ impl Manager { + async fn watch_input_devices(&self) -> Result<(), Box> { + log::debug!("Performing initial input device discovery"); + let cmd_tx = self.tx.clone(); +- let hidraw_devices = udev::discover_devices("hidraw")?; +- let hidraw_devices = hidraw_devices.into_iter().map(|dev| dev.into()).collect(); +- Manager::discover_devices(&cmd_tx, hidraw_devices).await?; +- let event_devices = udev::discover_devices("input")?; +- let event_devices = event_devices.into_iter().map(|dev| dev.into()).collect(); +- Manager::discover_devices(&cmd_tx, event_devices).await?; +- let iio_devices = udev::discover_devices("iio")?; +- let iio_devices = iio_devices.into_iter().map(|dev| dev.into()).collect(); +- Manager::discover_devices(&cmd_tx, iio_devices).await?; ++ task::spawn(async move { ++ if let Err(e) = Manager::discover_all_devices(&cmd_tx).await { ++ log::error!("Failed to perform initial device discovery: {e:?}"); ++ } ++ }); + + // Watch for IIO device events. ++ let cmd_tx = self.tx.clone(); + task::spawn_blocking(move || { + let mut monitor = MonitorBuilder::new()?.match_subsystem("iio")?.listen()?; + +@@ -1489,6 +1552,23 @@ impl Manager { + Ok(()) + } + ++ /// Performs initial input device discovery of all supported subsystems ++ async fn discover_all_devices( ++ cmd_tx: &mpsc::Sender, ++ ) -> Result<(), Box> { ++ let hidraw_devices = udev::discover_devices("hidraw")?; ++ let hidraw_devices = hidraw_devices.into_iter().map(|dev| dev.into()).collect(); ++ Manager::discover_devices(cmd_tx, hidraw_devices).await?; ++ let event_devices = udev::discover_devices("input")?; ++ let event_devices = event_devices.into_iter().map(|dev| dev.into()).collect(); ++ Manager::discover_devices(cmd_tx, event_devices).await?; ++ let iio_devices = udev::discover_devices("iio")?; ++ let iio_devices = iio_devices.into_iter().map(|dev| dev.into()).collect(); ++ Manager::discover_devices(cmd_tx, iio_devices).await?; ++ ++ Ok(()) ++ } ++ + async fn discover_devices( + manager_tx: &mpsc::Sender, + devices: Vec, +@@ -1607,7 +1687,13 @@ impl Manager { + async fn listen_on_dbus(&self) -> Result<(), Box> { + let iface = ManagerInterface::new(self.tx.clone()); + let manager_path = format!("{}/Manager", BUS_PREFIX); +- self.dbus.object_server().at(manager_path, iface).await?; ++ let dbus = self.dbus.clone(); ++ task::spawn(async move { ++ if let Err(e) = dbus.object_server().at(manager_path, iface).await { ++ log::error!("Failed create manager dbus interface: {e:?}"); ++ } ++ }); ++ + Ok(()) + } + diff --git a/PKGBUILD/inputplumber/PKGBUILD b/PKGBUILD/inputplumber/PKGBUILD index 284772b..4768795 100644 --- a/PKGBUILD/inputplumber/PKGBUILD +++ b/PKGBUILD/inputplumber/PKGBUILD @@ -3,7 +3,7 @@ pkgname=inputplumber _pkgbase=inputplumber pkgver=0.35.4 -pkgrel=1 +pkgrel=4 pkgdesc="Open source input router and remapper daemon for Linux" arch=('x86_64') url="https://github.com/ShadowBlip/InputPlumber" @@ -15,6 +15,7 @@ conflicts=('inputplumber-bin') source=("${_pkgbase}::git+https://github.com/ShadowBlip/${_pkgbase}.git" 001-no-rootfs.patch 002-enable-gyro-air_zero.patch + 003-add-configuration-option-to-auto_manage-devices.patch ) options=(!lto) @@ -22,6 +23,7 @@ options=(!lto) sha256sums=('SKIP' 'f7a36eda6757af5d62a7a948615954df8654ba9680b2987df24ba20d97b17e0d' # 001-no-rootfs.patch '2b7c306d0846e21d3e6a181fba62db04edaabc804bcddde4ee158d902c8ef27f' # 002-enable-gyro-air_zero.patch + '8d6d74acb8df27457a5ba410d6fad9f30e6b4792638577dc91b7046431948395' # 003-add-configuration-option-to-auto_manage-devices.patch ) prepare() {