Hi
Adding this line to Dietpi/config.txt does not produce the desired shut-down. The same pi3B+ using Raspbian works.
Entering dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up on the CLI produces no errors. lsmod says gpio-keys is loaded (but not used).
How to proceed?
dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
@gerrond
AFAIK the syntax to load the overlay from console should be:
dtoverlay gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
dtoverlay -l then has "gpio-shutdown" in the list?
Ah:
Please try:
AFAIK the syntax to load the overlay from console should be:
dtoverlay gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
dtoverlay -l then has "gpio-shutdown" in the list?
Ah:
Code: Select all
2019-06-20 21:15:59 root@micha:/tmp# dtoverlay -h gpio-shutdown
Name: gpio-shutdown
Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin
is configured as an input key that generates KEY_POWER events.
This event is handled by systemd-logind by initiating a
shutdown. Systemd versions older than 225 need an udev rule
enable listening to the input device:
Code: Select all
systemctl unmask systemd-logind
systemctl start systemd-logind
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
─────────────────────────────────────────────────────
DietPi v6.24.1 : 12:39 - Mon 24/06/19
─────────────────────────────────────────────────────
- Device model : RPi 3 Model B+ (armv7l)
- CPU temp : 53'C : 127'F (Running warm, but safe)
- FQDN/hostname : alarmPi2
- LAN IP : 192.168.1.73 (eth0)
- MOTD : You can select the content of this banner by running: dietpi-banner
─────────────────────────────────────────────────────
DietPi Team : MichaIng (lead), Daniel Knight (founder)
Image : DietPi Core Team (pre-image: Raspbian Lite)
Web : https://DietPi.com | https://twitter.com/dietpi_
Patreon Legends : PINE64 community
Donate : https://DietPi.com/#donate
DietPi Hosting : Powered by https://MyVirtualServer.com
root@alarmPi2:~# dtoverlay gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
DTOVERLAY[error]: invalid override value '3,active_low=1,gpio_pull=up' - ignored
* Failed to set gpio_pin=3,active_low=1,gpio_pull=up
root@alarmPi2:~# dtoverlay=gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
root@alarmPi2:~# dtoverlay -l
No overlays loaded
root@alarmPi2:~# systemctl --version
systemd 232
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN
root@alarmPi2:~# systemctl unmask systemd-logind
root@alarmPi2:~# systemctl start systemd-logind
Failed to start systemd-logind.service: Unit dbus.socket not found.
root@alarmPi2:~#
DietPi v6.24.1 : 12:39 - Mon 24/06/19
─────────────────────────────────────────────────────
- Device model : RPi 3 Model B+ (armv7l)
- CPU temp : 53'C : 127'F (Running warm, but safe)
- FQDN/hostname : alarmPi2
- LAN IP : 192.168.1.73 (eth0)
- MOTD : You can select the content of this banner by running: dietpi-banner
─────────────────────────────────────────────────────
DietPi Team : MichaIng (lead), Daniel Knight (founder)
Image : DietPi Core Team (pre-image: Raspbian Lite)
Web : https://DietPi.com | https://twitter.com/dietpi_
Patreon Legends : PINE64 community
Donate : https://DietPi.com/#donate
DietPi Hosting : Powered by https://MyVirtualServer.com
root@alarmPi2:~# dtoverlay gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
DTOVERLAY[error]: invalid override value '3,active_low=1,gpio_pull=up' - ignored
* Failed to set gpio_pin=3,active_low=1,gpio_pull=up
root@alarmPi2:~# dtoverlay=gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
root@alarmPi2:~# dtoverlay -l
No overlays loaded
root@alarmPi2:~# systemctl --version
systemd 232
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN
root@alarmPi2:~# systemctl unmask systemd-logind
root@alarmPi2:~# systemctl start systemd-logind
Failed to start systemd-logind.service: Unit dbus.socket not found.
root@alarmPi2:~#
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
I have just noticed that "shutdown now" -
stops the green LED and leaves the red LED on as expected but the USB current goes up from 0A68 to 0A82 - this is not what I expected! Raspbian April 2019 current goes down to 0A21. I don't know whether it is inherrent in my dietPi or is due to the result of the dtoverlay thing.
Downloaded , uncompressed and uploaded today's 7z to card.
Accepted minimal image.
After updates, entered "shutdown now", current now falls to 0A19.
stops the green LED and leaves the red LED on as expected but the USB current goes up from 0A68 to 0A82 - this is not what I expected! Raspbian April 2019 current goes down to 0A21. I don't know whether it is inherrent in my dietPi or is due to the result of the dtoverlay thing.
Downloaded , uncompressed and uploaded today's 7z to card.
Accepted minimal image.
After updates, entered "shutdown now", current now falls to 0A19.
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
Code: Select all
root@alarmPi2:~# dtoverlay gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
DTOVERLAY[error]: invalid override value '3,active_low=1,gpio_pull=up' - ignored
* Failed to set gpio_pin=3,active_low=1,gpio_pull=up
root@alarmPi2:~# dtoverlay=gpio-shutdown gpio_pin=3,active_low=1,gpio_pull=up
root@alarmPi2:~# dtoverlay -l
No overlays loaded
Just to check: echo $dtoverlay
It looks like all parameters need to be separated by spaces (separate arguments):
Code: Select all
dtoverlay gpio-shutdown gpio_pin=3 active_low=1 gpio_pull=up
dtoverlay -l
dtoverlay -h gpio-shutdown shows dtoverlay=gpio-shutdown,<param>=<val>, but this is only the syntax for config.txt, not the command line. This is shown by the general dtoverlay usage info:
dtoverlay <overlay> [<param>=<val>...]
But there again one cannot derive how to add multiple parameters. However space separated makes sense as these are then added as individual arguments to the command.
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
I have the same problem with a Pi Zero W running v6.25.3. I have the shutdown button working on a Pi3+ running Debian.
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
systemd-logind is unmasked? systemctl unmask systemd-logind && systemctl start systemd-logind
And nothing else blocks/uses the GPIO pins, e.g. I2C, SPI or UART (serial device/console)?
ls -Al /dev gives an overview of enabled devices, ttyS0, ttyAMA0, i2c*, and spi* are examples that use GPIO pins.
And nothing else blocks/uses the GPIO pins, e.g. I2C, SPI or UART (serial device/console)?
ls -Al /dev gives an overview of enabled devices, ttyS0, ttyAMA0, i2c*, and spi* are examples that use GPIO pins.
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
I ran those two commands didn't change anything.
Running ls -Al /dev returned this line amongst others
lrwxrwxrwx 1 root root 7 Aug 17 19:51 serial1 -> ttyAMA0
Running ls -Al /dev returned this line amongst others
lrwxrwxrwx 1 root root 7 Aug 17 19:51 serial1 -> ttyAMA0
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
@johncolman
Try to disable this serial device, as long as you don't use any serial/UART login terminal:
/DietPi/dietpi/func/dietpi-set_hardware serialconsole disable
Although I am not 100% sure if this disables /dev/ttyAMA0. It disables any boot messages and login console attached to this device, but via usual methods one can only disable /dev/ttyS0 completely on RPi models with WiFi+Bluetooth. /dev/ttyAMA0 shows up when Bluetooth is disabled, since otherwise Bluetooth uses/block this. /dev/ttyAMA0 uses GPIO 14 & 15 (so pins 8 & 10) AFAIK, so these cannot not be used for the shutdown button.
Aside the hardware side, you assured the user that executes the script has sufficient permissions (e.g. part of "gpio" group)? dtoverlay declaration in /DietPi/config.txt (and /boot/config.txt on Raspbian) is exactly the same?
lsmod lists gpio_keys?
Try to disable this serial device, as long as you don't use any serial/UART login terminal:
/DietPi/dietpi/func/dietpi-set_hardware serialconsole disable
Although I am not 100% sure if this disables /dev/ttyAMA0. It disables any boot messages and login console attached to this device, but via usual methods one can only disable /dev/ttyS0 completely on RPi models with WiFi+Bluetooth. /dev/ttyAMA0 shows up when Bluetooth is disabled, since otherwise Bluetooth uses/block this. /dev/ttyAMA0 uses GPIO 14 & 15 (so pins 8 & 10) AFAIK, so these cannot not be used for the shutdown button.
Aside the hardware side, you assured the user that executes the script has sufficient permissions (e.g. part of "gpio" group)? dtoverlay declaration in /DietPi/config.txt (and /boot/config.txt on Raspbian) is exactly the same?
lsmod lists gpio_keys?
Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
I ran
/DietPi/dietpi/func/dietpi-set_hardware serialconsole disable
No change.
I don't have a script running , just the dtoverlay line added to the DietPi.txt, so haven't changed any permissions.
I have checked both txt files are the same.
lsmod lists gpio_keys just returns Usage: lsmod
/DietPi/dietpi/func/dietpi-set_hardware serialconsole disable
No change.
I don't have a script running , just the dtoverlay line added to the DietPi.txt, so haven't changed any permissions.
I have checked both txt files are the same.
lsmod lists gpio_keys just returns Usage: lsmod