Backlight Control Issues

178 views
Skip to first unread message

Chris Quartier

unread,
Mar 16, 2011, 4:35:38 PM3/16/11
to android-porting
Hi,

I'm porting Android 2.2 (linux kernel 2.6.32) onto an omap with other
custom hardware, and I'm having problems with Android controlling the
backlight for my LCD screen. In the kernel, I have used the generic
backlight driver, which creates sysfs nodes at "/sys/class/backlight/
my-bl/" and I can properly change the backlight brightness and power
from those nodes (echo [0 - 255] > /sys/class/backlight/my-bl/
brightness). In order for Android to change the backlight I saw that I
must create the liblights library. I've done that, and liblights
points at the correct sysfs nodes. The problem is, when I go to
Settings->Display->Brightness in Android, the slider does not do
anything. The screen off timeout also seems to have no effect - my LCD
stays on forever.

I have tried adding log prints into my liblights library but never see
any of them happen. From what I gather, there is a Lights Service that
calls into my liblights library. In the logcat output I see where the
SystemServer is starting the Lights Service, but I get no clue in any
other logs about what is happening with that service. I can see in the
logcat events buffer that something is happening when I change the
brightness slider.

As for the screen timeout, I do have power management disabled
(setprop hw.nopm true) in my init.rc file because currently it breaks
things. Will the screen timeout not work without power management?

Is there something I am missing? I feel like I am running in circles
with this.

Chris Quartier

unread,
Mar 17, 2011, 4:42:27 PM3/17/11
to android-porting
I figured out my problems. It is a naming convention issue for the
shared library.

In hardware/libhardware/hardware.c, I noticed the call hw_get_module
looks for various sets of names for the hardware modules. If you
follow the porting guide from here: http://source.android.com/porting/lights.html
it says to name your library liblights.so. Well, that appears to be
misleading information. I had to name my lights library "lights.
($ro.board.platform).so" - the hardware module id ends up being the
first part (lights), and you can use one of 4 different system
properties for the 2nd name (in my case I used the system prop
ro.board.platform). The only other possibility is to name your lights
library "lights.default.so" Another caveat is to place this shared
library in /system/lib/hw and not in /system/lib. The hardware.c
implementation is hard-coded to look there.

Once I got the naming and location right, Android was finally able to
latch into my backlight and control it. I still have some minor
problems but they may be coding issues that I will iron out as I
continue testing.

Hope this helps anyone else with similar problems...
Reply all
Reply to author
Forward
0 new messages