This is the driver for the petrockblock.com PowerBlock, which is an extension board for the Raspberry Pi (TM). The driver itself is denoted as powerblock in the following. The driver provides a service for interacting with the power button signal as well as driving the optionally attached LED.
❗ The following description is intended to be used in combination with a Raspberry Pi and a Linux-based operating system running on the Raspberry Pi. There is a driver for Windows 10 IoT Core that can be found at https://github.com/petrockblog/PowerBlockWinIoT/releases ❗
There comes an installation script with this reposity that does all the steps described below: install.sh
This script
compiles the driver, installs the binary and configuration files, and installs the PowerBlock service.
To run the quick installation, you just need to call this one line from the Raspbian console
wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master/install.sh | sudo bash
To uninstall the service you can simply call sudo ./uninstall.sh
from within the PowerBlock
directory.
The configuration file of powerblock is located at /etc/powerblockconfig.cfg
. It uses simple .ini file syntax = for setting the the values of its configuration parameters.
The parameters are explained in detail in the following:
activated
: Can be set to1
: Activates the handling of the power switch signals of the PowerBlock.0
: Deactivates the handling of the power switch signals of the PowerBlock.
statuspin
: Raspberry BCM pin used for status signaling (default: 17) connects to S2 on PowerBlockshutdownpin
: Raspberry BCM pin used for shutdown signaling (default: 18) connects to S1 on Powerblocklogging
: Enables or disables logging via syslog to /var/log/syslog. The logging is enabled if set to 1.
The PowerBlock driver logs certain events in the file /var/log/syslog
.
When the driver observes a shutdown signal from the PowerBlock, a shutdown Bash script is called. You can find and edit
it at /etc/powerblockswitchoff.sh
.
This section is about installing the PowerBlock service on LibreELEC. In the following, it is assumed that we install the driver on a fresh, unmodified LibreELEC installation.
First, use SSH to log into the running LibreELEC instance. This can be done, e.g., with the command ssh root@IP_OF_LIBREELEC
. The default password is libreelec
.
Being logged in, the actual driver installation is done with this command:
wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master/install_libreelec.sh | bash
And that's it!
Have fun!
-Florian petrockblock.com