Skip to content

Commit

Permalink
Release new version! (#84)
Browse files Browse the repository at this point in the history
- Daemon rewrite with JSON API
- GTK4 UI
- Voltage control on vega20+
- Custom fan curve points in GUI
- pkger packaging
  • Loading branch information
ilya-zlobintsev authored Feb 25, 2023
2 parents 49535c9 + 7ed5d33 commit 2108864
Show file tree
Hide file tree
Showing 91 changed files with 4,911 additions and 5,556 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build packages

on:
push:
branches: ['v2', 'master']

jobs:
build-packages:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install pkger
run: |
curl -L -o /tmp/pkger.deb https://github.com/vv9k/pkger/releases/download/0.11.0/pkger-0.11.0-0.amd64.deb
sudo apt -y install /tmp/pkger.deb
- name: Build packages
run: pkger -c .pkger.yml build lact

- name: Copy release files
run: |
OUT_DIR=$PWD/release-artifacts
mkdir -p $OUT_DIR
pushd pkg/output
for DISTRO in $(ls); do
cd $DISTRO
rm -f *.src.rpm
for FILE in $(ls); do
NAME="${FILE%.*}"
EXT="${FILE##*.}"
OUT_NAME="$OUT_DIR/$NAME.$DISTRO.$EXT"
cp $FILE $OUT_NAME
done
cd ..
done
popd
- name: Create release
uses: ncipollo/[email protected]
with:
removeArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "release-artifacts/*"
body: ${{ github.event.head_commit.message }}
prerelease: true
name: Test release
tag: test-build

- name: Update test-build tag
run: |
git tag -f test-build
git push -f origin test-build
shell: bash

11 changes: 6 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ env:

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

steps:
- uses: actions/checkout@v2
- name: Update repos
run: sudo apt update
- name: Install dependencies
run: sudo apt install libgtk-3-dev libvulkan-dev
run: sudo apt install libgtk-4-dev pkg-config libvulkan-dev
- name: Build
run: cargo build
- name: Run tests
run: cargo test --verbose
run: cargo test --verbose --no-default-features

check-format:
runs-on: ubuntu-20.04

runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v2
- name: install rustfmt
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
/target
AppDir/
*.glade\~
*.AppImage
*.AppImage.zsync
appimage-build/
*.stignore
pkg/output
17 changes: 17 additions & 0 deletions .pkger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
recipes_dir: pkg/recipes
output_dir: pkg/output
images_dir: pkg/images
log_dir: ~
runtime_uri: ~
gpg_key: ~
gpg_name: ~
ssh: ~
images:
- name: debian-12
target: deb
- name: fedora-37
target: rpm
- name: ubuntu-2204
target: deb
custom_simple_images: ~
138 changes: 0 additions & 138 deletions .vscode/launch.json

This file was deleted.

42 changes: 42 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Description

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.

The API expects newline-separated JSON objects, and returns a JSON object for every request.

The general format of requests looks like:
```
{"command": "command_name", "args": {}}
```
Note that the type of `args` depends on the specific request, and may be ommited in some cases.

The response looks like this:
```
{"status": "ok|error", "data": {}}
```
Same as `args` in requests, `data` can be of a different type and may not be present depending on the specific request.

You can try sending commands to socket interactively with `ncat`:
```
echo '{"command": "list_devices"}' | ncat -U /run/lactd.sock
```
Example response:
```
{"status":"ok","data":[{"id":"1002:687F-1043:0555-0000:0b:00.0","name":"Vega 10 XL/XT [Radeon RX Vega 56/64]"}]}
```

# Commands

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).

It should also be fairly easy to figure out the API by trial and error, as the error message are quite verbose:

```
echo '{"command": "test"}' | ncat -U /run/lactd.sock
{"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"}
```

# Rust

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.
Loading

0 comments on commit 2108864

Please sign in to comment.