-
Notifications
You must be signed in to change notification settings - Fork 22
Build and install from source
The build process doesn't work properly on stable SteamOS (3.4) anymore. The reinstallation of dependencies with missing files does not work because of expired GPG signatures in SteamOS 3.4 repositories.
To make build process possible on SteamOS 3.4 it is necessary to disable signature check for pacman
.
To do that, edit the file /etc/pacman.conf
. Find the first line starting with SigLevel =
and change it to:
SigLevel = Never
Then it will be possible to reinstall required dependencies with make prepare
.
Beware: Changing pacman.conf
file makes its content persistent over OS updates.
When dependencies are properly reinstalled, it is advised to restore the /etc/pacman.conf
file. Simply editing it is not the best way, because it will leave pacman.conf
contents persistent over OS updates. To properly restore the file, delete it from /etc overlay's upper directory:
rm /var/lib/overlays/etc/upper/pacman.conf
As of this day, above process is not needed for SteamOS 3.5 (current Beta version of SteamOS).
If you haven't used sudo before, first run passwd
to set a password.
If you haven't used make before, first run these commands.
sudo steamos-readonly disable
pacman -S --noconfirm make
sudo steamos-readonly enable
To build the server and install it as a service/update it, switch to desktop mode, open terminal and enter following commands in order:
cd
git clone https://github.com/kmicki/SteamDeckGyroDSU.git
cd SteamDeckGyroDSU
git checkout master
git pull
make install
After that, restart the system and the DSU server should be active.
To disable the server, use command:
systemctl --user disable sdgyrodsu.service
systemctl --user stop sdgyrodsu.service
To enable it again:
systemctl --user enable --now sdgyrodsu.service
Makefile for SteamDeckGyroDSU contains several targets. The most useful are:
-
make
ormake release
: Build the server. The binary executable will be located at:bin/release/sdgyrodsu
-
make debug
: Build the server for debugging (the difference is no-O3
flag passed tog++
). The binary:bin/debug/sdgyrodsu
- both build commands invoke
prepare
target before building to make sure dependency header files are present (see Dependencies below). If any headers are missing, password will be requested (sudo) to reinstall dependency packages.
- both build commands invoke
-
make createpkg
: Create a binary package (pkgbin/SteamDeckGyroDSU.zip) -
make install
: Prepare, build and install as a service -
make clean
: Clean binaries and objects (bin/ and obj/ directories) -
make cleanall
: Clean all artifacts including binaries, objects and binary package
The program is for Steam Deck specifically so instructions are for building on Steam Deck.
Steps below (reinstall dependencies+build+grant permissions+install as a service) are included in Makefile. Follow the steps if you don't want to use make
.
Repository depends on libraries that are already installed in the Steam Deck's system. Unfortunately, even though the libraries are there, the header files are not, so they have to be reinstalled.
Those packages are:
- gcc
- glibc
- linux-api-headers
- ncurses
- systemd-libs
- hidapi
To do that:
sudo steamos-readonly disable
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman -S --noconfirm gcc
sudo pacman -S --noconfirm glibc
sudo pacman -S --noconfirm linux-api-headers
sudo pacman -S --noconfirm ncurses
sudo pacman -S --noconfirm systemd-libs
sudo pacman -S --noconfirm hidapi
sudo steamos-readonly enable
As you see above, this requires disabling read only filesystem. It is necessary only to reinstall those packages. Building/installing/running a server is possible with read-only filesystem enabled.
Build using following commands in a project's directory:
mkdir -p bin/release
g++ -std=c++2a $(find inc -type d -printf '-I %p\n') -O3 -g $(find src -type f -iregex '.*\.cpp' -printf '%p\n') -pthread -lncurses -lsystemd -lhidapi-hidraw -o bin/release/sdgyrodsu
If the server was installed using make install
, it should be running as a service after system restart. Otherwise, see below.
When program is running, the DSU (cemuhook protocol) server providing motion data is available at Deck's IP address and UDP port 26760.
Granting following permissions is not needed for versions 2.0 and above
Skip this section unless you changed the data source to hiddev file in main.cpp
by setting cUseHiddevFile = true
.
Use following commands to create a new user group and add current user to the group and then grant that group permission to read from hiddev file of Steam Deck controls (run those in a repository's main directory):
sudo groupadd usbaccess
sudo gpasswd -a $USER usbaccess
sudo cp pkg/51-deck-controls.rules /etc/udev/rules.d/
Then restart the system.
Remark: Above command will fail when checked out source is from version 2.0 or above, because the .rules file is missing. The file can be obtained from source of version 1.16.
If you want to run server automatically when Steam Deck is ON, install it as a service.
First prepare permissions as described in a previous section (service will be non-root).
Then run those commands from repository directory:
mkdir -p $HOME/sdgyrodsu
cp bin/sdgyrodsu $HOME/sdgyrodsu/
cp pkg/sdgyrodsu.service $HOME/.config/systemd/user/
systemctl --user enable --now sdgyrodsu.service
You can use the server without installing a user service.
./bin/sdgyrodsu