From 868258cfa78eb105a98db66c1227bc02638bfd47 Mon Sep 17 00:00:00 2001 From: David Carley Date: Thu, 1 Sep 2022 04:36:24 +0000 Subject: [PATCH] Display the splash screen when shutting down - Also, turn the HDMI off after a short wait --- .devcontainer/Dockerfile | 2 +- installer/config/bbctrl-poweroff.service | 15 +++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- scripts/install.sh | 5 +++++ src/py/bbctrl/Web.py | 6 ------ 6 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 installer/config/bbctrl-poweroff.service diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index be2d47e..f0c90e6 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -9,7 +9,7 @@ RUN apt update \ && apt install -y \ build-essential git wget binfmt-support qemu gcc-9 \ parted gcc-avr avr-libc avrdude python3 python3-pip python3-tornado \ - curl unzip python3-setuptools gcc-arm-linux-gnueabihf bc vim locate sudo \ + inetutils-ping curl unzip python3-setuptools gcc-arm-linux-gnueabihf bc vim locate sudo \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 \ && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ && apt install -y nodejs diff --git a/installer/config/bbctrl-poweroff.service b/installer/config/bbctrl-poweroff.service new file mode 100644 index 0000000..e4a65fa --- /dev/null +++ b/installer/config/bbctrl-poweroff.service @@ -0,0 +1,15 @@ +[Unit] +Description=Turn off HDMI at powerdown +DefaultDependencies=no +Before=umount.target + +[Service] +Type=oneshot +ExecStart=/bin/sh -c ' \ + killall xinit \ + && plymouth change-mode --shutdown show-splash \ + && sleep 10s \ + && /usr/bin/vcgencmd display_power 0 ' + +[Install] +WantedBy=poweroff.target diff --git a/package-lock.json b/package-lock.json index d4ec84a..2206680 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bbctrl", - "version": "1.0.10b12", + "version": "1.0.10b15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bbctrl", - "version": "1.0.10b12", + "version": "1.0.10b15", "hasInstallScript": true, "license": "GPL-3.0+", "dependencies": { diff --git a/package.json b/package.json index d121cc0..da6d0cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbctrl", - "version": "1.0.10b12", + "version": "1.0.10b15", "homepage": "https://onefinitycnc.com/", "repository": "https://github.com/OneFinityCNC/onefinity", "license": "GPL-3.0+", diff --git a/scripts/install.sh b/scripts/install.sh index b8c0bdb..029537b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -156,6 +156,11 @@ if $UPDATE_PY; then service bbctrl restart fi +# Install the service that turns off the screen during shutdown +cp ./installer/config/bbctrl-poweroff.service /etc/systemd/system/ +systemctl daemon-reload +systemctl enable bbctrl-poweroff + # Expand the file system if necessary chmod +x ./installer/scripts/resize_root_fs.sh ./installer/scripts/resize_root_fs.sh diff --git a/src/py/bbctrl/Web.py b/src/py/bbctrl/Web.py index cce7869..b65682b 100644 --- a/src/py/bbctrl/Web.py +++ b/src/py/bbctrl/Web.py @@ -21,18 +21,12 @@ def call_get_output(cmd): class RebootHandler(bbctrl.APIHandler): def put_ok(self): - subprocess.Popen(['plymouth', 'show-splash']) - subprocess.Popen(['plymouth', 'change-mode', '--shutdown']) - subprocess.Popen(['killall', 'xinit']) subprocess.Popen(['reboot']) class ShutdownHandler(bbctrl.APIHandler): def put_ok(self): - subprocess.Popen(['plymouth', 'show-splash']) - subprocess.Popen(['plymouth', 'change-mode', '--shutdown']) - subprocess.Popen(['killall', 'xinit']) subprocess.Popen(['shutdown', '-h', 'now'])