diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index de3e221d..9e138ccb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -28,7 +28,6 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly with: - token: ${{ secrets.GITHUB_TOKEN }} components: clippy - run: cargo clippy --all tests: @@ -45,6 +44,5 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - token: ${{ secrets.GITHUB_TOKEN }} toolchain: ${{ matrix.rust }} - run: cargo build --all diff --git a/Cargo.lock b/Cargo.lock index 93e91517..b9b8d9c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5189,7 +5189,6 @@ dependencies = [ "csscolorparser", "ctrlc", "dbus", - "dbus-tokio", "eruption-sdk", "eyre", "flume", diff --git a/eruption/Cargo.toml b/eruption/Cargo.toml index 635db041..bdf30946 100644 --- a/eruption/Cargo.toml +++ b/eruption/Cargo.toml @@ -38,13 +38,7 @@ resolver = "2" [features] default = ["dbus-ipc", "openrgb_bridge", "udev", "evdev-rs"] -windows = [ - "dbus-ipc", - "winapi", - "usb_enumeration", - "windows-named-pipe", - "hwaccel", -] +windows = ["dbus-ipc", "winapi", "usb_enumeration", "windows-named-pipe"] dbus-ipc = ["dbus", "dbus-tree"] mimalloc_allocator = ["mimalloc"] openrgb_bridge = ["openrgb"] diff --git a/eruption/src/hwdevices.rs b/eruption/src/hwdevices.rs index 895ff8cb..e8e1c87a 100644 --- a/eruption/src/hwdevices.rs +++ b/eruption/src/hwdevices.rs @@ -26,6 +26,7 @@ use std::u8; use std::{any::Any, sync::Arc, thread}; use std::{path::PathBuf, time::Duration}; +use cfg_if::cfg_if; #[cfg(not(target_os = "windows"))] use evdev_rs::enums::EV_KEY; use eyre::eyre; @@ -41,6 +42,7 @@ use udev::Enumerator; use crate::constants; use crate::hwdevices::{keyboards::*, mice::*, misc::*}; +use crate::util::ratelimited; mod util; @@ -1058,7 +1060,9 @@ pub trait DeviceExt: DeviceInfoExt + DeviceZoneAllocationExt { /// Get the device status fn device_status(&self) -> Result; + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>>; + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>); fn get_device_class(&self) -> DeviceClass; @@ -1285,27 +1289,33 @@ pub fn probe_devices() -> Result> { for device in declared_devices { if device.class == "openrgb" { - info!( - "Binding device: {} ({})", - device.name, - device.device_file.display() - ); + cfg_if! { + if #[cfg(openrgb_bridge )] { + info!( + "Binding device: {} ({})", + device.name, + device.device_file.display() + ); + + { + let mut pending_devices = crate::DEVICES_PENDING_INIT.0.lock().unwrap(); + *pending_devices += 1; + + crate::DEVICES_PENDING_INIT.1.notify_all(); + } - { - let mut pending_devices = crate::DEVICES_PENDING_INIT.0.lock().unwrap(); - *pending_devices += 1; + let device = openrgb_bridge::OpenRgbBridge::bind( + device.device_file.to_string_lossy().to_string(), + ); - crate::DEVICES_PENDING_INIT.1.notify_all(); + // non pnp devices are currently always 'misc' devices + devices.push(Arc::new(RwLock::new( + Box::new(device) as Box + ))); + } else { + ratelimited::warn!("The OpenRGB virtual bridge device is not available in this build of Eruption"); + } } - - let device = openrgb_bridge::OpenRgbBridge::bind( - device.device_file.to_string_lossy().to_string(), - ); - - // non pnp devices are currently always 'misc' devices - devices.push(Arc::new(RwLock::new( - Box::new(device) as Box - ))); } else if device.class == "serial" { info!( "Binding non-pnp serial LEDs device: {} ({})", diff --git a/eruption/src/hwdevices/keyboards/corsair_strafe.rs b/eruption/src/hwdevices/keyboards/corsair_strafe.rs index c59ef63b..def4f41b 100644 --- a/eruption/src/hwdevices/keyboards/corsair_strafe.rs +++ b/eruption/src/hwdevices/keyboards/corsair_strafe.rs @@ -103,6 +103,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the Corsair STRAFE series keyboards pub struct CorsairStrafe { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -130,6 +131,7 @@ impl CorsairStrafe { debug!("Bound driver: Corsair STRAFE Gaming Keyboard"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -863,10 +865,12 @@ impl DeviceExt for CorsairStrafe { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/generic_keyboard.rs b/eruption/src/hwdevices/keyboards/generic_keyboard.rs index 5036a008..907f1884 100644 --- a/eruption/src/hwdevices/keyboards/generic_keyboard.rs +++ b/eruption/src/hwdevices/keyboards/generic_keyboard.rs @@ -265,10 +265,12 @@ impl DeviceExt for GenericKeyboard { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &None } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, _rx: Option>>) { // do nothing } diff --git a/eruption/src/hwdevices/keyboards/roccat_magma.rs b/eruption/src/hwdevices/keyboards/roccat_magma.rs index 44b99e14..50699915 100644 --- a/eruption/src/hwdevices/keyboards/roccat_magma.rs +++ b/eruption/src/hwdevices/keyboards/roccat_magma.rs @@ -101,6 +101,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Magma series keyboards pub struct RoccatMagma { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -130,6 +131,7 @@ impl RoccatMagma { debug!("Bound driver: ROCCAT Magma"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -973,10 +975,12 @@ impl DeviceExt for RoccatMagma { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/roccat_pyro.rs b/eruption/src/hwdevices/keyboards/roccat_pyro.rs index 974484c2..4d883636 100644 --- a/eruption/src/hwdevices/keyboards/roccat_pyro.rs +++ b/eruption/src/hwdevices/keyboards/roccat_pyro.rs @@ -100,6 +100,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Pyro series keyboards pub struct RoccatPyro { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -129,6 +130,7 @@ impl RoccatPyro { debug!("Bound driver: ROCCAT Pyro"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -834,10 +836,12 @@ impl DeviceExt for RoccatPyro { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/roccat_vulcan_1xx.rs b/eruption/src/hwdevices/keyboards/roccat_vulcan_1xx.rs index 5c7aecab..658437d0 100644 --- a/eruption/src/hwdevices/keyboards/roccat_vulcan_1xx.rs +++ b/eruption/src/hwdevices/keyboards/roccat_vulcan_1xx.rs @@ -106,6 +106,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Vulcan 100/12x series keyboards pub struct RoccatVulcan1xx { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -135,6 +136,7 @@ impl RoccatVulcan1xx { debug!("Bound driver: ROCCAT Vulcan 100/12x AIMO"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -1042,10 +1044,12 @@ impl DeviceExt for RoccatVulcan1xx { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/roccat_vulcan_2_max.rs b/eruption/src/hwdevices/keyboards/roccat_vulcan_2_max.rs index c9ec048e..d2b83ced 100644 --- a/eruption/src/hwdevices/keyboards/roccat_vulcan_2_max.rs +++ b/eruption/src/hwdevices/keyboards/roccat_vulcan_2_max.rs @@ -108,6 +108,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Vulcan 100/12x series keyboards pub struct RoccatVulcan2Max { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -137,6 +138,7 @@ impl RoccatVulcan2Max { debug!("Bound driver: ROCCAT Vulcan II Max"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -798,10 +800,12 @@ impl DeviceExt for RoccatVulcan2Max { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/roccat_vulcan_pro.rs b/eruption/src/hwdevices/keyboards/roccat_vulcan_pro.rs index 34f42ecb..085b37e9 100644 --- a/eruption/src/hwdevices/keyboards/roccat_vulcan_pro.rs +++ b/eruption/src/hwdevices/keyboards/roccat_vulcan_pro.rs @@ -104,6 +104,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Vulcan Pro series keyboards pub struct RoccatVulcanPro { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -133,6 +134,7 @@ impl RoccatVulcanPro { debug!("Bound driver: ROCCAT Vulcan Pro"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -841,10 +843,12 @@ impl DeviceExt for RoccatVulcanPro { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/roccat_vulcan_pro_tkl.rs b/eruption/src/hwdevices/keyboards/roccat_vulcan_pro_tkl.rs index ed4853d7..446b5d0e 100644 --- a/eruption/src/hwdevices/keyboards/roccat_vulcan_pro_tkl.rs +++ b/eruption/src/hwdevices/keyboards/roccat_vulcan_pro_tkl.rs @@ -108,6 +108,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Vulcan Pro TKL series keyboards pub struct RoccatVulcanProTKL { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -137,6 +138,7 @@ impl RoccatVulcanProTKL { debug!("Bound driver: ROCCAT Vulcan Pro TKL"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -850,10 +852,12 @@ impl DeviceExt for RoccatVulcanProTKL { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/roccat_vulcan_tkl.rs b/eruption/src/hwdevices/keyboards/roccat_vulcan_tkl.rs index 4046920b..06965103 100644 --- a/eruption/src/hwdevices/keyboards/roccat_vulcan_tkl.rs +++ b/eruption/src/hwdevices/keyboards/roccat_vulcan_tkl.rs @@ -105,6 +105,7 @@ pub enum DialMode { #[derive(Clone)] /// Device specific code for the ROCCAT Vulcan TKL series keyboards pub struct RoccatVulcanTKL { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -134,6 +135,7 @@ impl RoccatVulcanTKL { debug!("Bound driver: ROCCAT Vulcan TKL"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -975,10 +977,12 @@ impl DeviceExt for RoccatVulcanTKL { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/keyboards/wooting_two_he_arm.rs b/eruption/src/hwdevices/keyboards/wooting_two_he_arm.rs index bf3995c2..0a274182 100644 --- a/eruption/src/hwdevices/keyboards/wooting_two_he_arm.rs +++ b/eruption/src/hwdevices/keyboards/wooting_two_he_arm.rs @@ -131,6 +131,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the Wooting Two HE (ARM) series keyboards pub struct WootingTwoHeArm { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -158,6 +159,7 @@ impl WootingTwoHeArm { debug!("Bound driver: Wooting Two HE (ARM)"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -882,10 +884,12 @@ impl DeviceExt for WootingTwoHeArm { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/generic_mouse.rs b/eruption/src/hwdevices/mice/generic_mouse.rs index 42f28302..1c9190c5 100644 --- a/eruption/src/hwdevices/mice/generic_mouse.rs +++ b/eruption/src/hwdevices/mice/generic_mouse.rs @@ -265,10 +265,12 @@ impl DeviceExt for GenericMouse { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &None } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, _rx: Option>>) { // do nothing } diff --git a/eruption/src/hwdevices/mice/roccat_burst_pro.rs b/eruption/src/hwdevices/mice/roccat_burst_pro.rs index a5dc0f12..6b9a2681 100644 --- a/eruption/src/hwdevices/mice/roccat_burst_pro.rs +++ b/eruption/src/hwdevices/mice/roccat_burst_pro.rs @@ -85,6 +85,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Burst Pro mouse pub struct RoccatBurstPro { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -111,6 +112,7 @@ impl RoccatBurstPro { debug!("Bound driver: ROCCAT Burst Pro"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -687,10 +689,12 @@ impl DeviceExt for RoccatBurstPro { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kain_100.rs b/eruption/src/hwdevices/mice/roccat_kain_100.rs index 43b39ce9..57b85c95 100644 --- a/eruption/src/hwdevices/mice/roccat_kain_100.rs +++ b/eruption/src/hwdevices/mice/roccat_kain_100.rs @@ -84,6 +84,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kain 100 mouse pub struct RoccatKain100 { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -110,6 +111,7 @@ impl RoccatKain100 { debug!("Bound driver: ROCCAT Kain 100 AIMO"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -736,10 +738,12 @@ impl DeviceExt for RoccatKain100 { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kain_2xx.rs b/eruption/src/hwdevices/mice/roccat_kain_2xx.rs index e662fe77..ef9e32cd 100644 --- a/eruption/src/hwdevices/mice/roccat_kain_2xx.rs +++ b/eruption/src/hwdevices/mice/roccat_kain_2xx.rs @@ -103,6 +103,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kain 2xx mouse pub struct RoccatKain2xx { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -131,6 +132,7 @@ impl RoccatKain2xx { debug!("Bound driver: ROCCAT Kain 2xx AIMO"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -844,10 +846,12 @@ impl DeviceExt for RoccatKain2xx { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_aimo.rs b/eruption/src/hwdevices/mice/roccat_kone_aimo.rs index b74f5f0e..b3c40dfd 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_aimo.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_aimo.rs @@ -88,6 +88,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone Aimo mouse pub struct RoccatKoneAimo { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -114,6 +115,7 @@ impl RoccatKoneAimo { debug!("Bound driver: ROCCAT Kone Aimo"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -726,10 +728,12 @@ impl DeviceExt for RoccatKoneAimo { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_aimo_remastered.rs b/eruption/src/hwdevices/mice/roccat_kone_aimo_remastered.rs index a12f5474..b3ec0783 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_aimo_remastered.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_aimo_remastered.rs @@ -88,6 +88,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone Aimo Remastered mouse pub struct RoccatKoneAimoRemastered { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -114,6 +115,7 @@ impl RoccatKoneAimoRemastered { debug!("Bound driver: ROCCAT Kone Aimo Remastered"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -727,10 +729,12 @@ impl DeviceExt for RoccatKoneAimoRemastered { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_pro.rs b/eruption/src/hwdevices/mice/roccat_kone_pro.rs index 2b95012b..830d6958 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_pro.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_pro.rs @@ -85,6 +85,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone Pro mouse pub struct RoccatKonePro { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -111,6 +112,7 @@ impl RoccatKonePro { debug!("Bound driver: ROCCAT Kone Pro"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -725,10 +727,12 @@ impl DeviceExt for RoccatKonePro { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_pro_air.rs b/eruption/src/hwdevices/mice/roccat_kone_pro_air.rs index 1fb301a8..3807dac7 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_pro_air.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_pro_air.rs @@ -112,6 +112,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone Pro Air mouse pub struct RoccatKoneProAir { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -145,6 +146,7 @@ impl RoccatKoneProAir { debug!("Bound driver: ROCCAT Kone Pro Air"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -1077,10 +1079,12 @@ impl DeviceExt for RoccatKoneProAir { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_pure_ultra.rs b/eruption/src/hwdevices/mice/roccat_kone_pure_ultra.rs index 428e112d..4e8dea23 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_pure_ultra.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_pure_ultra.rs @@ -85,6 +85,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone Pure Ultra mouse pub struct RoccatKonePureUltra { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -114,6 +115,7 @@ impl RoccatKonePureUltra { debug!("Bound driver: ROCCAT Kone Pure Ultra"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -707,10 +709,12 @@ impl DeviceExt for RoccatKonePureUltra { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_xp.rs b/eruption/src/hwdevices/mice/roccat_kone_xp.rs index 74659659..0340dfa6 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_xp.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_xp.rs @@ -132,6 +132,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone XP mouse pub struct RoccatKoneXp { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -158,6 +159,7 @@ impl RoccatKoneXp { debug!("Bound driver: ROCCAT Kone XP"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -847,10 +849,12 @@ impl DeviceExt for RoccatKoneXp { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kone_xtd.rs b/eruption/src/hwdevices/mice/roccat_kone_xtd.rs index aceb36d4..6758772c 100644 --- a/eruption/src/hwdevices/mice/roccat_kone_xtd.rs +++ b/eruption/src/hwdevices/mice/roccat_kone_xtd.rs @@ -83,6 +83,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kone XTD Mouse pub struct RoccatKoneXtd { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -109,6 +110,7 @@ impl RoccatKoneXtd { debug!("Bound driver: ROCCAT Kone XTD Mouse"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -743,10 +745,12 @@ impl DeviceExt for RoccatKoneXtd { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kova_2016.rs b/eruption/src/hwdevices/mice/roccat_kova_2016.rs index 1dd73fc1..9ad0d776 100644 --- a/eruption/src/hwdevices/mice/roccat_kova_2016.rs +++ b/eruption/src/hwdevices/mice/roccat_kova_2016.rs @@ -80,6 +80,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kova 2016 mouse pub struct RoccatKova2016 { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -106,6 +107,7 @@ impl RoccatKova2016 { debug!("Bound driver: ROCCAT Kova 2016"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -694,10 +696,12 @@ impl DeviceExt for RoccatKova2016 { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_kova_aimo.rs b/eruption/src/hwdevices/mice/roccat_kova_aimo.rs index 1b11c1fc..c346197e 100644 --- a/eruption/src/hwdevices/mice/roccat_kova_aimo.rs +++ b/eruption/src/hwdevices/mice/roccat_kova_aimo.rs @@ -79,6 +79,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Kova AIMO mouse pub struct RoccatKovaAimo { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -105,6 +106,7 @@ impl RoccatKovaAimo { debug!("Bound driver: ROCCAT Kova AIMO"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -662,10 +664,12 @@ impl DeviceExt for RoccatKovaAimo { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/mice/roccat_nyth.rs b/eruption/src/hwdevices/mice/roccat_nyth.rs index 82e2538a..daf090f7 100644 --- a/eruption/src/hwdevices/mice/roccat_nyth.rs +++ b/eruption/src/hwdevices/mice/roccat_nyth.rs @@ -79,6 +79,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Nyth mouse pub struct RoccatNyth { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -102,6 +103,7 @@ impl RoccatNyth { debug!("Bound driver: ROCCAT Nyth"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -579,10 +581,12 @@ impl DeviceExt for RoccatNyth { None } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/misc.rs b/eruption/src/hwdevices/misc.rs index 5e13643b..e4e59a5c 100644 --- a/eruption/src/hwdevices/misc.rs +++ b/eruption/src/hwdevices/misc.rs @@ -20,6 +20,7 @@ */ pub mod custom_serial_leds; +#[cfg(openrgb_bridge)] pub mod openrgb_bridge; pub mod roccat_aimo_pad; pub mod roccat_elo_71_air; diff --git a/eruption/src/hwdevices/misc/custom_serial_leds.rs b/eruption/src/hwdevices/misc/custom_serial_leds.rs index 988f0d56..8af89d80 100644 --- a/eruption/src/hwdevices/misc/custom_serial_leds.rs +++ b/eruption/src/hwdevices/misc/custom_serial_leds.rs @@ -348,10 +348,12 @@ impl DeviceExt for CustomSerialLeds { Some(self) } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &None } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, _rx: Option>>) { // do nothing } diff --git a/eruption/src/hwdevices/misc/openrgb_bridge.rs b/eruption/src/hwdevices/misc/openrgb_bridge.rs index cf2673d8..dde10a8f 100644 --- a/eruption/src/hwdevices/misc/openrgb_bridge.rs +++ b/eruption/src/hwdevices/misc/openrgb_bridge.rs @@ -369,10 +369,12 @@ impl DeviceExt for OpenRgbBridge { Some(self) } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &None } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, _rx: Option>>) { // do nothing } diff --git a/eruption/src/hwdevices/misc/roccat_aimo_pad.rs b/eruption/src/hwdevices/misc/roccat_aimo_pad.rs index da6e1afa..dfde6c13 100644 --- a/eruption/src/hwdevices/misc/roccat_aimo_pad.rs +++ b/eruption/src/hwdevices/misc/roccat_aimo_pad.rs @@ -95,6 +95,7 @@ pub struct DeviceInfo { #[derive(Clone)] /// Device specific code for the ROCCAT Aimo Pad pub struct RoccatAimoPad { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -119,6 +120,7 @@ impl RoccatAimoPad { debug!("Bound driver: ROCCAT Aimo Pad"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -740,10 +742,12 @@ impl DeviceExt for RoccatAimoPad { Some(self) } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/hwdevices/misc/roccat_elo_71_air.rs b/eruption/src/hwdevices/misc/roccat_elo_71_air.rs index dd97b410..3c3b5200 100644 --- a/eruption/src/hwdevices/misc/roccat_elo_71_air.rs +++ b/eruption/src/hwdevices/misc/roccat_elo_71_air.rs @@ -102,6 +102,7 @@ pub enum QueryResult { #[derive(Clone)] /// Device specific code for the ROCCAT Elo 7.1 Air pub struct RoccatElo71Air { + #[cfg(not(target_os = "windows"))] pub evdev_rx: Option>>, pub is_initialized: bool, @@ -130,6 +131,7 @@ impl RoccatElo71Air { debug!("Bound driver: ROCCAT/Turtle Beach Elo 7.1 Air"); Self { + #[cfg(not(target_os = "windows"))] evdev_rx: None, is_initialized: false, @@ -930,10 +932,12 @@ impl DeviceExt for RoccatElo71Air { Some(self) } + #[cfg(not(target_os = "windows"))] fn get_evdev_input_rx(&self) -> &Option>> { &self.evdev_rx } + #[cfg(not(target_os = "windows"))] fn set_evdev_input_rx(&mut self, rx: Option>>) { self.evdev_rx = rx; } diff --git a/eruption/src/main.rs b/eruption/src/main.rs index c56b9c81..e9d3c09e 100644 --- a/eruption/src/main.rs +++ b/eruption/src/main.rs @@ -774,6 +774,7 @@ fn run_main_loop( let mut device_has_failed = false; + #[cfg(not(target_os = "windows"))] let mut evdev_rxs: IndexMap< hwdevices::DeviceHandle, flume::Receiver>, @@ -783,6 +784,7 @@ fn run_main_loop( let devices = crate::DEVICES.read().unwrap(); // build a Vec of all the rxs we are about to wait on + #[cfg(not(target_os = "windows"))] for (handle, device) in devices.iter() { if let Some(rx) = device.read().unwrap().get_evdev_input_rx().clone() { evdev_rxs.insert(*handle, rx); @@ -913,6 +915,7 @@ fn run_main_loop( } }; + #[cfg(not(target_os = "windows"))] if let Some(rx) = evdev_rxs.get(handle) { sel = sel.recv(rx, mapper); } @@ -1522,6 +1525,7 @@ pub fn initialize_device( } } } else { + #[cfg(not(target_os = "windows"))] device.set_evdev_input_rx(None); } } @@ -1529,6 +1533,7 @@ pub fn initialize_device( _ => { error!("Unsupported device class"); + #[cfg(not(target_os = "windows"))] device.set_evdev_input_rx(None); } }; diff --git a/magma/Cargo.toml b/magma/Cargo.toml index 6b38b2d7..b4678ae5 100644 --- a/magma/Cargo.toml +++ b/magma/Cargo.toml @@ -37,8 +37,8 @@ resolver = "2" [features] default = ["dbus-ipc"] -windows = [] -dbus-ipc = ["dbus", "dbus-tokio"] +windows = ["dbus-ipc"] +dbus-ipc = ["dbus"] [dependencies] lazy_static = "1.4.0" @@ -90,7 +90,6 @@ comfy-table = "7.0.1" paste = "1.0.14" glib = "0.18.3" dbus = { version = "0.9.7", optional = true } -dbus-tokio = { version = "0.7.6", optional = true } i18n-embed = { version = "0.14.0", features = [ "fluent-system", "desktop-requester", diff --git a/support/nsis/eruption.nsi b/support/nsis/eruption.nsi index 910329a0..e4f83e2f 100644 --- a/support/nsis/eruption.nsi +++ b/support/nsis/eruption.nsi @@ -86,6 +86,7 @@ Section "!Eruption" SetOutPath $INSTDIR File "${SOURCEDIR}\eruption.exe" + File "${SOURCEDIR}\magma.exe" File "..\shell\windows\*.bat" # create the uninstaller