diff --git a/Cargo.lock b/Cargo.lock index f73d149..eb38f3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1196,6 +1196,7 @@ dependencies = [ "serde", "serde_json", "speech-dispatcher", + "steamos-manager-proxy", "strum", "sysinfo", "tempfile", @@ -1211,6 +1212,13 @@ dependencies = [ "zbus_xml", ] +[[package]] +name = "steamos-manager-proxy" +version = "25.6.1" +dependencies = [ + "zbus", +] + [[package]] name = "strum" version = "0.27.1" diff --git a/Cargo.toml b/Cargo.toml index 8ede299..1be2e26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,39 +1,6 @@ -[package] -name = "steamos-manager" -version = "25.6.1" -edition = "2021" -repository = "https://gitlab.steamos.cloud/holo/steamos-manager/" +[workspace] +resolver = "2" +members = ["steamos-manager", "steamos-manager-proxy"] [profile.release] strip="symbols" - -[dependencies] -anyhow = "1" -async-trait = "0.1" -clap = { version = "4.5", default-features = false, features = ["derive", "help", "std", "usage"] } -config = { version = "0.15", default-features = false, features = ["async", "ini", "toml"] } -gio = "0.20" -inotify = { version = "0.11", default-features = false, features = ["stream"] } -input-linux = "0.7" -itertools = "0.14" -lazy_static = "1" -libc = "0.2" -nix = { version = "0.30", default-features = false, features = ["fs", "poll", "signal", "time", "user"] } -num_enum = "0.7" -regex = "1" -serde = { version = "1.0", default-features = false, features = ["derive"] } -serde_json = "1.0" -speech-dispatcher = "0.16" -strum = { version = "0.27", features = ["derive"] } -sysinfo = "0.35" -tempfile = "3" -tokio = { version = "1", default-features = false, features = ["fs", "io-std", "io-util", "macros", "process", "rt-multi-thread", "signal", "sync"] } -tokio-stream = { version = "0.1", default-features = false } -tokio-util = { version = "0.7", default-features = false } -toml = "0.8" -tracing = { version = "0.1", default-features = false } -tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] } -udev = { version = "^0.9.3", features = ["send", "sync"] } -xdg = "3.0" -zbus = { version = "5", default-features = false, features = ["tokio"] } -zbus_xml = "5" diff --git a/src/proxy/mod.rs b/src/proxy/mod.rs deleted file mode 100644 index f8c0acf..0000000 --- a/src/proxy/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2023 Collabora Ltd. - * Copyright © 2024 Valve Software - * - * SPDX-License-Identifier: MIT - */ - -#![allow(clippy::module_name_repetitions)] - -// Re-export relevant proxies - -// Deprecated interface -mod manager; -pub use crate::proxy::manager::ManagerProxy; - -// Optional interfaces -mod ambient_light_sensor1; -mod battery_charge_limit1; -mod cpu_scaling1; -mod factory_reset1; -mod fan_control1; -mod gpu_performance_level1; -mod gpu_power_profile1; -mod hdmi_cec1; -mod low_power_mode1; -mod manager2; -mod performance_profile1; -mod screenreader0; -mod storage1; -mod tdp_limit1; -mod update_bios1; -mod update_dock1; -mod wifi_debug1; -mod wifi_debug_dump1; -mod wifi_power_management1; -pub use crate::proxy::ambient_light_sensor1::AmbientLightSensor1Proxy; -pub use crate::proxy::battery_charge_limit1::BatteryChargeLimit1Proxy; -pub use crate::proxy::cpu_scaling1::CpuScaling1Proxy; -pub use crate::proxy::factory_reset1::FactoryReset1Proxy; -pub use crate::proxy::fan_control1::FanControl1Proxy; -pub use crate::proxy::gpu_performance_level1::GpuPerformanceLevel1Proxy; -pub use crate::proxy::gpu_power_profile1::GpuPowerProfile1Proxy; -pub use crate::proxy::hdmi_cec1::HdmiCec1Proxy; -pub use crate::proxy::low_power_mode1::LowPowerMode1Proxy; -pub use crate::proxy::manager2::Manager2Proxy; -pub use crate::proxy::performance_profile1::PerformanceProfile1Proxy; -pub use crate::proxy::screenreader0::ScreenReader0Proxy; -pub use crate::proxy::storage1::Storage1Proxy; -pub use crate::proxy::tdp_limit1::TdpLimit1Proxy; -pub use crate::proxy::update_bios1::UpdateBios1Proxy; -pub use crate::proxy::update_dock1::UpdateDock1Proxy; -pub use crate::proxy::wifi_debug1::WifiDebug1Proxy; -pub use crate::proxy::wifi_debug_dump1::WifiDebugDump1Proxy; -pub use crate::proxy::wifi_power_management1::WifiPowerManagement1Proxy; - -// Sub-interfaces -mod job1; -mod job_manager1; -mod udev_events1; -pub use crate::proxy::job1::Job1Proxy; -pub use crate::proxy::job_manager1::JobManager1Proxy; -pub use crate::proxy::udev_events1::UdevEvents1Proxy; diff --git a/steamos-manager-proxy/Cargo.toml b/steamos-manager-proxy/Cargo.toml new file mode 100644 index 0000000..d3cca7b --- /dev/null +++ b/steamos-manager-proxy/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "steamos-manager-proxy" +version = "25.6.1" +edition = "2021" +repository = "https://gitlab.steamos.cloud/holo/steamos-manager/" + +[dependencies] +zbus = { version = "5", default-features = false, features = ["tokio"] } diff --git a/src/proxy/ambient_light_sensor1.rs b/steamos-manager-proxy/src/ambient_light_sensor1.rs similarity index 100% rename from src/proxy/ambient_light_sensor1.rs rename to steamos-manager-proxy/src/ambient_light_sensor1.rs diff --git a/src/proxy/battery_charge_limit1.rs b/steamos-manager-proxy/src/battery_charge_limit1.rs similarity index 100% rename from src/proxy/battery_charge_limit1.rs rename to steamos-manager-proxy/src/battery_charge_limit1.rs diff --git a/src/proxy/cpu_scaling1.rs b/steamos-manager-proxy/src/cpu_scaling1.rs similarity index 100% rename from src/proxy/cpu_scaling1.rs rename to steamos-manager-proxy/src/cpu_scaling1.rs diff --git a/src/proxy/factory_reset1.rs b/steamos-manager-proxy/src/factory_reset1.rs similarity index 100% rename from src/proxy/factory_reset1.rs rename to steamos-manager-proxy/src/factory_reset1.rs diff --git a/src/proxy/fan_control1.rs b/steamos-manager-proxy/src/fan_control1.rs similarity index 100% rename from src/proxy/fan_control1.rs rename to steamos-manager-proxy/src/fan_control1.rs diff --git a/src/proxy/gpu_performance_level1.rs b/steamos-manager-proxy/src/gpu_performance_level1.rs similarity index 100% rename from src/proxy/gpu_performance_level1.rs rename to steamos-manager-proxy/src/gpu_performance_level1.rs diff --git a/src/proxy/gpu_power_profile1.rs b/steamos-manager-proxy/src/gpu_power_profile1.rs similarity index 100% rename from src/proxy/gpu_power_profile1.rs rename to steamos-manager-proxy/src/gpu_power_profile1.rs diff --git a/src/proxy/hdmi_cec1.rs b/steamos-manager-proxy/src/hdmi_cec1.rs similarity index 100% rename from src/proxy/hdmi_cec1.rs rename to steamos-manager-proxy/src/hdmi_cec1.rs diff --git a/src/proxy/job1.rs b/steamos-manager-proxy/src/job1.rs similarity index 100% rename from src/proxy/job1.rs rename to steamos-manager-proxy/src/job1.rs diff --git a/src/proxy/job_manager1.rs b/steamos-manager-proxy/src/job_manager1.rs similarity index 100% rename from src/proxy/job_manager1.rs rename to steamos-manager-proxy/src/job_manager1.rs diff --git a/steamos-manager-proxy/src/lib.rs b/steamos-manager-proxy/src/lib.rs new file mode 100644 index 0000000..6b29b36 --- /dev/null +++ b/steamos-manager-proxy/src/lib.rs @@ -0,0 +1,62 @@ +/* + * Copyright © 2023 Collabora Ltd. + * Copyright © 2024 Valve Software + * + * SPDX-License-Identifier: MIT + */ + +#![allow(clippy::module_name_repetitions)] + +// Re-export relevant proxies + +// Deprecated interface +mod manager; +pub use crate::manager::ManagerProxy; + +// Optional interfaces +mod ambient_light_sensor1; +mod battery_charge_limit1; +mod cpu_scaling1; +mod factory_reset1; +mod fan_control1; +mod gpu_performance_level1; +mod gpu_power_profile1; +mod hdmi_cec1; +mod low_power_mode1; +mod manager2; +mod performance_profile1; +mod screenreader0; +mod storage1; +mod tdp_limit1; +mod update_bios1; +mod update_dock1; +mod wifi_debug1; +mod wifi_debug_dump1; +mod wifi_power_management1; +pub use crate::ambient_light_sensor1::AmbientLightSensor1Proxy; +pub use crate::battery_charge_limit1::BatteryChargeLimit1Proxy; +pub use crate::cpu_scaling1::CpuScaling1Proxy; +pub use crate::factory_reset1::FactoryReset1Proxy; +pub use crate::fan_control1::FanControl1Proxy; +pub use crate::gpu_performance_level1::GpuPerformanceLevel1Proxy; +pub use crate::gpu_power_profile1::GpuPowerProfile1Proxy; +pub use crate::hdmi_cec1::HdmiCec1Proxy; +pub use crate::low_power_mode1::LowPowerMode1Proxy; +pub use crate::manager2::Manager2Proxy; +pub use crate::performance_profile1::PerformanceProfile1Proxy; +pub use crate::screenreader0::ScreenReader0Proxy; +pub use crate::storage1::Storage1Proxy; +pub use crate::tdp_limit1::TdpLimit1Proxy; +pub use crate::update_bios1::UpdateBios1Proxy; +pub use crate::update_dock1::UpdateDock1Proxy; +pub use crate::wifi_debug1::WifiDebug1Proxy; +pub use crate::wifi_debug_dump1::WifiDebugDump1Proxy; +pub use crate::wifi_power_management1::WifiPowerManagement1Proxy; + +// Sub-interfaces +mod job1; +mod job_manager1; +mod udev_events1; +pub use crate::job1::Job1Proxy; +pub use crate::job_manager1::JobManager1Proxy; +pub use crate::udev_events1::UdevEvents1Proxy; diff --git a/src/proxy/low_power_mode1.rs b/steamos-manager-proxy/src/low_power_mode1.rs similarity index 100% rename from src/proxy/low_power_mode1.rs rename to steamos-manager-proxy/src/low_power_mode1.rs diff --git a/src/proxy/manager.rs b/steamos-manager-proxy/src/manager.rs similarity index 100% rename from src/proxy/manager.rs rename to steamos-manager-proxy/src/manager.rs diff --git a/src/proxy/manager2.rs b/steamos-manager-proxy/src/manager2.rs similarity index 100% rename from src/proxy/manager2.rs rename to steamos-manager-proxy/src/manager2.rs diff --git a/src/proxy/performance_profile1.rs b/steamos-manager-proxy/src/performance_profile1.rs similarity index 100% rename from src/proxy/performance_profile1.rs rename to steamos-manager-proxy/src/performance_profile1.rs diff --git a/src/proxy/screenreader0.rs b/steamos-manager-proxy/src/screenreader0.rs similarity index 100% rename from src/proxy/screenreader0.rs rename to steamos-manager-proxy/src/screenreader0.rs diff --git a/src/proxy/storage1.rs b/steamos-manager-proxy/src/storage1.rs similarity index 100% rename from src/proxy/storage1.rs rename to steamos-manager-proxy/src/storage1.rs diff --git a/src/proxy/tdp_limit1.rs b/steamos-manager-proxy/src/tdp_limit1.rs similarity index 100% rename from src/proxy/tdp_limit1.rs rename to steamos-manager-proxy/src/tdp_limit1.rs diff --git a/src/proxy/udev_events1.rs b/steamos-manager-proxy/src/udev_events1.rs similarity index 100% rename from src/proxy/udev_events1.rs rename to steamos-manager-proxy/src/udev_events1.rs diff --git a/src/proxy/update_bios1.rs b/steamos-manager-proxy/src/update_bios1.rs similarity index 100% rename from src/proxy/update_bios1.rs rename to steamos-manager-proxy/src/update_bios1.rs diff --git a/src/proxy/update_dock1.rs b/steamos-manager-proxy/src/update_dock1.rs similarity index 100% rename from src/proxy/update_dock1.rs rename to steamos-manager-proxy/src/update_dock1.rs diff --git a/src/proxy/wifi_debug1.rs b/steamos-manager-proxy/src/wifi_debug1.rs similarity index 100% rename from src/proxy/wifi_debug1.rs rename to steamos-manager-proxy/src/wifi_debug1.rs diff --git a/src/proxy/wifi_debug_dump1.rs b/steamos-manager-proxy/src/wifi_debug_dump1.rs similarity index 100% rename from src/proxy/wifi_debug_dump1.rs rename to steamos-manager-proxy/src/wifi_debug_dump1.rs diff --git a/src/proxy/wifi_power_management1.rs b/steamos-manager-proxy/src/wifi_power_management1.rs similarity index 100% rename from src/proxy/wifi_power_management1.rs rename to steamos-manager-proxy/src/wifi_power_management1.rs diff --git a/steamos-manager/Cargo.toml b/steamos-manager/Cargo.toml new file mode 100644 index 0000000..7682fb3 --- /dev/null +++ b/steamos-manager/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "steamos-manager" +version = "25.6.1" +edition = "2021" +repository = "https://gitlab.steamos.cloud/holo/steamos-manager/" + +[dependencies] +anyhow = "1" +async-trait = "0.1" +clap = { version = "4.5", default-features = false, features = ["derive", "help", "std", "usage"] } +config = { version = "0.15", default-features = false, features = ["async", "ini", "toml"] } +gio = "0.20" +inotify = { version = "0.11", default-features = false, features = ["stream"] } +input-linux = "0.7" +itertools = "0.14" +lazy_static = "1" +libc = "0.2" +nix = { version = "0.30", default-features = false, features = ["fs", "poll", "signal", "time", "user"] } +num_enum = "0.7" +regex = "1" +serde = { version = "1.0", default-features = false, features = ["derive"] } +serde_json = "1.0" +speech-dispatcher = "0.16" +steamos-manager-proxy = { path = "../steamos-manager-proxy" } +strum = { version = "0.27", features = ["derive"] } +sysinfo = "0.35" +tempfile = "3" +tokio = { version = "1", default-features = false, features = ["fs", "io-std", "io-util", "macros", "process", "rt-multi-thread", "signal", "sync"] } +tokio-stream = { version = "0.1", default-features = false } +tokio-util = { version = "0.7", default-features = false } +toml = "0.8" +tracing = { version = "0.1", default-features = false } +tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] } +udev = { version = "^0.9.3", features = ["send", "sync"] } +xdg = "3.0" +zbus = { version = "5", default-features = false, features = ["tokio"] } +zbus_xml = "5" diff --git a/src/bin/steamos-manager.rs b/steamos-manager/src/bin/steamos-manager.rs similarity index 100% rename from src/bin/steamos-manager.rs rename to steamos-manager/src/bin/steamos-manager.rs diff --git a/src/bin/steamosctl.rs b/steamos-manager/src/bin/steamosctl.rs similarity index 100% rename from src/bin/steamosctl.rs rename to steamos-manager/src/bin/steamosctl.rs diff --git a/src/cec.rs b/steamos-manager/src/cec.rs similarity index 100% rename from src/cec.rs rename to steamos-manager/src/cec.rs diff --git a/src/daemon/config.rs b/steamos-manager/src/daemon/config.rs similarity index 100% rename from src/daemon/config.rs rename to steamos-manager/src/daemon/config.rs diff --git a/src/daemon/mod.rs b/steamos-manager/src/daemon/mod.rs similarity index 100% rename from src/daemon/mod.rs rename to steamos-manager/src/daemon/mod.rs diff --git a/src/daemon/root.rs b/steamos-manager/src/daemon/root.rs similarity index 100% rename from src/daemon/root.rs rename to steamos-manager/src/daemon/root.rs diff --git a/src/daemon/user.rs b/steamos-manager/src/daemon/user.rs similarity index 100% rename from src/daemon/user.rs rename to steamos-manager/src/daemon/user.rs diff --git a/src/ds_inhibit.rs b/steamos-manager/src/ds_inhibit.rs similarity index 100% rename from src/ds_inhibit.rs rename to steamos-manager/src/ds_inhibit.rs diff --git a/src/error.rs b/steamos-manager/src/error.rs similarity index 100% rename from src/error.rs rename to steamos-manager/src/error.rs diff --git a/src/hardware.rs b/steamos-manager/src/hardware.rs similarity index 99% rename from src/hardware.rs rename to steamos-manager/src/hardware.rs index 777a89e..e6d1276 100644 --- a/src/hardware.rs +++ b/steamos-manager/src/hardware.rs @@ -33,7 +33,7 @@ const PRODUCT_NAME_PATH: &str = "/sys/class/dmi/id/product_name"; #[cfg(not(test))] const DEVICE_CONFIG_PATH: &str = "/usr/share/steamos-manager/devices"; #[cfg(test)] -const DEVICE_CONFIG_PATH: &str = "data/devices"; +const DEVICE_CONFIG_PATH: &str = "../data/devices"; #[derive(Display, EnumString, PartialEq, Debug, Default, Copy, Clone)] #[strum(serialize_all = "snake_case", ascii_case_insensitive)] diff --git a/src/inputplumber.rs b/steamos-manager/src/inputplumber.rs similarity index 100% rename from src/inputplumber.rs rename to steamos-manager/src/inputplumber.rs diff --git a/src/job.rs b/steamos-manager/src/job.rs similarity index 100% rename from src/job.rs rename to steamos-manager/src/job.rs diff --git a/src/lib.rs b/steamos-manager/src/lib.rs similarity index 99% rename from src/lib.rs rename to steamos-manager/src/lib.rs index 54c92a2..ad294a2 100644 --- a/src/lib.rs +++ b/steamos-manager/src/lib.rs @@ -18,6 +18,8 @@ use tokio::io::AsyncWriteExt; use tokio_util::sync::CancellationToken; use tracing::{debug, error, info, warn}; +pub use steamos_manager_proxy as proxy; + mod ds_inhibit; mod error; mod inputplumber; @@ -34,7 +36,6 @@ pub mod cec; pub mod daemon; pub mod hardware; pub mod power; -pub mod proxy; pub mod screenreader; pub mod wifi; diff --git a/src/manager/mod.rs b/steamos-manager/src/manager/mod.rs similarity index 100% rename from src/manager/mod.rs rename to steamos-manager/src/manager/mod.rs diff --git a/src/manager/root.rs b/steamos-manager/src/manager/root.rs similarity index 100% rename from src/manager/root.rs rename to steamos-manager/src/manager/root.rs diff --git a/src/manager/user.rs b/steamos-manager/src/manager/user.rs similarity index 99% rename from src/manager/user.rs rename to steamos-manager/src/manager/user.rs index 980c2d3..fd71a93 100644 --- a/src/manager/user.rs +++ b/steamos-manager/src/manager/user.rs @@ -1345,7 +1345,7 @@ mod test { .await .expect("remote"); let local = testing::InterfaceIntrospection::from_local( - "com.steampowered.SteamOSManager1.Manager.xml", + "../com.steampowered.SteamOSManager1.Manager.xml", "com.steampowered.SteamOSManager1.Manager", ) .await @@ -1357,7 +1357,7 @@ mod test { let remote = testing::InterfaceIntrospection::from_remote::(connection, MANAGER_PATH).await?; let local = testing::InterfaceIntrospection::from_local( - "com.steampowered.SteamOSManager1.xml", + "../com.steampowered.SteamOSManager1.xml", I::name().to_string(), ) .await?; diff --git a/src/platform.rs b/steamos-manager/src/platform.rs similarity index 99% rename from src/platform.rs rename to steamos-manager/src/platform.rs index 975f353..4476d15 100644 --- a/src/platform.rs +++ b/steamos-manager/src/platform.rs @@ -341,7 +341,7 @@ mod test { #[tokio::test] async fn jupiter_valid() { - let config = read_to_string("data/devices/jupiter.toml") + let config = read_to_string("../data/devices/jupiter.toml") .await .expect("read_to_string"); let res = toml::from_str::(config.as_ref()); diff --git a/src/power.rs b/steamos-manager/src/power.rs similarity index 100% rename from src/power.rs rename to steamos-manager/src/power.rs diff --git a/src/process.rs b/steamos-manager/src/process.rs similarity index 100% rename from src/process.rs rename to steamos-manager/src/process.rs diff --git a/src/screenreader.rs b/steamos-manager/src/screenreader.rs similarity index 99% rename from src/screenreader.rs rename to steamos-manager/src/screenreader.rs index c8b9965..5fdcdcf 100644 --- a/src/screenreader.rs +++ b/steamos-manager/src/screenreader.rs @@ -36,7 +36,7 @@ use crate::systemd::SystemdUnit; use crate::uinput::UInputDevice; #[cfg(test)] -const TEST_ORCA_SETTINGS: &str = "data/test-orca-settings.conf"; +const TEST_ORCA_SETTINGS: &str = "../data/test-orca-settings.conf"; #[cfg(test)] const ORCA_SETTINGS: &str = "orca-settings.conf"; #[cfg(test)] diff --git a/src/sls/ftrace.rs b/steamos-manager/src/sls/ftrace.rs similarity index 100% rename from src/sls/ftrace.rs rename to steamos-manager/src/sls/ftrace.rs diff --git a/src/sls/mod.rs b/steamos-manager/src/sls/mod.rs similarity index 100% rename from src/sls/mod.rs rename to steamos-manager/src/sls/mod.rs diff --git a/src/systemd.rs b/steamos-manager/src/systemd.rs similarity index 100% rename from src/systemd.rs rename to steamos-manager/src/systemd.rs diff --git a/src/testing.rs b/steamos-manager/src/testing.rs similarity index 99% rename from src/testing.rs rename to steamos-manager/src/testing.rs index a65ea55..163987a 100644 --- a/src/testing.rs +++ b/steamos-manager/src/testing.rs @@ -118,7 +118,7 @@ impl MockDBus { .args([ "--nofork", "--print-address", - "--config-file=data/test-dbus.conf", + "--config-file=../data/test-dbus.conf", ]) .stdout(Stdio::piped()) .spawn()?; diff --git a/src/udev.rs b/steamos-manager/src/udev.rs similarity index 99% rename from src/udev.rs rename to steamos-manager/src/udev.rs index 82b2b30..221f7dc 100644 --- a/src/udev.rs +++ b/steamos-manager/src/udev.rs @@ -213,7 +213,7 @@ mod test { .await .expect("remove"); let local = testing::InterfaceIntrospection::from_local( - "com.steampowered.SteamOSManager1.xml", + "../com.steampowered.SteamOSManager1.xml", UdevDbusObject::name().to_string(), ) .await diff --git a/src/uinput.rs b/steamos-manager/src/uinput.rs similarity index 100% rename from src/uinput.rs rename to steamos-manager/src/uinput.rs diff --git a/src/wifi.rs b/steamos-manager/src/wifi.rs similarity index 100% rename from src/wifi.rs rename to steamos-manager/src/wifi.rs