edison-fw / meta-intel-edison

Here is the meta-intel-edison that builds, tries to stay up to date. Master is based on Yocto Poky Gatesgarth LTS 5.10.yy vanilla kernels. It builds a 32bit kernel (Gatesgarth branch 64bit) with ACPI enabled and corresponding rootfs. Telegram group: https://t.me/IntelEdison Web-site:
https://edison-fw.github.io/meta-intel-edison/
MIT License
60 stars 38 forks source link

blink-led.service on zeus (and later) #97

Closed mwallnoefer closed 3 years ago

mwallnoefer commented 4 years ago

The blink-led example fails on branch zeus with the following exception:

Traceback (most recent call last):
  File "/usr/bin/blink-led", line 81, in <module>
    set_line("TRI_STATE_ALL", 0)
  File "/usr/bin/blink-led", line 66, in set_line
    line.request(consumer=line.owner().name(), type=gpiod.LINE_REQ_DIR_OUT)
AttributeError: 'NoneType' object has no attribute 'request'
mwallnoefer commented 4 years ago

Solution found: https://github.com/htot/meta-intel-edison/commit/22fa91d79f55980b3941d61c9625476b7762f423

mwallnoefer commented 4 years ago

Unfortunately the systemd service still stops in a warning:

Mar 07 10:37:43 edison systemd[1]: blink-led.service: Start request repeated too quickly.
Mar 07 10:37:43 edison systemd[1]: blink-led.service: Failed with result 'exit-code'.
Mar 07 10:37:43 edison systemd[1]: Failed to start Edison Arduino board LED Blinker.
htot commented 4 years ago

See my comments https://github.com/htot/meta-intel-edison/commit/22fa91d79f55980b3941d61c9625476b7762f423

mwallnoefer commented 4 years ago

Okay, I am fine with disabling it (at the systemd level?).

Just a question: this does not interfere with the Arduino functionality, correct?

htot commented 4 years ago

I don't think so. The kernel does 'take' (hog) the LED ping, so it can not be used for anything else.

mwallnoefer commented 4 years ago

I have tried to determine the location where the systemd link (runtime -> unit) gets added during build, but I cannot find it. It does not seem to happen in the receipt.

htot commented 4 years ago

meta-intel-edison/meta-intel-edison-distro/recipes-core/post-install/files/post-install.sh?

But this should run only once. Ah, wait: https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#ref-classes-systemd

It's enabled by default, we need to turn it off.

mwallnoefer commented 4 years ago

https://github.com/htot/meta-intel-edison/pull/9

htot commented 4 years ago

It's enabled by default, we need to turn it off.

I am reconsidering this. The problem is when the led.aml is loaded the kernel hogs the led pin, so blink-led should enable the led mux and terminate without error as the kernel already controls the led. But when led.aml is not loaded blink-led should run normally.

So this is a bug in blink-led that we need to fix.

htot commented 4 years ago

Fixed I hope (5ad238581a4f85a65ad6585f24e20f380dac4b85) and force pushed to master and zeus.

mwallnoefer commented 3 years ago

Just as a follow-up this patch would disable the blink-led.service per default. I guess that a manual run for a one-time diagnosis would be better than an automatic launch at each start-up, since the LED could also be used by the oobe wifi detection. Second, it is just wasted energy consumption...

diff --git a/meta-intel-edison-distro/recipes-support/blink-led/blink-led_0.1.bb b/meta-intel-edison-distro/recipes-support/blink-led/blink-led_0.1.bb
index 0e84904..7ae255f 100644
--- a/meta-intel-edison-distro/recipes-support/blink-led/blink-led_0.1.bb
+++ b/meta-intel-edison-distro/recipes-support/blink-led/blink-led_0.1.bb
@@ -7,6 +7,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files/:"

 inherit systemd
 SYSTEMD_SERVICE_${PN} = "blink-led.service"
+SYSTEMD_AUTO_ENABLE = "disable"

 RDEPENDS_${PN} = "libgpiod-python"
htot commented 3 years ago

Ah thanks. Yes in the past blink-led needed to run continuously, but now we have a kernel module.

By default 'heart-beat' runs, because we load the kernel module here and because we load the leds.asl table (which defines the pin as a led pin here.

So we could drop de service entirely and replace it by a script that loads another module and sets it up. We have ledtrig-activity ledtrig-default-on ledtrig-gpio ledtrig-heartbeat ledtrig-oneshot ledtrig-timer

For instance modprobe ledtrig-timer and

~# cat /sys/class/leds/heartbeat/trigger   
none rfkill-any rfkill-none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock disk-activity disk-read disk-write ide-disk cpu cpu0 cpu1 mmc0 mmc1 mmc2 [heartbeat] rfkill0 rfkill1 timer

echo timer > /sys/class/leds/heartbeat/trigger

will make it blink 0.5s on/0.5s off and echo 50 > /sys/class/leds/heartbeat/delay_on will make it flash similarly to the current blink-service when run by pushing the PWR button 3x quickly (triggering oobe).

Of course return back to hearbeat is echo heartbeat > /sys/class/leds/heartbeat/trigger

htot commented 3 years ago

I'll take this one and fix it in dunfell.

htot commented 3 years ago

I hope it's working for you?

mwallnoefer commented 3 years ago

This issue was ok I think 🤔, I still had problems with mraa: #123.