sgjava Posted January 1, 2020 Posted January 1, 2020 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]
karabek Posted January 1, 2020 Posted January 1, 2020 @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:
sgjava Posted January 1, 2020 Author Posted January 1, 2020 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.
sgjava Posted January 1, 2020 Author Posted January 1, 2020 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 1
martinayotte Posted January 1, 2020 Posted January 1, 2020 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. 1
TonyMac32 Posted January 2, 2020 Posted January 2, 2020 @martinayotte, @sgjava Would this be a potential feature to have out of the box? Say, an overlay to enable the button in the first place?
karabek Posted January 2, 2020 Posted January 2, 2020 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.
martinayotte Posted January 2, 2020 Posted January 2, 2020 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 ...
sgjava Posted January 2, 2020 Author Posted January 2, 2020 @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.
martinayotte Posted January 2, 2020 Posted January 2, 2020 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; }; }; };
Recommended Posts