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:
ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
ATTRS{keys}=="116", TAG+="power-switch"
This overlay only handles shutdown. After shutdown, the system
can be powered up again by driving GPIO3 low. The default
configuration uses GPIO3 with a pullup, so if you connect a
button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
you get a shutdown and power-up button.
Load: dtoverlay=gpio-shutdown,<param>=<val>
Params: gpio_pin GPIO pin to trigger on (default 3)
active_low When this is 1 (active low), a falling
edge generates a key down event and a
rising edge generates a key up event.
When this is 0 (active high), this is
reversed. The default is 1 (active low).
gpio_pull Desired pull-up/down state (off, down, up)
Default is "up".
Note that the default pin (GPIO3) has an
external pullup.
是不是得用一个无锁开关或者是一个按钮才行啊?
我焊了一个自锁开关,结果发现只响应按下去的那一次,现在开机关机要按两次(先复位再按下)才能实现了
自锁开关是比较麻烦了,就用一个普通的按钮就行,检测到低电平就关机,关机后再检测到低电平就开机
哦简单地解决了,我把自锁开关打开把里面自锁的簧片拆了
哈哈够狠,暴力解决
我用了和文章图片中一样的树莓派无锁开关,配置好config文件,重启,按按钮没反应,
但是跳过按钮直接短接GPIO 5、6的电线可以实现关机/开机,已经更换了2个按钮都不行,求指导。谢谢!