Code: Select all
echo none > /sys/class/leds/blue:status/trigger
How do you automatically control this LED?
Code: Select all
echo none > /sys/class/leds/blue:status/trigger
I believe this is exactly what I did, it did not work.
How?
I don't understand what this is.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
If that file didn't exist before, that could mean rc.local is disabled.
.bashrc should be in your home folder, it's executed at login. Open the file, and put your command in it then reboot.Exhaust wrote: ↑Mon Nov 14, 2022 7:20 amI don't understand what this is.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
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
Code: Select all
service turn-off-blue-led start
service turn-off-blue-led status
Code: Select all
systemctl enable turn-off-blue-led
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";
+ };
+ };
+};
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.mad_ady wrote: ↑Mon Nov 14, 2022 3:53 pmCome 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!):Next, you can run it manually, to verify that it works: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
If you're satisfied with it, you can enable it to run on system boot with:Code: Select all
service turn-off-blue-led start service turn-off-blue-led status
Let us know if you get stuck.Code: Select all
systemctl enable turn-off-blue-led
sysfsutils
, and change /etc/sysfs.conf
to:
Code: Select all
# Disable blue LED
class/leds/blue:heartbeat/trigger = none
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 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:
Installsysfsutils
, and change/etc/sysfs.conf
to:You can also configure the red LED using this:Code: Select all
# Disable blue LED class/leds/blue
beat/trigger = none
Code: Select all
# Disable Red LED class/gpio/gpio = 503 class/gpio/gpio503/direction = out class/gpio/gpio503/value = 0
That is actually where I got the info from: https://wiki.odroid.com/odroid-hc4/appl ... d-hc4_only
I was right at least, it deserved a wiki entryoqei wrote: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.
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.Users browsing this forum: No registered users and 1 guest