Enable power button on Ravpower WD009?

Can anyone offer some guidance on how can I get the power button on my Ravpower WD009 to power ON/OFF to device?

It ran out of power, and when charged up the power button powers ON the unit, but doesn't power it off.

Thanks.

It seems there’s also no way to power-down the unit from openwrt.
As a travel router this is kind of a necessity.

Shame, it was looking really promising, I’ll attempt to reflash stock firmware next week.

;(

If you SSH into the device, and issue the shutdown command, does it indeed shut down?

edit: I meant poweroff

I don’t think openwrt has shutdown, only reboot , halt or poweroff.

Sorry, I meant poweroff of course - since that's what you want to do :stuck_out_tongue:

Have you read

Yep…

The power button…

|Power|Short press : USB port charging mode. Long Press : Power On / Off|

That long press, does nothing.

The hotplug button press check also returns an empty string where the button name should be.

I’m confused.

Did you read it though?

Here, we merely name the buttons, so we can use them in the above Howto.

With the howto being

In your /etc/config/system file, you should have something that looks vaguely like this:

config button
	option button 'wps'
	option action 'released'
	option min '0'
	option max '1'
	option handler '<short_press_action or script>'

config button
	option button 'wps'
	option action 'released'
	option min '2'
	option max '5'
	option handler '<long_press_action or script>'

Obviously the button may have some other name (instead of wps).

This is just an example where the min and max represents the range of time (in seconds) that the button should be held for each action. So the short press works for 0-1 seconds of hold time. The long press is between 2-5 seconds. Or you could omit the max for the long press and it would be anything above the min value.

your action or script would either be something like:

	option handler 'poweroff'

or

	option handler '/path/to/script.sh'
1 Like

I’ll check that….

When I said does nothing I meant there was no button name returned when I ran the hot plug button name script.

Thanks for the help, it might not be a lost cause after all.

Here's the ouitput from the syslog for each button press:

SD>USB
Mon Nov 8 11:01:21 2021 user.notice hotplug test: button:copy action:pressed
Mon Nov 8 11:01:21 2021 user.notice hotplug: Button: copy / Action: pressed
Mon Nov 8 11:01:21 2021 user.notice root: the button was copy and the action was pressed
Mon Nov 8 11:01:22 2021 user.notice hotplug test: button:copy action:released
Mon Nov 8 11:01:22 2021 user.notice hotplug: Button: copy / Action: released
Mon Nov 8 11:01:22 2021 user.notice root: the button was copy and the action was released

2.4/5
Mon Nov 8 11:09:23 2021 user.notice hotplug test: button:rfkill action:pressed
Mon Nov 8 11:09:24 2021 user.notice hotplug: Button: rfkill / Action: pressed
Mon Nov 8 11:09:24 2021 user.notice root: the button was rfkill and the action was pressed
Mon Nov 8 11:09:24 2021 user.notice hotplug test: button:rfkill action:released
Mon Nov 8 11:09:24 2021 user.notice hotplug: Button: rfkill / Action: released

Power
Nothing, no notification, just nothing.

If you use the poweroff command, it causes an immediate shutdown with no log entires. If you want to log the action, create a script:

logger <your message>
poweroff

That’s the problem though, it’s not shutting down - the box is still connected, and it’s still running after pressing the power button.

It has no (discernible) effect.

Create a script with the logger command and a unique message so that you can see if the button handler is functioning properly. If the button handler fires off the script, the script should also be able to execute the power off command.

I’d did this… output as expected for all buttons except power, there was zero log output.

mkdir -p /etc/hotplug.d/button
 
cat << "EOF" > /etc/hotplug.d/button/buttons
logger "the button was ${BUTTON} and the action was ${ACTION}"
EOF

Are there multiple buttons, or is it a single button with different hold times?

There are 4 buttons on the Ravpower wd009:

These seem to be working
Reset - factory reset
2.4G/5G - changes between 2.4 &5g
SD>USB Copies add card to hdd

This one doesn’t
Power - turns it off & on

Let's see the following:

cat /sys/kernel/debug/gpio

cat /etc/config/system

Here you go…

I have also tried creating a script in rc.button with he name mt7610-power, but again it didn’t work.

BusyBox v1.33.1 (2021-10-24 09:01:35 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.1, r16325-88151b8303
 -----------------------------------------------------
root@FileHub:~# cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 416-447, parent: platform/10000600.gpio, 10000600.gpio-bank2:

gpiochip1: GPIOs 448-479, parent: platform/10000600.gpio, 10000600.gpio-bank1:
 gpio-456 (                    |backup              ) in  hi IRQ 
 gpio-457 (                    |white:sd            ) out hi ACTIVE LOW
 gpio-459 (                    |white:globe         ) out lo ACTIVE LOW
 gpio-460 (                    |white:wlan2         ) out hi 
 gpio-462 (                    |reset               ) in  hi IRQ 

gpiochip0: GPIOs 480-511, parent: platform/10000600.gpio, 10000600.gpio-bank0:
 gpio-483 (                    |red:sd              ) out hi ACTIVE LOW
 gpio-498 (                    |white:wlan5         ) out lo ACTIVE LOW
 gpio-500 (                    |mt7610-power        ) out hi 
 gpio-501 (                    |rfkill              ) in  hi IRQ 
root@FileHub:~# 
root@FileHub:~# 
root@FileHub:~# cat /etc/config/system
config system
        option ttylogin '0'
        option log_size '64'
        option urandom_seed '0'
        option hostname 'FileHub'
        option zonename 'UTC'
        option log_proto 'udp'
        option conloglevel '8'
        option cronloglevel '5'

config timeserver 'ntp'
        list server '0.openwrt.pool.ntp.org'
        list server '1.openwrt.pool.ntp.org'
        list server '2.openwrt.pool.ntp.org'
        list server '3.openwrt.pool.ntp.org'
root@FileHub:~#

this is an output (almost certainly an LED) based on the GPIO information. The GPIO listing shows three known buttons:

  • backup (gpio-456)
  • reset (gpio-462)
  • rfkill (gpio-501)

What this means is that the system is not currently aware of the 4th button (input), so it is not surprising that the button has no function.

Unfortunately, I don't see any detailed information in the OpenWrt pages for your WD009 (tech data, device page) that would tell us where the other button goes or how it works.

Here is information about finding and mapping GPIO pins, but that may be a bit hard to manage unless you're willing to open the device and probe around.

You could file a bug against this device to inform the devs that there is a missing button. Hopefully someone in the dev community has the device and sufficient time to look into the mapping of that last button. From there, it hopefully would be a fairly simple patch to get it working and pulled in the next service release of OpenWrt.

What you can do with less effort, though, is make one of the other buttons function as a power button. A long press of one of those buttons, for example, could initiate a poweroff, while short presses could do whatever they do now.