Automatically turn off blinking blue LED

Post Reply
Exhaust
Posts: 29
Joined: Tue Mar 29, 2022 3:04 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 1 time
Been thanked: 2 times
Contact:

Automatically turn off blinking blue LED

Post by Exhaust »

I have this command I have to input manually to turn off the annoying blinking blue LED:

Code: Select all

echo none > /sys/class/leds/blue:status/trigger
I've tried various commands I found in 6 year old forum posts to automatically turn the blue LED off on startup because this command turns itself off every time the system is rebooted, but so far none of the strategies have worked, all I can do that works is manually input this command.

How do you automatically control this LED?

L67GS
Posts: 953
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, M1 8GB, C1+, (3) C0's, H3+, N2L 4GB, and a whole big pile of accessories, VU7A Plus,, MIPI-CSI Camera Kit, etc....
Location: Great Lakes Region, U.S.A
Has thanked: 295 times
Been thanked: 121 times
Contact:

Re: Automatically turn off blinking blue LED

Post by L67GS »

How about a shell script at boot?

User avatar
mad_ady
Posts: 11208
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 1058 times
Contact:

Re: Automatically turn off blinking blue LED

Post by mad_ady »

You could try adding the command in /etc/rc.local before the exit statement.

L67GS
Posts: 953
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, M1 8GB, C1+, (3) C0's, H3+, N2L 4GB, and a whole big pile of accessories, VU7A Plus,, MIPI-CSI Camera Kit, etc....
Location: Great Lakes Region, U.S.A
Has thanked: 295 times
Been thanked: 121 times
Contact:

Re: Automatically turn off blinking blue LED

Post by L67GS »

/etc/rc.local didn't work on my C0 project.
.bashrc could be an option
viewtopic.php?f=112&t=40211

Exhaust
Posts: 29
Joined: Tue Mar 29, 2022 3:04 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Automatically turn off blinking blue LED

Post by Exhaust »

mad_ady wrote:
Mon Nov 14, 2022 3:16 am
You could try adding the command in /etc/rc.local before the exit statement.
I believe this is exactly what I did, it did not work.
L67GS wrote:
Mon Nov 14, 2022 3:14 am
How about a shell script at boot?
How?

Exhaust
Posts: 29
Joined: Tue Mar 29, 2022 3:04 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Automatically turn off blinking blue LED

Post by Exhaust »

L67GS wrote:
Mon Nov 14, 2022 6:27 am
/etc/rc.local didn't work on my C0 project.
.bashrc could be an option
viewtopic.php?f=112&t=40211
I don't understand what this is.

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 350 times
Been thanked: 447 times
Contact:

Re: Automatically turn off blinking blue LED

Post by mctom »

Exhaust wrote:
Mon Nov 14, 2022 7:19 am
mad_ady wrote:
Mon Nov 14, 2022 3:16 am
You could try adding the command in /etc/rc.local before the exit statement.
I believe this is exactly what I did, it did not work.
If that file didn't exist before, that could mean rc.local is disabled.
https://www.linuxbabe.com/linux-server/ ... th-systemd
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

L67GS
Posts: 953
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, M1 8GB, C1+, (3) C0's, H3+, N2L 4GB, and a whole big pile of accessories, VU7A Plus,, MIPI-CSI Camera Kit, etc....
Location: Great Lakes Region, U.S.A
Has thanked: 295 times
Been thanked: 121 times
Contact:

Re: Automatically turn off blinking blue LED

Post by L67GS »

Exhaust wrote:
Mon Nov 14, 2022 7:20 am
L67GS wrote:
Mon Nov 14, 2022 6:27 am
/etc/rc.local didn't work on my C0 project.
.bashrc could be an option
viewtopic.php?f=112&t=40211
I don't understand what this is.
.bashrc should be in your home folder, it's executed at login. Open the file, and put your command in it then reboot.

User avatar
mad_ady
Posts: 11208
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 1058 times
Contact:

Re: Automatically turn off blinking blue LED

Post by mad_ady »

Come on, guys, this discussion is turning out to be more complicated than it needs to.
Let's fix it the proper way (the systemd way)!

So - to run a command on system boot, you need to create and enable a service. The service executes a command, handles dependencies and logging (which you don't need in this particular case). It's more convoluted than past solutions, but it's the correct way to do it in a systemd environment!

To create a service file you need to create a text file in /etc/systemd/system, like this (as root!):

Code: Select all

# cat /etc/systemd/system/turn-off-blue-led.service
[Unit]
Description=Turn off blue led
After=syslog.target

[Service]
ExecStart=/bin/bash -c "/usr/bin/echo none > /sys/class/leds/blue\:status/trigger"
Type=oneshot

[Install]
WantedBy=multi-user.target
Next, you can run it manually, to verify that it works:

Code: Select all

service turn-off-blue-led start
service turn-off-blue-led status
If you're satisfied with it, you can enable it to run on system boot with:

Code: Select all

systemctl enable turn-off-blue-led
Let us know if you get stuck.
These users thanked the author mad_ady for the post:
odroid (Mon Nov 14, 2022 4:15 pm)

User avatar
mctom
Posts: 2592
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 350 times
Been thanked: 447 times
Contact:

Re: Automatically turn off blinking blue LED

Post by mctom »

I'm starting to think we need a FAQ thread with tips like that.
@mad_ady guided me into the proper ways od systemd services eons ago and I'm still glad to this day.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 11390
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 779 times
Been thanked: 1934 times
Contact:

Re: Automatically turn off blinking blue LED

Post by tobetter »

Let me add one thing to use a device tree overlay, but not tested yet.

Code: Select all

diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi
index f0abf6b23e32..83bce7acd857 100644
--- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi
@@ -56,7 +56,7 @@
 
 	leds {
 		compatible = "gpio-leds";
-		blueled {
+		blueled: blueled {
 			label = "blue:heartbeat";
 			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "heartbeat";
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index b2a7acc0c557..31cb19fa290a 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -27,7 +27,8 @@ dtbo-$(CONFIG_ARCH_MESON64_ODROIDC4) += spi0.dtbo		\
 					pwm_b-backlight.dtbo	\
 					gpio-joystick0.dtbo	\
 					gpio-joystick1.dtbo	\
-					display_vu7c.dtbo
+					display_vu7c.dtbo	\
+					blueled_off.dtbo
 
 targets	+= $(dtbo-y)
 always	:= $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/blueled_off.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/blueled_off.dts
new file mode 100644
index 000000000000..9e73f94595a1
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/blueled_off.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+	fragmemt@0 {
+		target = <&blueled>;
+
+		__overlay__ {
+			linux,default-trigger = "on";
+			default-state = "off";
+		};
+	};
+};

Exhaust
Posts: 29
Joined: Tue Mar 29, 2022 3:04 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Automatically turn off blinking blue LED

Post by Exhaust »

mad_ady wrote:
Mon Nov 14, 2022 3:53 pm
Come on, guys, this discussion is turning out to be more complicated than it needs to.
Let's fix it the proper way (the systemd way)!

So - to run a command on system boot, you need to create and enable a service. The service executes a command, handles dependencies and logging (which you don't need in this particular case). It's more convoluted than past solutions, but it's the correct way to do it in a systemd environment!

To create a service file you need to create a text file in /etc/systemd/system, like this (as root!):

Code: Select all

# cat /etc/systemd/system/turn-off-blue-led.service
[Unit]
Description=Turn off blue led
After=syslog.target

[Service]
ExecStart=/bin/bash -c "/usr/bin/echo none > /sys/class/leds/blue\:status/trigger"
Type=oneshot

[Install]
WantedBy=multi-user.target
Next, you can run it manually, to verify that it works:

Code: Select all

service turn-off-blue-led start
service turn-off-blue-led status
If you're satisfied with it, you can enable it to run on system boot with:

Code: Select all

systemctl enable turn-off-blue-led
Let us know if you get stuck.
Thank you! This seems to have worked great. This really should be pinned as a FAQ, I bought this device knowing barely anything about Linux, there's no way I could ever figure this out on my own without help.

oqei
Posts: 15
Joined: Tue Jan 17, 2023 12:21 am
languages_spoken: english
ODROIDs: Odroid HC-4
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: Automatically turn off blinking blue LED

Post by oqei »

Posting here even though the thread is stale, because I think I have a simpler solution, I hope it's fine.

On debian-based systems you can achieve this with less manual configuration:
Install sysfsutils, and change /etc/sysfs.conf to:

Code: Select all

# Disable blue LED
class/leds/blue:heartbeat/trigger = none
You can also configure the red LED using this:

Code: Select all

# Disable Red LED
class/gpio/gpio = 503
class/gpio/gpio503/direction = out
class/gpio/gpio503/value = 0
These users thanked the author oqei for the post (total 2):
mctom (Tue Jan 17, 2023 7:37 pm) • odroid (Tue Jan 17, 2023 10:17 pm)

User avatar
rooted
Posts: 9973
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 778 times
Been thanked: 581 times
Contact:

Re: Automatically turn off blinking blue LED

Post by rooted »


oqei wrote:Posting here even though the thread is stale, because I think I have a simpler solution, I hope it's fine.

On debian-based systems you can achieve this with less manual configuration:
Install sysfsutils, and change /etc/sysfs.conf to:

Code: Select all

# Disable blue LED
class/leds/blueImagebeat/trigger = none
You can also configure the red LED using this:

Code: Select all

# Disable Red LED
class/gpio/gpio = 503
class/gpio/gpio503/direction = out
class/gpio/gpio503/value = 0
This should be added to the wiki as I've never seen anyone mention a way to control the red LED.

oqei
Posts: 15
Joined: Tue Jan 17, 2023 12:21 am
languages_spoken: english
ODROIDs: Odroid HC-4
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: Automatically turn off blinking blue LED

Post by oqei »

rooted wrote:
Fri Jan 20, 2023 11:14 am
oqei wrote:Posting here even though the thread is stale, because I think I have a simpler solution, I hope it's fine.
...
This should be added to the wiki as I've never seen anyone mention a way to control the red LED.
That is actually where I got the info from: https://wiki.odroid.com/odroid-hc4/appl ... d-hc4_only
It apparently only works for the HC4 though.

User avatar
rooted
Posts: 9973
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 778 times
Been thanked: 581 times
Contact:

Re: Automatically turn off blinking blue LED

Post by rooted »

oqei wrote:
rooted wrote:
Fri Jan 20, 2023 11:14 am
oqei wrote:Posting here even though the thread is stale, because I think I have a simpler solution, I hope it's fine.
...
This should be added to the wiki as I've never seen anyone mention a way to control the red LED.
That is actually where I got the info from: https://wiki.odroid.com/odroid-hc4/appl ... d-hc4_only
It apparently only works for the HC4 though.
I was right at least, it deserved a wiki entry :)

oqei
Posts: 15
Joined: Tue Jan 17, 2023 12:21 am
languages_spoken: english
ODROIDs: Odroid HC-4
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: Automatically turn off blinking blue LED

Post by oqei »

Amending this for completeness: On a mainline kernel (6.0.0), this needs to be changed slightly: the blue LED is blue:status (instead of heartbeat), while the red one can be set without resorting to the GPIO pins, it is available as red:power. The devices can be controlled as any other LED.
These users thanked the author oqei for the post:
odroid (Tue Jan 24, 2023 7:47 pm)

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest