jiriks74

jiriks74 / element14-libreelec

Last active 3 months ago

Like 0

jiriks74 revised this gist 2 years ago · c8228b9

1 file changed, 5 insertions, 2 deletions

README.md
@@ -23,14 +23,17 @@ Due to hardware limitations in the Pi-Desktop this button turns off the Raspberr
23 23
24 24 ## Manual setup
25 25
26 - If you're uncomfortable running a scripts from the internet you can fetch the files yourself and save them like this:
26 + If you're uncomfortable running scripts from the internet you can fetch the files yourself and save them like this:
27 27
28 28 ```bash
29 29 /storage/scripts/pidesktop/powerkey.py
30 30 /storage/.config/system.d/pidesktop-powerkey.service
31 31 ```
32 32
33 - Then you need to run `systemctl enable pidesktop-powerkey` to start the scripts on boot and `systemctl start pidekstop-powerkey` to start it now.
33 + Then you need to run
34 + 1. `systemctl daemon-reload` to load the service file
35 + 2. `systemctl enable pidesktop-powerkey` to start the service on boot
36 + 3. `systemctl start pidekstop-powerkey` to start the service now
34 37
35 38 The light on the case should blink once to indicate that the script initialized successfully.
36 39

jiriks74 revised this gist 2 years ago · 33dac54

1 file changed, 1 insertion, 1 deletion

README.md
@@ -37,7 +37,7 @@ The light on the case should blink once to indicate that the script initialized
37 37 > If the service is already running (you started a running pidesktop-powerkey service) the ligt will not blink.
38 38 > Reboot the device and watch for a blink during the boot process or restart the service using `systemctl restart pidesktop-powerkey`.
39 39
40 - ## Usage
40 + ## Usage of the Pi-Desktop button
41 41
42 42 The power key can do 2 things on the Pi Desktop
43 43 - When held for 2 seconds it sends a power off signal to the Pi (only once, more keypresses don't do anything)

jiriks74 revised this gist 2 years ago · 2f2fc6a

1 file changed, 7 insertions, 1 deletion

README.md
@@ -16,7 +16,10 @@ Due to hardware limitations in the Pi-Desktop this button turns off the Raspberr
16 16 3. SSH to the device: `ssh root@aaa.bbb.c.ddd`
17 17 4. Run the install script: `curl -sSL https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/install.sh | bash`
18 18 5. The light should blink once to indicate that the power button script started successfully
19 - - It will blink once on every boot to indicate that the Pi comunicates with the power supply
19 + - It will blink once/twice on every boot to indicate that the Pi comunicates with the power supply
20 +
21 + > If the service is already running (you ran the script more than once) the ligt will not blink.
22 + > Reboot the device and watch for a blink during the boot process or restart the service using `systemctl restart pidesktop-powerkey`.
20 23
21 24 ## Manual setup
22 25
@@ -31,6 +34,9 @@ Then you need to run `systemctl enable pidesktop-powerkey` to start the scripts
31 34
32 35 The light on the case should blink once to indicate that the script initialized successfully.
33 36
37 + > If the service is already running (you started a running pidesktop-powerkey service) the ligt will not blink.
38 + > Reboot the device and watch for a blink during the boot process or restart the service using `systemctl restart pidesktop-powerkey`.
39 +
34 40 ## Usage
35 41
36 42 The power key can do 2 things on the Pi Desktop

jiriks74 revised this gist 2 years ago · 1e0448a

1 file changed, 2 insertions, 1 deletion

install.sh
@@ -17,7 +17,8 @@ echo "Watch the case now. The light should blink once/twice to indicate that the
17 17 sleep 5
18 18 systemctl start pidesktop-powerkey
19 19
20 - echo "Files installed and set up."
20 + echo ""
21 + echo "Setup finished."
21 22 echo "The power button should work now."
22 23 echo ""
23 24 echo "Disclaimer: Reboot might not be possible anymore. The Pi-Desktop cuts power after 30 seconds of no response from the Pi."

jiriks74 revised this gist 2 years ago · d94c775

1 file changed, 5 insertions

install.sh
@@ -1,13 +1,18 @@
1 1 #!/bin/bash
2 2 set -e
3 3
4 + echo "Creating directories..."
4 5 mkdir -p /storage/scripts/pidesktop
5 6
7 + echo "Downloading files..."
6 8 curl -s "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/powerkey.py" -o /storage/scripts/pidesktop/powerkey.py
7 9 curl -s "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/pidesktop-powerkey.service" -o /storage/.config/system.d/pidesktop-powerkey.service
10 + echo "Files downloaded successfully."
8 11
12 + echo "Loading the systemd service..."
9 13 systemctl daemon-reload
10 14 systemctl enable pidesktop-powerkey
15 + echo "Service loaded. Starting the service..."
11 16 echo "Watch the case now. The light should blink once/twice to indicate that the the script is working."
12 17 sleep 5
13 18 systemctl start pidesktop-powerkey

jiriks74 revised this gist 2 years ago · e3597aa

1 file changed, 3 insertions, 3 deletions

install.sh
@@ -3,12 +3,12 @@ set -e
3 3
4 4 mkdir -p /storage/scripts/pidesktop
5 5
6 - curl "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/powerkey.py" -o /storage/scripts/pidesktop/powerkey.py
7 - curl "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/pidesktop-powerkey.service" -o /storage/.config/system.d/pidesktop-powerkey.service
6 + curl -s "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/powerkey.py" -o /storage/scripts/pidesktop/powerkey.py
7 + curl -s "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/pidesktop-powerkey.service" -o /storage/.config/system.d/pidesktop-powerkey.service
8 8
9 9 systemctl daemon-reload
10 10 systemctl enable pidesktop-powerkey
11 - echo "Watch the case now. The light should blink once to indicate that the the script is working"
11 + echo "Watch the case now. The light should blink once/twice to indicate that the the script is working."
12 12 sleep 5
13 13 systemctl start pidesktop-powerkey
14 14

jiriks74 revised this gist 2 years ago · db57c0b

3 files changed, 11 insertions, 3 deletions

install.sh
@@ -8,4 +8,12 @@ curl "https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/pidesktop
8 8
9 9 systemctl daemon-reload
10 10 systemctl enable pidesktop-powerkey
11 - systemctl start pidesktop-powerkey
11 + echo "Watch the case now. The light should blink once to indicate that the the script is working"
12 + sleep 5
13 + systemctl start pidesktop-powerkey
14 +
15 + echo "Files installed and set up."
16 + echo "The power button should work now."
17 + echo ""
18 + echo "Disclaimer: Reboot might not be possible anymore. The Pi-Desktop cuts power after 30 seconds of no response from the Pi."
19 + echo " If the Pi takes more than 30 seconds to reboot the Pi-Desktop will cut it's power and you'll have to turn it on again."
pidesktop-powerkey.service
@@ -8,4 +8,4 @@ User=root
8 8 ExecStart=/usr/bin/python /storage/scripts/pidesktop/powerkey.py
9 9
10 10 [Install]
11 - WantedBy=multi-user.target
11 + WantedBy=multi-user.target
powerkey.py
@@ -30,4 +30,4 @@ pwrBtn.when_released = powerkey_pressed # Setup callback for the power off signa
30 30 print("pidesktop: power button monitor enabled")
31 31
32 32 while True: # Keep the service running
33 - time.sleep(10)
33 + time.sleep(10)

jiriks74 revised this gist 2 years ago · a97ed78

1 file changed, 1 insertion, 1 deletion

pidesktop-powerkey.service
@@ -5,7 +5,7 @@ After=local-fs.target
5 5 [Service]
6 6 Type=simple
7 7 User=root
8 - ExecStart=/usr/bin/python3.11 /storage/scripts/pidesktop/powerkey.py
8 + ExecStart=/usr/bin/python /storage/scripts/pidesktop/powerkey.py
9 9
10 10 [Install]
11 11 WantedBy=multi-user.target

jiriks74 revised this gist 2 years ago · 93f09b3

No changes

jiriks74 revised this gist 2 years ago · 159cdf7

No changes