Commit graph

52 commits

Author SHA1 Message Date
Vicki Pfau
83e9de9bcb Merge steamos-workerd in 2024-03-22 19:31:38 -07:00
Vicki Pfau
6f1f1c032c manager: Use anyhow::ensure 2024-03-20 18:25:48 -07:00
Vicki Pfau
87ef532ce4 manager: Move std::fs operations back into tokio::fs 2024-03-20 18:19:33 -07:00
Vicki Pfau
f8d390d6ff Update copyrights 2024-03-20 18:13:58 -07:00
Vicki Pfau
cdf4297f9f main: Wait on ctrl-c 2024-03-20 18:13:58 -07:00
Vicki Pfau
7e262a1d96 manager: Move paths to constants 2024-03-20 18:13:58 -07:00
Vicki Pfau
96efd91228 Clean up logging 2024-03-19 18:02:17 -07:00
Vicki Pfau
4a4b021ea5 manager: Fix typo, remove redundant comments 2024-03-19 18:02:17 -07:00
Vicki Pfau
2599d6fb20 manager: Move work functions outside of DBus interface
This enables using more idiomatic Result and ? return instead of having to
match and return false
2024-03-19 17:46:41 -07:00
Vicki Pfau
dce3ad8437 manager: Make match indent towers more idiomatic 2024-03-19 17:46:41 -07:00
Vicki Pfau
2e55bc2330 manager: Clean up non-idiomatic code 2024-03-19 17:46:41 -07:00
Vicki Pfau
cf416c8a56 manager: Unify error handling on anyhow 2024-03-19 17:41:00 -07:00
Vicki Pfau
7217b0c2b1 Run cargo fmt 2024-03-19 17:41:00 -07:00
Vicki Pfau
5afe7222ca Upgrade to zbus 4 2024-03-19 17:41:00 -07:00
Vicki Pfau
4679a071a1 Cargo.toml: Use more recommended practices 2024-03-19 16:02:03 -07:00
Jeremy Whiting
4a50b941dd wifidebug: Add some helper scripts to use for testing.
While the steam client will drive wifi debug mode for now
add some scripts that directly talk to it over dbus to enable
disable, and check the current debug modes.

Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-08 18:18:22 -07:00
Jeremy Whiting
29eb97128b Merge branch 'work/whiting/wifidebug' into 'master'
wifidebug: Add some iwd override and a way to enable/disable.

See merge request holo/steamos-manager!7
2024-02-07 23:06:37 +00:00
Jeremy Whiting
ce95a53ee8 wifidebug: Add GetWifiDebugMode to get the current wifi debug mode.
This may be useful in cases where SetWifiDebugMode has failed to
check what the current state/setting is.
Though if SetWifiDebugMode has failed we may be in weird state
so logs of steamos-manager should be checked to see what failed.

Signed-off-by: Jeremy Whiting <jpwhiting@kde.org>
2024-02-07 14:23:31 -07:00
Jeremy Whiting
ec819e6d00 wifidebug: Only run trace-cmd commands on Galileo devices.
Differentiate Galileo devices from others by checking the
contents of /sys/class/drm/id/board_name.

Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-06 10:16:03 -07:00
Jeremy Whiting
97a79c6713 general: Use SMManager::default() instead of ::new() in main.
Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-06 10:15:09 -07:00
Jeremy Whiting
c1d1951773 wifidebug: Add error checking with println! statements on all failures.
Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-05 11:00:01 -07:00
Jeremy Whiting
40d25971c9 wifidebug: Make WifiDebugMode a real enum with parsing from u32 for dbus.
Changed mode parameter from i32 to u32 as well.
Change from Result<bool, Box<dyn std::error::Error>> to
std::io::Result<bool>
Adjust the xml to add the new method.
Make all private api use Result<()> types so we can do error checking.

Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-05 10:59:46 -07:00
Jeremy Whiting
07e3843c3f wifidebug: Add trace-cmd usage to start and stop gathering data.
When wifi debug mode is started trace-cmd start is executed with
the given buffer_size parameter.
Later when wifi debug mode is stopped, trace-cmd stop is executed
as well as trace-cmd extract to write the data to a file on disk.
In this way the steam client (or any dbus users...) can decide how
long to run trace-cmd for.
Change to create_dir_all so we don't get errors if it exists.

Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-05 10:59:41 -07:00
Jeremy Whiting
cd241445b4 wifidebug: Add some iwd override and a way to enable/disable.
Adds set_wifi_debug_mode to enable or disable wifi debug mode.
Parameters are
mode (0 for off, 1 for on for now, expandable in the
future if more modes are needed).
buffer_size: a size in kilobytes per cpu (so 16 on the deck)
for the ring buffer that debug messages will get written into.

For now just adds or removes a iwd debug mode override and restarts
iwd.
next will add some trace-cmd commands to write the debug messages
to a file on disk.

Signed-off-by: Jeremy Whiting <jeremy.whiting@collabora.com>
2024-02-05 10:59:25 -07:00
Jeremy Whiting
78d0d6e458 Merge branch 'work/whiting/filedescriptor' into 'master'
Implement GetAlsIntegrationTimeFileDescriptor.

See merge request holo/steamos-manager!5
2023-11-15 23:17:50 +00:00
Jeremy Whiting
0c4b661d16 Run cargo fmt --all.
Fixes code styling in all source files.
2023-11-15 16:05:54 -07:00
Jeremy Whiting
bf3cca29ac Implement GetAlsIntegrationTimeFileDescriptor.
And this attempt works now. I guess this is adequate to release
as a throw away implementation to replace later with something better.
Also add strip="symbols" for release builds to get it down to a lean
3.2M size.
2023-11-15 15:23:43 -07:00
Jeremy Whiting
b73ae9ebd1 Also update version in Cargo.lock. 2023-10-23 12:08:55 -06:00
Jeremy Whiting
a073078266 Merge branch 'work/whiting/moreapis' into 'master'
Add most of the rest of the missing api methods.

See merge request holo/steamos-manager!3
2023-10-23 18:07:47 +00:00
Jeremy Whiting
ca319748ca Bump package version to 0.9.0 for testing. 2023-10-23 12:07:10 -06:00
Jeremy Whiting
bc3ad0a54f Implement SetTdpLimit.
Write given limit to /sys/class/hwmon/hwmon5/power[12]_cap if in the
range of 3..15.
Return false if out of range or unable to write.
2023-10-18 15:09:16 -06:00
Jeremy Whiting
e2190d69eb Add set_gpu_clocks for setting manual clock rates.
Also fix typos in dbus xml to match generated api signatures.
2023-10-18 14:40:50 -06:00
Jeremy Whiting
0a49fdaf1f Implement set_gpu_performance_level.
Use an enum of values for level:
0 - auto
1 - low
2 - high
3 - manual
4 - peak_performance

If any out of range are given, return an false. If unable to write
or open for writing, return false. May change to give an err type
instead later if that helps client side.
2023-10-18 14:40:50 -06:00
Jeremy Whiting
05a716b3b1 Remove SetAdaptiveBrightness, SetLEDBrightness, and SetBacklight.
For now these 3 aren't needed or aren't used by steam client
so removing them for now.
2023-10-18 14:39:49 -06:00
Jeremy Whiting
14584d0540 Add format sdcard, update bios/dock, trim devices scripts.
For each of those use the respective polkit-helper script
for forward compatibility in case those change.
2023-10-18 14:22:20 -06:00
Jeremy Whiting
32963ba2c1 Merge branch 'work/whiting/systembus' into 'master'
Use the system bus.

See merge request holo/steamos-manager!2
2023-10-18 19:44:44 +00:00
Jeremy Whiting
d74c7ae319 Change to tokio instead of async-std. 2023-10-18 13:42:15 -06:00
Jeremy Whiting
741c5b5ce4 Use the system bus.
Added a dbus service file so we can own the
com.steampowered.SteamOSManager1 name.
Also added a systemd service file
Also add a dbus .conf file to allow any process to talk
to manager for now.
2023-10-17 12:26:26 -06:00
Jeremy Whiting
dee6376309 Merge branch 'work/whiting/get_pipeline_output' into 'master'
Add get_pipeline_output to get output from 3 commands.

See merge request holo/steamos-manager!1
2023-10-06 18:28:49 +00:00
Jeremy Whiting
c06da2f376 Add script_output to get output from a script.
Check for errors, but otherwise get output, using process.wait()
to wait for all output, etc.
2023-10-04 23:11:10 -06:00
Jeremy Whiting
96b42d1338 Add some error checking to run_script and println! on errors.
TODO: Maybe log to journal instead, but maybe not needed depending
how this daemon gets executed.
2023-10-04 21:57:36 -06:00
Jeremy Whiting
a10db120e6 Fix clippy warnings to be more idiomatic.
Don't use return statements, just end functions with
what should return.
Remove unused use statement.
2023-10-04 21:26:29 -06:00
Jeremy Whiting
92325cde43 Remove lib.rs for now. Can add it back later with a better name.
If we end up able to abstract some of these apis with a struct like
we have in lib.rs will add back with a better name at that point.
2023-10-04 21:13:17 -06:00
Jeremy Whiting
abb0520e67 Implement a few more apis.
Also updated run_script to take argv as parameter instead of a single
string.
2023-10-02 16:07:58 -06:00
Jeremy Whiting
e2cc4c2b38 Add basic running script functionality.
Will likely move api methods out to be more generic, but this
runs for now and gives true on success, false on failure, etc.
May also need to change from process.poll to wait for longer
running scripts. will do once tested more.
2023-10-02 12:31:28 -06:00
Jeremy Whiting
8f0f6e7976 Implement Version dbus api with value 1 for now. 2023-10-02 12:01:43 -06:00
Jeremy Whiting
aa86fdd810 Add Cargo.lock file since we are building an application.
Usually when building a library we don't ship Cargo.lock, since
binary using our library should control versions. Since we are
an application though, ship Cargo.lock to lock versions of
dependencies.
2023-09-29 13:02:31 -06:00
Jeremy Whiting
701ff23987 Add initial dbus interface xml descripiton.
Much of this will change, but needed something to start with.
Based on notes at https://gitlab.steamos.cloud/jupiter/tasks/-/issues/894
Use objectserver to get introspection done for us.
Change to session bus for now since system bus will need
a config file to allow us to take the name. Will add later.
Implement one quick say_hello dbus method to start.
Add copyright headers.
2023-09-29 13:01:33 -06:00
Jeremy Whiting
302fe3c063 Add a basic Hacking.md for getting started, building, running, etc. 2023-09-05 14:16:34 -06:00
Jeremy Whiting
f2133a5256 More stuff implemented.
Use zbus to register the bus name.
Use async_std to get dbus session connection.
Added missing interface_name in SmDbusApi.
Removed parameters from SmDbusApi since those are passed, but not
kept with the method definition, etc.
2023-09-05 13:09:54 -06:00