3

I am trying to edit the timer of heartbeat trigger on RPi Zero. I have found original .c file of kernel driver here https://github.com/raspberrypi/linux/blob/rpi-5.4.y/drivers/leds/trigger/ledtrig-heartbeat.c. But when I look into my Pi's kernel drivers, in directory with triggers /lib/modules/5.4.51+/kernel/drivers/leds/trigger there are only three triggers and none of them are heartbeat : ledtrig-camera.ko ledtrig-netdev.ko ledtrig-transient.ko. So I am assuming the heartbeat trigger is defined elsewhere.

Where can I find and edit the heartbeat trigger of led ?

4
  • Take a look at this thread - I don't think it's a complete answer to your Question, but it may provide useful clues. And if you find the answer, please post it here... I'm interested. – Seamus Aug 15 '20 at 14:57
  • And this repo on GitHub may be relevant also. Never imagined this objective would be so complicated. And this is cool - an LED heartbeat driver that resembles a real heart. – Seamus Aug 15 '20 at 15:59
  • I have tried writing my own module, but it is really hell to get it working on raspbian with their undocumented stuff. I am just updating that I will be continuing to work on it in 2 weeks, now I am taking a pause because of school stuff. – Hynek Bernard Aug 18 '20 at 10:50
  • Take heart - if it were easy, anyone could do it :) – Seamus Aug 18 '20 at 21:45
1

In order to build a kernel object for ledtrig-heartbeat.c, you need to add CONFIG_LEDS_TRIGGER_HEARTBEAT=Y to your kernel configuration:

 config LEDS_TRIGGER_HEARTBEAT
    tristate "LED Heartbeat Trigger"
    help
      This allows LEDs to be controlled by a CPU load average.
      The flash frequency is a hyperbolic function of the 1-minute
      load average.
If unsure, say Y.

Kernel configuration can usually be changed by running make menuconfig in the kernel source folder.

2
  • so in order to build the object I have to rebuild whole kernel ? – Hynek Bernard Aug 23 '20 at 15:22
  • No, you can just jun make modules_prepare; make M=drivers/leds/trigger modules; depmod. – Dmitry Grigoryev Aug 24 '20 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.