Skip to content

Commit

Permalink
Merge pull request #4 from mcgillij/readme_update
Browse files Browse the repository at this point in the history
Readme update
  • Loading branch information
mcgillij authored Feb 21, 2021
2 parents df9edb5 + 0060f74 commit c778410
Showing 1 changed file with 87 additions and 23 deletions.
110 changes: 87 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,10 @@ Also allows you to revert the fan control to the systems default behavior by usi

This will dump out the default configuration that would get generated for `/etc/amdfan.yml` when you first run it as a service. This allows you to configure the settings prior to running it as a daemon if you wish.

## Service

This is just a convenience method for dumping out the `amdfan.service` that would get installed if you used a package manager to install amdfan. Useful if you installed the module via `pip`, `pipenv` or `poetry` vs using the package manager version.



## Note

You will need to ```sudo``` to apply any changes to the fan speeds, but you can monitor them with regular user permissions.

# Config File example
Running `amdfan --configuration` will output the following block to STDOUT.

``` yaml
``` bash
#Fan Control Matrix.
# [<Temp in C>,<Fanspeed in %>]
speed_matrix:
- [4, 4]
Expand All @@ -95,19 +86,73 @@ speed_matrix:
# Optional configuration options
#
# Allows for some leeway +/- temp, as to not constantly change fan speed
# threshold: 2
# threshold: 4
#
# Frequency will change how often we probe for the temp
# frequency: 5
#
# While frequency and threshold are optional, I highly recommend finding
# settings that work for you. I've included the defaults I use above.
#
# cards:
# can be any card returned from `ls /sys/class/drm | grep "^card[[:digit:]]$"`
# - card0
```
You can use this to generate your configuration by doing ``amdfan --configuration > amdfan.yml``, you can then modify the settings and place it in ``/etc/amdfan.yml`` for when you would like to run it as a service.

## Service

This is just a convenience method for dumping out the `amdfan.service` that would get installed if you used a package manager to install amdfan. Useful if you installed the module via `pip`, `pipenv` or `poetry`.

Running `amdfan --service` will output the following block to STDOUT.

``` bash
[Unit]
Description=amdfan controller

[Service]
ExecStart=/usr/bin/amdfan --daemon
Restart=always

[Install]
WantedBy=multi-user.target
```

# Note

Monitoring fan speeds and temperatures can run with regular user permissions.
`root` permissions are required for changing the settings / running as a daemon.

# Recommended settings

Below is the settings that I use on my machines to control the fan curve without too much fuss, but you should find a frequency and threshold setting that works for your workloads.

`/etc/amdfan.yml`
``` bash
speed_matrix:
- [4, 4]
- [30, 33]
- [45, 50]
- [60, 66]
- [65, 69]
- [70, 75]
- [75, 89]
- [80, 100]

threshold: 4
frequency: 5
```

## Running the systemd service
## Installing the systemd service
If you installed via the AUR, the service is already installed, and you just need to *start/enable* it. If you installed via pip/pipenv or poetry, you can generate your systemd service file with the following command.

To run the service, if you installed amdfan using the AUR package, you can run the following commands to **start/enable** the service.
``` bash
amdfan --service > amdfan.service && sudo mv amdfan.service /usr/lib/systemd/system/
```

## Starting the systemd service

To run the service, you can run the following commands to **start/enable** the service.

``` bash
sudo systemctl start amdfan
Expand All @@ -127,18 +172,37 @@ You can check the systemd service status with the following command:
systemctl status amdfan
```

## Building Python package
Requires Poetry to be installed

``` bash
poetry build
```

## Building Arch package
## Building Arch AUR package

Building the Arch package assumes you already have a chroot env setup to build packages.

```bash
poetry build
git clone https://aur.archlinux.org/amdfan.git
cd amdfan/
makechrootpkg -c -r $HOME/$CHROOT
```

## Installing the Arch package

``` bash
sudo pacman -U --asdeps amdfan-*-any.pkg.tar.zst
```

# Installing from PyPi
You can also install amdfan from pypi using something like poetry.

``` bash
poetry init
poetry add amdfan
poetry run amdfan --help
```

# Building Python package
Requires [poetry](https://python-poetry.org/) to be installed

``` bash
git clone [email protected]:mcgillij/amdfan.git
cd amdfan/
poetry build
```

0 comments on commit c778410

Please sign in to comment.