Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions scheduler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,28 @@ FROM balenalib/raspberrypi3-alpine
COPY scripts /usr/src/
RUN chmod +x /usr/src/*.sh

RUN apk --no-cache add raspberrypi raspberrypi-libs raspberrypi-dev alpine-sdk \
eudev-dev python3-dev libxrandr-dev swig \
p8-platform-dev cmake && \
adduser -S builder -G abuild

USER builder

RUN cd && \
wget https://git.alpinelinux.org/aports/plain/community/libcec/APKBUILD && \
sed -i \
-e '23a-DRPI_INCLUDE_DIR=/opt/vc/include \\' \
-e '23a-DRPI_LIB_DIR=/opt/vc/lib \\' \
APKBUILD && \
abuild-keygen -a -i && \
abuild

USER root

RUN apk --allow-untrusted --no-cache add \
/home/builder/packages/home/*/libcec-4*.apk && \
deluser --remove-home builder && \
apk del raspberrypi-dev alpine-sdk eudev-dev python3-dev libxrandr-dev \
swig p8-platform-dev cmake

CMD /usr/src/start.sh
12 changes: 11 additions & 1 deletion scheduler/scripts/backlight_off.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
#!/bin/bash
echo -n 1 > /sys/class/backlight/rpi_backlight/bl_power

export PATH="$PATH:/opt/vc/bin/"
export LD_LIBRARY_PATH="/opt/vc/lib/"

output=$(tvservice -s)

if [[ $output =~ "0x400000 [LCD]" ]]; then
echo -n 1 > /sys/class/backlight/rpi_backlight/bl_power
else
echo standby 0 | cec-client -d 1 -s
fi
12 changes: 11 additions & 1 deletion scheduler/scripts/backlight_on.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
#!/bin/bash
echo -n 0 > /sys/class/backlight/rpi_backlight/bl_power

export PATH="$PATH:/opt/vc/bin/"
export LD_LIBRARY_PATH="/opt/vc/lib/"

output=$(tvservice -s)

if [[ $output =~ "0x400000 [LCD]" ]]; then
echo -n 0 > /sys/class/backlight/rpi_backlight/bl_power
else
echo as 0 | cec-client -d 1 -s
fi
8 changes: 6 additions & 2 deletions scheduler/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash

if [ ! -z ${ENABLE_BACKLIGHT_TIMER+x} ] && [ "$ENABLE_BACKLIGHT_TIMER" -eq "1" ]
then
(crontab -l; echo "${BACKLIGHT_ON:-0 8 * * *} /usr/src/backlight_on.sh") | crontab -
(crontab -l; echo "${BACKLIGHT_OFF:-0 23 * * *} /usr/src/backlight_off.sh") | crontab -
(
crontab -l
echo "${BACKLIGHT_ON:-0 8 * * *} /usr/src/backlight_on.sh"
echo "${BACKLIGHT_OFF:-0 23 * * *} /usr/src/backlight_off.sh"
) | crontab -
fi

crond -f