Getting BLN to work with CyanogenMod / LineageOS

“Backlight Notification” is a great feature of some Android Linux kernels, that allows to use the backlight of the “Menu” and “Back” buttons to signal pending notifications for phones that don’t have a dedicated notification LED.

There is an app called BLN control in the play store from the developer “neldar”, that allows to control this feature. However, if you try to use it on a recent version of CyanogenMod or LineageOS, it will report “This kernel does not support BLN”. This may not be true, the kernel might support it, like in many recent custom ROMs, but the app cannot configure it due to the SELinux (Security-Enhanced Linux). It’s a module that increases the security of Android, but prevents BLN control to work.

One option (that I do not recommend) is to disable SELinux by settings its mode to permissive (“setenforce permissive” as root).

A better option, that doesn’t compromise the security of the phone, is to enable BLN at each boot. For that, enable “adb” in the developer options of the phone, also enable “root” access for adb, then connect to the phone with ADB:

Computer$ adb shell
Phone$ su -
Phone# cat > /data/local/userinit.sh
echo 1 > /sys/devices/virtual/misc/backlightnotification/enabled
[Press CTRL-D]
Phone#

Now reboot the phone, and call or text your phone. The “menu” and “back” buttons should glow until you dismiss the notifications.

Don’t forget to disable the root access and adb in the developer options!

And if the directory “/sys/devices/virtual/misc/backlightnotification” is missing, then the kernel really doesn’t support BLN, sorry for you.

Please let me know in the comments if this worked for you (or not).

Advertisements
This entry was posted in Android. Bookmark the permalink.

9 Responses to Getting BLN to work with CyanogenMod / LineageOS

  1. zxc says:

    This is not enough because init.d is disabled or something (Lineage OS 13).

  2. Bitterstoff says:

    Thanks for your manual. Finally I got it running (didn’t understand, that the file userinit.sh must be filled with echo 1 > …), but BLN is not working.

    It was mentioned somewhere that the init.d process was removed in CM12/CM13 so I used an app for executing the script independently.
    The enabled file now contains a “1”, but the BLN app still said, that it is not available.

    After setting “setenforce permissive” the BLN app showed success, but when testing, the buttons did not light up.

    Currently running Lineage 7.1.2, current snapshot build; BLN worked the last years flawless, the last was CM13.

    Do you have any idea?

    • ocroquette2 says:

      BLN works fine on my S4 mini running LineageOS13.

      Run “id” after “su -” and make sure you have the uid 0 (e.g. root).
      If it’s the case, run “echo 1 > /sys/devices/virtual/misc/backlightnotification/enabled” in the same shell. That will activate BLN, at least until the phone restarts. Put the phone to sleep, and then send it a text message. The menu keys should glow. If not, I guess something is wrong with the BLN support in the kernel itself. You could try to contact the maintainers.

      You don’t need the BLN app by the way.

      • Bitterstoff says:

        Thanks for your help.

        I followed your advice but still no glowing at all. I am using kernel 3.4.113. I played around with setenforce 0/1, restarts und checked enabled-properties (owner 1000 system, -rw-rw-rw)
        I even restored the old CM13 – apparently same kernel, SELinux is “enforcing” – keys glow. New install of Lineage didn’t work either…

        Guess I’ll have to wait and hope 😦

      • ocroquette2 says:

        Sorry I cannot help, you may want to find and contact the maintainers.

  3. IP Huang says:

    I tried your method on my s4 mini running Lineage OS 7.1.2. The userinit.sh was created successfully but the value of backlightnotification/enabled remained 0 (unchanged) after reboot. Does the userinit.sh execute automatically? Or I have to do some other setting?

    • ocroquette2 says:

      You should try to enable BLN explicitly on the command line as root:

      # echo 1 > /sys/devices/virtual/misc/backlightnotification/enabled
      # cat /sys/devices/virtual/misc/backlightnotification/enabled
      1

      Then put the phone to standby, and send it a SMS (for instance). if the SMS is received, but the LEDs are not glowing, something is wrong, and the userinit.sh is not the issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s