LED use, customization ?
#1
Is there a way to use LEDs?  Ideally, would be nice to customize them for various uses.  As a minimum, I'd like to have a LED notification whenever I have a missed call or a new message (sms, email).  Also a LED battery charging indicator is useful.  Would be great if a user can specify in settings or some config file color, duration, pattern of the LED notification.  At present, my LEDs are off all the time - am I missing something?

Megi's LED info is interesting, but not for layman's practical use.

BTW, it was pleasant to experience use of LEDs by sxmo.
#2
(12-12-2020, 08:05 AM)lat Wrote: Is there a way to use LEDs?  Ideally, would be nice to customize them for various uses.  As a minimum, I'd like to have a LED notification whenever I have a missed call or a new message (sms, email).  Also a LED battery charging indicator is useful.  Would be great if a user can specify in settings or some config file color, duration, pattern of the LED notification.  At present, my LEDs are off all the time - am I missing something?

Megi's LED info is interesting, but not for layman's practical use.

BTW, it was pleasant to experience use of LEDs by sxmo.

Cheers for the link, hadn't found that on Megi's site. Yup on Arch there are none activated by default but pretty easy to activate - I am not that good with permissions so just do a sudo su to get enough power.

Seems with the 5.9.11 kernel the /sys/class/leds layout has changed slightly - I now have
Code:
# echo mmc2 > '/sys/class/leds/blue:indicator/trigger'

For sure there must be some way to trigger on email etc notification as Mobian was doing it last time I looked, but not obvious to me from the 5.9.11 options:
Code:
$ cat '/sys/class/leds/blue:indicator/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 heartbeat cpu cpu0 cpu1 cpu2 cpu3 default-on panic pattern axp20x-battery-charging-or-full axp20x-battery-charging axp20x-battery-full axp20x-battery-charging-blink-full-solid axp20x-usb-online rfkill0 mmc0 mmc1 mmc2 rfkill1 bluetooth-power hci0-power rfkill2
  • ROCKPro64 v2.1 2GB, 16Gb eMMC for rootfs, SX8200Pro 512GB NVMe for /home, HDMI video & sound, Bluetooth keyboard & mouse. Arch (6.2 kernel, Openbox desktop) for general purpose daily PC.
  • PinePhone Pro Explorer Edition, daily driver, rk2aw & U-boot on SPI, Arch/SXMO & Arch/phosh on eMMC
  • PinePhone BraveHeart now v1.2b 3/32Gb, Tow-boot with Arch/SXMO on eMMC
#3
(12-12-2020, 12:13 PM)dukla2000 Wrote:
(12-12-2020, 08:05 AM)lat Wrote: Is there a way to use LEDs?  Ideally, would be nice to customize them for various uses.  As a minimum, I'd like to have a LED notification whenever I have a missed call or a new message (sms, email).  Also a LED battery charging indicator is useful.  Would be great if a user can specify in settings or some config file color, duration, pattern of the LED notification.  At present, my LEDs are off all the time - am I missing something?

Megi's LED info is interesting, but not for layman's practical use.

BTW, it was pleasant to experience use of LEDs by sxmo.

Cheers for the link, hadn't found that on Megi's site. Yup on Arch there are none activated by default but pretty easy to activate - I am not that good with permissions so just do a sudo su to get enough power.

Seems with the 5.9.11 kernel the /sys/class/leds layout has changed slightly - I now have
Code:
# echo mmc2 > '/sys/class/leds/blue:indicator/trigger'

For sure there must be some way to trigger on email etc notification as Mobian was doing it last time I looked, but not obvious to me from the 5.9.11 options:
Code:
$ cat '/sys/class/leds/blue:indicator/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 heartbeat cpu cpu0 cpu1 cpu2 cpu3 default-on panic pattern axp20x-battery-charging-or-full axp20x-battery-charging axp20x-battery-full axp20x-battery-charging-blink-full-solid axp20x-usb-online rfkill0 mmc0 mmc1 mmc2 rfkill1 bluetooth-power hci0-power rfkill2
Thanks to both of you. I was not looking for this information yet, but I knew I needed it. 
LF
#4
BTW, I wasn't able to make any LED work at all Sad
#5
(12-16-2020, 10:33 PM)lat Wrote: BTW, I wasn't able to make any LED work at all Sad

OK, open a terminal and first check what you are running, e.g.:
Code:
$ uname -a
Linux dukla 5.10.0-1-danctnix #1 SMP Tue Dec 15 09:44:29 +07 2020 aarch64 GNU/Linux

Then grab superuser permissions:
Code:
$ sudo su
[root@dukla alarm]#

Then, to e.g. set blue LED to flash when eMMC is used:
Code:
# echo mmc2 > '/sys/class/leds/blue:indicator/trigger'
[root@dukla alarm]#

and exit, first from superuser then from terminal:
Code:
# exit
exit
alarm@dukla:~$ exit
  • ROCKPro64 v2.1 2GB, 16Gb eMMC for rootfs, SX8200Pro 512GB NVMe for /home, HDMI video & sound, Bluetooth keyboard & mouse. Arch (6.2 kernel, Openbox desktop) for general purpose daily PC.
  • PinePhone Pro Explorer Edition, daily driver, rk2aw & U-boot on SPI, Arch/SXMO & Arch/phosh on eMMC
  • PinePhone BraveHeart now v1.2b 3/32Gb, Tow-boot with Arch/SXMO on eMMC
#6
Oh, thank you @dukla2000!  I've tried exactly that, but didn't realize that those LED flashes were very brief, so I simply did not see them!

Now it would be nice to figure out how to use the full range of LED signals (solid, flashing with different frequencies, two/three LEDs simultaneously) for any user-specified device state (missed call, new sms/email, no_network_connection, etc, etc).  I recall that Maemo on the good old nokia N900 had those highly customizable options in user Settings.  It's successor Maemo Leste (which is easily accessible from Megi's multi-distro image) lists these options in 
Settings -> Notification Light
  1. Device on
  2. Missed call
  3. Text message received
  4. E-mail message received
  5. Instant message received
I've briefly looked into Maemo Leste's relevant directories/files, finding these:
Code:
root@devuan-pinephone:/# find / -name leds
/home/user/.gconf/system/osso/dsm/leds
/sys/class/leds
/sys/devices/platform/leds
/sys/devices/platform/leds/leds
/sys/devices/platform/led-controller/leds
/sys/bus/platform/devices/leds
/sys/bus/platform/drivers/leds-gpio/leds
/sys/firmware/devicetree/base/leds

root@devuan-pinephone:/# find / -name '*indicator*'
/sys/class/leds/blue:indicator
/sys/class/leds/red:indicator
/sys/class/leds/green:indicator
/sys/devices/platform/leds/leds/blue:indicator
/sys/devices/platform/leds/leds/red:indicator
/sys/devices/platform/leds/leds/green:indicator

root@devuan-pinephone:~# find / -name led
/sys/devices/platform/soc/1c2ac00.i2c/i2c-1/1-005d/input/input4/capabilities/led
/sys/devices/platform/soc/1c21800.lradc/input/input2/capabilities/led
/sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/input/input1/capabilities/led
/sys/devices/platform/vibrator/input/input3/capabilities/led
/sys/devices/platform/sound/sound/card2/input5/capabilities/led
/sys/firmware/devicetree/base/led-controller/led

# cat /sys/devices/platform/soc/1c2ac00.i2c/i2c-1/1-005d/input/input4/capabilities/led
0
# cat /sys/devices/platform/soc/1c21800.lradc/input/input2/capabilities/led
0
# cat /sys/devices/platform/vibrator/input/input3/capabilities/led
0
# cat /sys/devices/platform/sound/sound/card2/input5/capabilities/led
0
# cat /sys/firmware/devicetree/base/led-controller/led

# cd /sys/firmware/devicetree/base/led-controller/led
root@devuan-pinephone:/sys/firmware/devicetree/base/led-controller/led# ls -al
total 0
drwxr-xr-x 2 root root 0 May 29 00:09 .
drwxr-xr-x 3 root root 0 May 29 00:09 ..
-r--r--r-- 1 root root 4 May 29 00:13 color
-r--r--r-- 1 root root 4 May 29 00:13 flash-max-timeout-us
-r--r--r-- 1 root root 6 May 29 00:13 function
-r--r--r-- 1 root root 4 May 29 00:13 name

root@devuan-pinephone:/sys/firmware/devicetree/base/led-controller/led# cat color
root@devuan-pinephone:/sys/firmware/devicetree/base/led-controller/led# cat flash-max-timeout-us
А
root@devuan-pinephone:/sys/firmware/devicetree/base/led-controller/led# cat function
flash
root@devuan-pinephone:/sys/firmware/devicetree/base/led-controller/led# cat name
led
I don't know how these connect with the user applications like email, sms, etc.  Maybe someone more knowlegeable can pick up and take this further...  Come on, Prometeus, bring us some LED light!
#7
(12-17-2020, 08:54 AM)lat Wrote: I don't know how these connect with the user applications like email, sms, etc.  Maybe someone more knowlegeable can pick up and take this further...  Come on, Prometeus, bring us some LED light!
I am not knowledgeable on this topic, but found it interesting and stumbled across some stuff: It seems LED notifications for Phosh are handled by feedbackd, so to a certain extent you could probably modify the settings there or dig deeper into the source code to make more adjustments. Maybe it's also possible to hook into the notifications manually and script something for the LEDs with the pattern trigger. More details on that can be found here. And here is some more general info on LED handling in Linux. Hope you get somewhere with that!
#8
Hi,

I'd like to try the above to to make the LED light up on SMS notification. My problem is, I don't even get a notification when I receive an SMS, although all the SMS's seem to be arriving. Any ideas?

Thanks

EDIT: I do get a notification most times - just occasionally not. But I've managed to turn on the green LED on im.pidgin.purple.PurpleInterface -> ReceivedImMsg, so now my LED lights up when I get a text regardless of whether I get a notification.


Forum Jump:


Users browsing this thread: 3 Guest(s)