Jump to content

NanoPi Duo disable shutdown button


sgjava

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]

 

Link to comment
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:

 

Link to comment
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
Link to comment
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.

Link to comment
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;
                };
        };

};

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines