Skip to content

Commit 2108864

Browse files
Release new version! (#84)
- Daemon rewrite with JSON API - GTK4 UI - Voltage control on vega20+ - Custom fan curve points in GUI - pkger packaging
2 parents 49535c9 + 7ed5d33 commit 2108864

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4911
-5556
lines changed

.github/workflows/build-packages.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build packages
2+
3+
on:
4+
push:
5+
branches: ['v2', 'master']
6+
7+
jobs:
8+
build-packages:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
14+
- name: Install pkger
15+
run: |
16+
curl -L -o /tmp/pkger.deb https://github.com/vv9k/pkger/releases/download/0.11.0/pkger-0.11.0-0.amd64.deb
17+
sudo apt -y install /tmp/pkger.deb
18+
19+
- name: Build packages
20+
run: pkger -c .pkger.yml build lact
21+
22+
- name: Copy release files
23+
run: |
24+
OUT_DIR=$PWD/release-artifacts
25+
mkdir -p $OUT_DIR
26+
27+
pushd pkg/output
28+
for DISTRO in $(ls); do
29+
cd $DISTRO
30+
rm -f *.src.rpm
31+
32+
for FILE in $(ls); do
33+
NAME="${FILE%.*}"
34+
EXT="${FILE##*.}"
35+
36+
OUT_NAME="$OUT_DIR/$NAME.$DISTRO.$EXT"
37+
cp $FILE $OUT_NAME
38+
done
39+
cd ..
40+
done
41+
popd
42+
43+
- name: Create release
44+
uses: ncipollo/release-action@v1.12.0
45+
with:
46+
removeArtifacts: true
47+
allowUpdates: true
48+
artifactErrorsFailBuild: true
49+
artifacts: "release-artifacts/*"
50+
body: ${{ github.event.head_commit.message }}
51+
prerelease: true
52+
name: Test release
53+
tag: test-build
54+
55+
- name: Update test-build tag
56+
run: |
57+
git tag -f test-build
58+
git push -f origin test-build
59+
shell: bash
60+

.github/workflows/rust.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ env:
1111

1212
jobs:
1313
build-test:
14-
runs-on: ubuntu-20.04
14+
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
15+
runs-on: ubuntu-22.04
1516

1617
steps:
1718
- uses: actions/checkout@v2
1819
- name: Update repos
1920
run: sudo apt update
2021
- name: Install dependencies
21-
run: sudo apt install libgtk-3-dev libvulkan-dev
22+
run: sudo apt install libgtk-4-dev pkg-config libvulkan-dev
2223
- name: Build
2324
run: cargo build
2425
- name: Run tests
25-
run: cargo test --verbose
26+
run: cargo test --verbose --no-default-features
2627

2728
check-format:
28-
runs-on: ubuntu-20.04
29-
29+
runs-on: ubuntu-22.04
30+
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
3031
steps:
3132
- uses: actions/checkout@v2
3233
- name: install rustfmt

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
/target
2+
AppDir/
23
*.glade\~
4+
*.AppImage
5+
*.AppImage.zsync
6+
appimage-build/
7+
*.stignore
8+
pkg/output

.pkger.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
recipes_dir: pkg/recipes
3+
output_dir: pkg/output
4+
images_dir: pkg/images
5+
log_dir: ~
6+
runtime_uri: ~
7+
gpg_key: ~
8+
gpg_name: ~
9+
ssh: ~
10+
images:
11+
- name: debian-12
12+
target: deb
13+
- name: fedora-37
14+
target: rpm
15+
- name: ubuntu-2204
16+
target: deb
17+
custom_simple_images: ~

.vscode/launch.json

-138
This file was deleted.

API.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Description
2+
3+
The LACT Daemon exposes a JSON API over a unix socket, available on `/var/run/lactd.sock`. You can configure who has access to the socket in `/etc/lact/config.yaml` in the `daemon.admin_groups` field.
4+
5+
The API expects newline-separated JSON objects, and returns a JSON object for every request.
6+
7+
The general format of requests looks like:
8+
```
9+
{"command": "command_name", "args": {}}
10+
```
11+
Note that the type of `args` depends on the specific request, and may be ommited in some cases.
12+
13+
The response looks like this:
14+
```
15+
{"status": "ok|error", "data": {}}
16+
```
17+
Same as `args` in requests, `data` can be of a different type and may not be present depending on the specific request.
18+
19+
You can try sending commands to socket interactively with `ncat`:
20+
```
21+
echo '{"command": "list_devices"}' | ncat -U /run/lactd.sock
22+
```
23+
Example response:
24+
```
25+
{"status":"ok","data":[{"id":"1002:687F-1043:0555-0000:0b:00.0","name":"Vega 10 XL/XT [Radeon RX Vega 56/64]"}]}
26+
```
27+
28+
# Commands
29+
30+
For the full list of available commands and responses, you can look at the source code of the schema: [requests](lact-schema/src/request.rs), [the basic response structure](lact-schema/src/response.rs) and [all possible types](lact-schema/src/lib.rs).
31+
32+
It should also be fairly easy to figure out the API by trial and error, as the error message are quite verbose:
33+
34+
```
35+
echo '{"command": "test"}' | ncat -U /run/lactd.sock
36+
37+
{"status":"error","data":"Failed to deserialize request: unknown variant `test`, expected one of `ping`, `list_devices`, `system_info`, `device_info`, `device_stats`, `device_clocks_info`, `set_fan_control`, `set_power_cap`, `set_performance_level`, `set_clocks_value` at line 1 column 18"}
38+
```
39+
40+
# Rust
41+
42+
If you want to connect to the socket from a Rust program, you can simply import either the `lact-client` or `lact-schema` (if you want to write a custom client) crates from this repository.

0 commit comments

Comments
 (0)