You could trace  AOSP for how android framework handle the power key event. 
 

As for the part how it talk with kernel driver, most of time, this is 
handled in HAL, the  DisplayManagerService would response to the PowerState 
Change and  call the setPowerMode function at SurfaceFlinger,  and then 
with these codes:
    if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) {
            return (status_t)mHwc->setPowerMode(mHwc, disp, mode);
    } else {
            return (status_t)mHwc->blank(mHwc, disp, mode == 
HWC_POWER_MODE_OFF ? 1 : 0);

On hwcomposer, it would talk with kernel driver through ioctls like this:
    ioctl(_contextAnchor->fbFd, FBIOBLANK, fb_blank);


For some devices, there may have sys nodes exported to control the screen 
power, it depends on the reality of your kernel driver.


在 2016年12月1日星期四 UTC+8下午2:56:32,ranchu写道:
>
> Hello,
>
> I'm struglling for some days now to turn off screen.
> I can do that with "input keyevent 26", but I rather do it directly to 
> kernel.
> If I had known which sysfs maybe is called on doing " input keyevent 26" 
> it could have helped me a lot.
> Is it with ftrace ? ftrace not enabled in my manufacture's kernel.
>
> I made *many* trials in sort of "echo 0 > brightness", but I get only 
> darker screen, but not a screen turned off.
>
> Trying to understand why "input keyevent 26" works, while others trials 
> fails...
> I appreciate any feedback on this.
> I'm using android 5.1.1 with kernel 3.4.0-perf
>
> Regards,
> Ranchu
>

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to