View: 6953|Reply: 1

Orange Pi Lite - power button events ?

[Copy link]

1

threads

1

posts

12

credits

Novice

Rank: 1

credits
12
Published in 2017-2-10 18:51:38 | Show all floors |Read mode
Hi guys,
it's my first post, so excuse me if I miss some rules (and for my bad english).


I've just got a small OrangePiLite, put ARMBIAN 5.25 on, tested some thing all around.


I see a power button , but pressing (short or long) nothing happens.


1 - First question
Is it really unused? Isn't there a way to enable event on pushing it ?




So I looked into interrupts tables with
watch cat /proc/interrupts

and noticed two values incrementing when I pushed/released it (counter 3 and 77 for CPU0)


           CPU0       CPU1       CPU2       CPU3      
  3:          3          0          0          0  sunxi_gpio_irq_chip  gk_EINT

77:          3          0          0          0       GIC  PL


2 - Second question
Hot could I monitor this event ?


Another thing I notice is correspondence with GPIO355 so, I wrote this tiny quick&dirty bash script to use it ...

#!/bin/bash
#modprobe gpio_sunxi
if [ ! -d /sys/class/gpio/gpio355 ]; then
  echo 355 > /sys/class/gpio/export
fi
if [ -d /sys/class/gpio/gpio355 ]; then
  echo "in" > /sys/class/gpio/gpio355/direction
  echo ERROR - LISTENING FOR EVENT ON GPIO355
  while ( true ) ; do
    if [ $(cat /sys/class/gpio/gpio355/value) -eq "0" ] ; then
      echo "RESET"
    fi
    sleep 1
  done
else
  echo ERROR - CANNOT ENABLE GPIO355
fi

but ...

3 - Third question
Which is the real function of this this button? and the correct (and canonical) way to read its events ?

Thanks in advance, for any suggetsion.


--
AlexIT

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2017-2-11 22:55:28 | Show all floors
Edited by nopnop2002 at 2017-2-11 23:29

$ sudo apt-get update
$ sudo apt-get install acpid
$ sudo /etc/init.d/acpid restart
$ acpi_listen

When you push power button, you will see this.

button/power PBTN 00000080 00000000
button/power PBTN 00000080 00000000
button/power PBTN 00000080 00000000
button/power PBTN 00000080 00000000
button/power PBTN 00000080 00000000

Make [/etc/acpi/events/button_power]

event=button/power
action=/sbin/shutdown -r now

$ sudo /etc/init.d/acpid restart

When you push power button, you can restart OPI.

You can read power button event.

http://www.orangepi.org/orangepi ... =940&extra=page%3D1
















You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list