Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Clearfog push buttons

Featured Replies

Hi again,

 

The Clearfog base has two push buttons, but these don't seem to be hard-wired to any hardware functionality.

 

Does anyone know how to find them in the system and monitor them for events? They could then be used for example to reboot or power down the system.

 

BR.

 

--Marius--

 

One button is hardwired as a reset button (rectangular one near the power connector) and another one should be configured as a gpio-keys button with code BTN_0: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/arch/arm/boot/dts/armada-388-clearfog-base.dts#n63

You just need to find a software solution that would let you run commands on key press events.

  • Author

I found the key between the USB port and the Ethernet ports at /dev/input/by-path/platform-gpio-keys-event

 

but the other button, beside the power input is still a mystery.

 

BR.

 

--Marius--

 

  • Author

Sorry if this is stupid.

This is what I found so far:

 

  From the dts file link that zador posted:

 

	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-0 = <&rear_button_pins>;
		pinctrl-names = "default";

		button_0 {
			/* The rear SW3 button */
			label = "Rear Button";
			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
			linux,can-disable;
			linux,code = <BTN_0>;
		};
	};
};

 

Then  doing cat /sys/kernel/debug/gpio and looking for "Rear Button", I find that that is on pin 44:

 

 grep -i "Rear Button" /sys/kernel/debug/gpio

 gpio-44  (Rear Button         ) in  hi (act lo) - IRQ edge  (clear  )

 

but if I try to export pin 44, I get device or resource busy:

 

root@clearfogbase:~# echo 44 > /sys/class/gpio/export
-bash: echo: write error: Device or resource busy

 

I compiled gpio_watch from http://blog.oddbit.com/2014/07/26/gpiowatch-run-scripts-in-respo/

 

which I though looked like a good way to do what I wanted.

 

What am I doing wrong?

 

BR.

 

--Marius--

 

  • Author

Thanks for clearing that up. For the record, I haven't added anything to dts, but I guess there's enough there already.

 

  BR.

 

--Marius--

 

  • Author

For information, I sorted this using "triggerhappy":

 

Apt installed

created a "triggerhappy" system user and modified the init script to use it.

crated a trigger configuration for the button press event (BTN_0 1)

creted a simple script invoking systemctl poweroff -I

modified sudoers accordingly.

 Tested:. Buttonpress shuts down the system even if users are currently logged in.

The system can be started again by pressing the other, rectangular switch by the power intake, which as zador.blood.stained correctly pointed out, is hardwired as reset.

 

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.