Ask / Submit

How to make a custom led pattern?

asked 2015-11-12 17:26:54 +0200

updated 2016-09-01 10:41:05 +0200

jiit gravatar image

I searched far and wide but I didn't find instructions to do the following:

I'd like to have the led blinking when the screen is off but the device isn't locked. This would allow me to see if I need to lock it manually before leaving it on a table. I think notification-style blinking and screen-dimming colour would do allright for me (I read that unlinke breathing, blinking doesn't require CPU and thus is more energy effient).

Edit: Here's what I did: I opened the file like this:

nano /etc/mce/20hybris-led.ini

Then I edited PatternDeviceOn= to


(importancy=200, 0 means it runs when display is off, 600=10 minutes, the time it takes for my phone to autolock, 100 is the time in milliseconds when the led is on, 3000(ms) is the frequency and 00ffff is the color (cyan).)
After that I removed PatternDeviceOn from LEDPatternsDisabled= (at the end of the file) and rebooted.

There are two problems, though:
1. The blinking stops after 10 minutes and doesn't reset
2. It blinks even if you lock via doublepress on powerkey
I think I need to assign some dbus actions to the powerkey: doubleclick will stop the blinking and normal click will restart the blinking. But the blinking should also be restarted when I unblank the screen via doubletap. How can I do that?

edit retag flag offensive close delete


From what I understand, you need a pattern for display_off (without timeout of 10min) and another pattern for device_locked which stops LED. What I do not know yet is, how to fire the second pattern.

lakutalo ( 2015-11-12 20:14:41 +0200 )edit

Or simply firing this pattern only when the screen goes off via anything else than a doubleclick on powerkey. Heureka! This should be doable with mcetool and a single dbus call.

jollailija ( 2015-11-12 20:52:11 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2015-11-12 17:53:07 +0200

lakutalo gravatar image

updated 2015-11-14 00:25:41 +0200

I have looked up some useful information here:

edit flag offensive delete publish link more



Okay, I used the cat command and found out there was documentation inside the file :) Thanks. I'll close this question after I can make the desired blinking happen.

jollailija ( 2015-11-12 18:09:32 +0200 )edit

You're welcome! It would be great if you could add your findings to the first of the mentioned links (how-to).

lakutalo ( 2015-11-12 18:12:00 +0200 )edit

Found another quite interesting one and appended it to my answer (network state mce), see for your self.

lakutalo ( 2015-11-13 23:36:58 +0200 )edit

@lakutalo Thanks, that's the thread I got my idea for using PatternDeviceOn + dbus :)

jollailija ( 2015-11-14 14:19:34 +0200 )edit

answered 2015-11-12 20:50:34 +0200

spiiroin gravatar image

Triggering leds based on devicelock state is not supported atm i.e. you can't do that by just editing config files, it needs new code somewhere.

Implementing support for something like disabled-by-default DeviceLocked and DeviceUnlocked patterns would not be that difficult, but the devil is in the details: the auto-deactivate timeout might not work as expected if triggering is based solely on device lock time; more generic triggering mechanism would require changes in pattern config; etc).

Just wondering about this "to see if I need to lock it manually before leaving it on a table" part. What I do is: press power key once (to turn the display on) and then press it again twice -> device gets locked & there is a small vibration -> I know it is locked without even looking at the phone.

edit flag offensive delete publish link more


@spiiroin My Jolla doesn't vibrate when locking. I can't recall it ever doing so. If it did I likely wouldn't be asking this.

jollailija ( 2015-11-12 20:57:15 +0200 )edit

@jollailija The vibrate on double power key press is relatively new feature. It was added in mce 1.63.0 and should be available from sfos release 2.0.1 onwards.

spiiroin ( 2015-11-12 21:16:46 +0200 )edit

@spiiroin Well, 2.0.1 isn't even early access yet. What can I do in the meantime?

jollailija ( 2015-11-12 21:44:38 +0200 )edit

@jollailija Double power key press (when display is on) already locks the device - just the vibration is missing until 2.0.1.

If you really want to know it got locked you could: turn display on, double press powerkey to apply device lock, double press the powerkey again -> display wakes up to device lock pin query -> you know it is locked and can do yet another power key press to turn the display off. (And yes - it is "a bit" cumbersome, which is why the vibration was added ...)

spiiroin ( 2015-11-12 21:51:26 +0200 )edit

To be honest, I check the device lock state with clock animation. If it's not locked, I'll do the double key press. The timeout between two key presses is now longer and it always works.

Having an option for device lock on Ambience menu is an alternative. There is a patch for this, but I did it manually.

Alen ( 2015-11-13 00:24:17 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2015-11-12 17:26:54 +0200

Seen: 529 times

Last updated: Nov 14 '15