Backlight adjustment on Eee PC and other platforms

94 views
Skip to first unread message

Xiaoyang Yu (Max)

unread,
Jan 13, 2009, 5:20:53 AM1/13/09
to android-porting
Current Android code for backlight adjustment do not work properly for
systems other than G1. This is mainly because:

1) The corresponding sysfs file changed. In "mydroid/hardware/
libhardware/power/power.c", LCD_BACKLIGHT is hard coded to "/sys/class/
leds/lcd-backlight/brightness". While it should be "/sys/class/
backlight/eeepc/backlight/brightness" for Eee PC.

2) The backlight range is assumed to be from 0 - 255 as in "mydroid/
packages/apps/Settings/src/com/android/settings/
BrightnessPreference.java". While it should be from 0 - 7 for Eee PC.

For 1), we can use a property to set the value for the LCD_BACKLIGHT,
instead of hard code it.
For 2), we can check sysfs file "max_brightness" to get the max
backlight level.

Sean McNeil

unread,
Jan 13, 2009, 5:24:42 AM1/13/09
to android...@googlegroups.com

Interesting idea. You mean something like the attached? :)

Cheers,
Sean

power.patch

Brian Swetland

unread,
Jan 13, 2009, 9:47:35 AM1/13/09
to android...@googlegroups.com
["Xiaoyang Yu (Max)" <max....@intel.com>]

I'd prefer that we not use system properties for things that are static
build configurations, not likely to change at runtime. Right now
there's some abuse of properties along this line, which I'm hoping to
address in the future, but for the time being, it's best to avoid adding
more properties.

It might not be unreasonable to have the generic power code check for
/sys/class/backlight/... (scan, not look for hardcoded names like eeepc)
and if it doesn't find something there, see if there's a
/sys/class/leds/lcd-backlight/...

Picking up the max value from sysfs seems like the way to go.

Brian

Xiaoyang Yu (Max)

unread,
Jan 13, 2009, 7:23:33 PM1/13/09
to android-porting
Hi Brian,

Okay, I will write a patch according to your comments. Thanks a lot!

Hi Sean,

Your response is so quick! Awesome! Thanks :-)

Wu, Jackie

unread,
Jan 14, 2009, 10:41:50 PM1/14/09
to android...@googlegroups.com
One question: What should be a proper way to config such "static build configuration" for different platforms if property is designed for runtime config?
I think the Android should retain a stable hw/control interfaces and leave the specific implementation to the platform vendor.
I believe there should be some other similar cases and it might not be good or even not be feasible to use the runtime searching for some of them.
How about symbol link? But in userspace, it seems not be able to create symbol link under /sys.

Thanks
Jackie

Yu, Max A

unread,
Feb 16, 2009, 10:10:19 PM2/16/09
to android...@googlegroups.com
Brian,

Thanks a lot for your advice. I've just submitted the patch. Would you please take a look at it and see whether it fits?

http://review.source.android.com/8900


Thanks
Max (Xiaoyang)

Tel:+86.10.82171428 Fax:+86.10.82861407 iNet:87581428

-----Original Message-----
From: android...@googlegroups.com [mailto:android...@googlegroups.com] On Behalf Of Brian Swetland
Sent: 2009年1月13日 22:48
To: android...@googlegroups.com
Subject: [android-porting] Re: Backlight adjustment on Eee PC and other platforms


Reply all
Reply to author
Forward
0 new messages