Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GPIO on SUNXI H3



Hi Sascha --

Button presses go through the sysmon_pswitch subsystem, and actions are performed based on the "linux,code" property on the node.

 linux,code = 116: power button
 linux,code = 142: sleep button
 all other values: hotkey button

Your sw4 button uses code 256 so it will be treated as a hotkey button.

In /etc/rc.conf you'll want to set powerd=YES and then edit the
/etc/powerd/scripts/hotkey_button script to handle it. The hotkey events come in by name, so ${1} in that script will be "sw4" and ${2} will be either "pressed" or "released".

Cheers,
Jared


On Tue, 11 Jul 2017, wilde%sha-bang.de@localhost wrote:

Jared McNeill <jmcneill%invisible.ca@localhost> wrote:
  sunxi# sysctl hw.led
  hw.led.orangepi_green_pwr = 1
  hw.led.orangepi_red_status = 0
  sunxi# sysctl -w hw.led.orangepi_red_status=1
  hw.led.orangepi_red_status: 0 -> 1
  sunxi# sysctl hw.led
  hw.led.orangepi_green_pwr = 1
  hw.led.orangepi_red_status = 1

Hi,

I wonder if there is a similar interface (or any) for the on board
button.  It is defined in the dtb just as the leds are and the kernel
seems to recognize it:

 gpiokeys0 at fdt0: sw4

cheers
sascha



Home | Main Index | Thread Index | Old Index