5
votes

I am using the Debian wheezy filesystem with Robert Nelson's latest kernel. I want to disable the heartbeat led using a device tree overlay.

I understand there are easier ways of doing this but I am only interested in answers using overlays to disable the heartbeat led.

One way I can achieve this is by changing the gpio-leds,led0 leaf in am335x-boneblack.dts from: linux,default-trigger = "heartbeat"; to linux,default-trigger = "none";

then compiling the device tree and rebooting.

However if I try to implement the same thing using the following overlay the heartbeat led continues to flash after I successfully apply the overlay with echo > $SLOTS.
What am I doing wrong?

/dts-v1/;
/plugin/;
/
{
    compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "pru";
version = "00A0";
fragment@0
 {
    target = <&ocp>;
    __overlay__
    {
         gpio-leds
        {
            compatible = "gpio-leds";
            pinctrl-names = "default";
            pinctrl-0 = <0x3>;
             led0
             {
                label = "beaglebone:green:usr0";
                gpios = <0x5 0x15 0x0>;
                linux,default-trigger = "none";
                default-state = "off";
            };
        };
    };
};
};
2

2 Answers

0
votes

There's a systemd service, leds.service, that overrides the device tree settings for this one led (who knows why).

To see the status of the service, run

root@beaglebone:~# systemctl status leds.service

which gives the output

leds.service - Angstrom LED config
          Loaded: loaded (/lib/systemd/system/leds.service; enabled)
          Active: active (exited) since Sat 2000-01-01 18:33:24 UTC; 13 years 7 months ago
          Process: 125 ExecStart=/usr/bin/led-config start (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/leds.service

By looking at the "Loaded" field you can see that the service script is located at /lib/systemd/system/leds.service, and the "Process" field says the this service runs the command "/usr/bin/led-config start".

Looking at this file "/usr/bin/led-config" you'll see that it's a shell script that loads defaults from the file "/etc/default/leds":

#file format: name trigger
beaglebone::usr0 heartbeat

So, you can leave the device tree file alone and set the defaults here, or disable this service with

systemctl disable leds.service
0
votes

To disable the heartbeat with an overlay is very inefficient in my opinion! How about instead try typing in the bash command: "echo none > /sys/devices/ocp.3/gpio-leds.8/beaglebone\:green\:usr0/trigger" and then to turn them back on 'echo "heartbeat" > trigger' (check the file path first) - tested on Debian Wheezy A5A