2 2
sgjava

NanoPi Duo disable shutdown button

Recommended Posts

I noticed with the latest bionic image on the Duo it does a soft shutdown when you use the built in button. The problem is I use this button for my own uses. Can this feature be disabled and relinquish control of the button?

gpioinfo | grep k1
	line   3:      unnamed         "k1"   input   active-low [used]

 

Share this post


Link to post
Share on other sites

@sgjava the Duo inherits this feature from this node in sun8i-h3-nanopi.dtsi:

	r_gpio_keys {
		compatible = "gpio-keys";
		input-name = "k1";
		pinctrl-names = "default";
		pinctrl-0 = <&sw_r_npi>;

		k1 {
			label = "k1";
			linux,code = <KEY_POWER>;
			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
		};
	};

You could make an overlay to remove this node using the /delete-node/ or /delete-property/ syntax.

See also:

 

Share this post


Link to post
Share on other sites

OK, I'll need to remember how to decompile and compile the dtb. I've done it before when I wanted to use OTG port on Duo and had to use the FriendlyElec dtb.

 

Share this post


Link to post
Share on other sites

For future reference:

  • cd /boot/dtb
  • sudo cp sun8i-h2-plus-nanopi-duo.dtb sun8i-h2-plus-nanopi-duo.dtb.old
  • sudo dtc -@ -I dtb -O dts -o sun8i-h2-plus-nanopi-duo.dts sun8i-h2-plus-nanopi-duo.dtb
  • sudo nano sun8i-h2-plus-nanopi-duo.dts (remove r_gpio_keys section)
  • sudo dtc -@ -I dts -O dtb -o sun8i-h2-plus-nanopi-duo.dtb sun8i-h2-plus-nanopi-duo.dts
  • reboot

Share this post


Link to post
Share on other sites
3 hours ago, sgjava said:

I'll need to remember how to decompile and compile the dtb

It is better to use "-@" option on "dtc", this is to keep symbols. But it is only available on device-tree-compiler_1.4.7-3_arm64.deb or newer.

Share this post


Link to post
Share on other sites

This feature has part of the dtsi upstream since the introduction of sunxi-h3-nanopi.dtsi into mainline in 4.10 - IMHO armbian should not deviate from mainline unnecessarily. An overlay to remove the r_gpio_keys node would be a better alternative for usere wanting to use that button for other purposes.

Share this post


Link to post
Share on other sites
3 hours ago, karabek said:

An overlay to remove the r_gpio_keys node would be a better alternative for usere wanting to use that button for other purposes.

That should be pretty easy using "/delete-node/" DTS syntax ...

Share this post


Link to post
Share on other sites

@martinayotte Can you give me and example of this? I saved off the old dtb and can try the delete node on that. Would be better if you do not have to decompile/remove/compile.

Share this post


Link to post
Share on other sites
10 minutes ago, sgjava said:

Can you give me and example of this?

Although not tested, it should be something like this :

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun8i-h3";

        fragment@0 {
                target-path = "/r_gpio_keys";
                __overlay__ {
                        /delete-node/ k1;
                };
        };

};

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
2 2