diff options
| -rw-r--r-- | buttonctl/Makefile | 4 | ||||
| -rw-r--r-- | buttonctl/buttond.py (renamed from buttonctl/buttonctl.py) | 5 | ||||
| -rw-r--r-- | buttonctl/systemd/buttond.service (renamed from buttonctl/systemd/button.service) | 2 | ||||
| -rw-r--r-- | ledctl/Makefile | 1 | ||||
| -rw-r--r-- | ledctl/README.md | 13 |
5 files changed, 17 insertions, 8 deletions
diff --git a/buttonctl/Makefile b/buttonctl/Makefile new file mode 100644 index 0000000..7b8c933 --- /dev/null +++ b/buttonctl/Makefile @@ -0,0 +1,4 @@ +install: + install -m 744 buttond.py /usr/bin/buttond + install -m 644 systemd/buttond.service /etc/systemd/system/buttond.service + systemctl daemon-reload diff --git a/buttonctl/buttonctl.py b/buttonctl/buttond.py index 26878f1..661b2f6 100644 --- a/buttonctl/buttonctl.py +++ b/buttonctl/buttond.py @@ -2,13 +2,16 @@ import RPi.GPIO as GPIO import subprocess +import sys +print ('Watching soft button GPIO26 for button presses...', file=sys.stderr); + GPIO.setmode(GPIO.BCM) GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.wait_for_edge(26, GPIO.FALLING) -print ('button pressed') +print ('Soft button pressed, shutting down...', file=sys.stderr) subprocess.call(['ledctl', 'boot'], shell=False) diff --git a/buttonctl/systemd/button.service b/buttonctl/systemd/buttond.service index e77edd2..e1975c9 100644 --- a/buttonctl/systemd/button.service +++ b/buttonctl/systemd/buttond.service @@ -4,7 +4,7 @@ After=local-fs.target [Service] Type=simple -ExecStart=/usr/bin/buttonctl +ExecStart=/usr/bin/buttond [Install] WantedBy=multi-user.target diff --git a/ledctl/Makefile b/ledctl/Makefile index 2777bb8..090ef1d 100644 --- a/ledctl/Makefile +++ b/ledctl/Makefile @@ -3,3 +3,4 @@ install: ln -sf /usr/bin/ledctl /usr/lib/systemd/system-shutdown/ install -m 644 systemd/led-boot.service /etc/systemd/system/led-boot.service install -m 644 systemd/led-ready.service /etc/systemd/system/led-ready.service + systemctl daemon-reload diff --git a/ledctl/README.md b/ledctl/README.md index 81eaf08..770d531 100644 --- a/ledctl/README.md +++ b/ledctl/README.md @@ -25,14 +25,15 @@ systemctl enable led-boot led-ready ## Usage -Use the ```ledctl``` script to set the LED color. +Use the `ledctl` script to set the LED color. -``` +` ledctl <color> -``` +` Valid colors are - on, off - red, green, blue, yellow, pink, cyan - #rrggbb + +- on, off +- red, green, blue, yellow, pink, cyan +- \#rrggbb e.g. #ff0000 |
