DC Power IN Power-ON Switch Reset Switch -- Batt Required
#6
(06-24-2016, 02:15 PM)xalius Wrote: You can test if your powerbutton sends a keycode with evtest, the driver basically registers the button like another keyboard:


Code:
ubuntu@pine64:~$ sudo apt-get install evtest

Reading package lists... Done
Building dependency tree
Reading state information... Done
evtest is already the newest version (1:1.33-1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

ubuntu@pine64:~$ sudo evtest

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      sunxi-keyboard
/dev/input/event1:      axp81x-supplyer
/dev/input/event2:      sunxi-ths
/dev/input/event3:      audiocodec sunxi Audio Jack
/dev/input/event4:      sunxi_ir_recv
/dev/input/event5:      MCE IR Keyboard/Mouse (sunxi-rc-recv)

Select the device event number [0-5]: 1

Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "axp81x-supplyer"
Supported events:
 Event type 0 (EV_SYN)
 Event type 1 (EV_KEY)
   Event code 116 (KEY_POWER)
 Event type 2 (EV_REL)
Properties:
Testing ... (interrupt to exit)
Event: time 1466799328.888825, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1466799328.888825, -------------- SYN_REPORT ------------
Event: time 1466799328.999256, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 1466799328.999256, -------------- SYN_REPORT ------------
Event: time 1466799329.630542, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1466799329.630542, -------------- SYN_REPORT ------------
Event: time 1466799329.798206, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 1466799329.798206, -------------- SYN_REPORT ------------

ubuntu@pine64:~$

Thanks for that! Now I know my button is working! Smile

So, next my next question is : Do you know any (simple!) way to get the pine64 to respond to it? I'm using debian, and would like to make it trigger a shutdown. I keeps seeing mention of xbindkeys seeming to be able to do this, but I want a headless machine to be able to do this, not one with X11.

Edit: So, after a little more digging, and coming across a wiki page about udev and sleep buttons, I sort of followed the instructions and ended up with this for a udev rule, and it works!


Code:
pfeerick@pine64:~$ more /etc/udev/rules.d/70-power-switch-my.rules
ACTION=="remove", GOTO="power_switch_my_end"
SUBSYSTEM=="input", KERNEL=="event1", ATTRS{name}=="axp81x-supplyer", TAG+="power-switch"
LABEL="power_switch_my_end"

I then executed the following commands to freshen things up, and voila... pressing the power button causes the pine64 to instantly start shutting down! Now to see if I can make it trigger a delayed shutdown - say with 1 minutes grace...  Smile


Code:
sudo systemctl restart systemd-udevd
sudo udevadm trigger
sudo systemctl restart systemd-logind


As a side-note, connecting the battery can be annoying - when the battery is connected, when I tell the pine64 to poweroff / halt, it powers itself back up again.
  Reply


Messages In This Thread
RE: DC Power IN Power-ON Switch Reset Switch -- Batt Required - by pfeerick - 06-24-2016, 11:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Which Power Supply Unit for Pine64 A64 DB V1.1 2GB REV B (year 2016)? databaseprogrammer 1 3,510 07-03-2021, 01:29 AM
Last Post: tllim
Lightbulb Alternate Power DC-IN on the Euler Bus also with PI filter for batt operation MarkHaysHarris777 13 27,335 12-19-2020, 09:53 PM
Last Post: evilpete
  Once Again: Power Supply problems I guess (Pine A64+ locking up) marcelser 0 3,752 06-04-2018, 03:11 PM
Last Post: marcelser
  Power supply problems. larsen8989 5 10,269 05-03-2018, 09:01 PM
Last Post: tllim
  solar power on a Pine64 tablet Little_Johnny 11 18,127 03-20-2018, 12:01 AM
Last Post: pfeerick
  Power up HDDs c4tich 3 6,938 03-18-2017, 09:18 AM
Last Post: Luke
  Provide power in via Pi-2 header BenCranston 22 33,017 03-08-2017, 10:38 PM
Last Post: pfeerick
  any danger from using 2 power sources at same time? dkryder 3 7,618 01-20-2017, 10:45 PM
Last Post: MarkHaysHarris777
Lightbulb A Tale of Two Power Supplies - why good is good and better is best MarkHaysHarris777 9 19,906 01-07-2017, 11:59 PM
Last Post: aegrotatio
  First cable for Euler Bus power done! AVL2016 24 36,477 10-05-2016, 06:43 AM
Last Post: Ghost

Forum Jump:


Users browsing this thread: 1 Guest(s)