Go to previous topic
Go to next topic
Last Post 02 Mar 2016 10:03 AM by  mvly
Brightness changes after returning to home screen android
 4 Replies
Author Messages
mvly
Basic Member
Basic Member
Posts:104


--
25 Feb 2016 04:10 PM

    I noticed that after changing the brightness to near 0 or 0 using a custom app on android and returning to the home screen, the LCD brightness returns to 20? Why is this happening? I am not sure if other android devices does this, but it seems like the DM3730 android 2.3.4 build is doing it. Is there a way to prevent it from doing this? Where would I look in the kernel or what-not to prevent this from happening.

     

    I also noticed it slowly returns to 0.

     

    By the way, I am writing to the /sys/class/backlight/omap3logic/brightness and this still doesn't help.

     

    I can always do a delay timer to do a system write to the variable above after 2 seconds or so after returning to home screen using onPause or onDestory, but I was wondering if there is a better solution.

     

     

    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    25 Feb 2016 04:12 PM

    I meant it slowly returns to 20 as oppose to 20 right after returning to the home screen.

    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    25 Feb 2016 05:10 PM
    I talked with one of our developers and he said you could disable it in hardware/logicpd/dm3730/liblights/dm3730logic/lights.c

    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    02 Mar 2016 09:57 AM

    THanks for the recommendation. I just comment out where it updated the brightness in the file and it works! Though I don't have brightness control from the settings app anymore. For my purpose, it doesn't really matter. So Thanks!

    mvly
    Basic Member
    Basic Member
    Posts:104


    --
    02 Mar 2016 10:03 AM
    Here is the part in the file I changed.

    if(ver >= KERNEL_VERSION(3,0,0))
    {
    //err = write_int(LCD_FILE_2, brightness);
    if (err != 0)
    LOGI("write_int failed to open %s\n", LCD_FILE_2);
    }
    else
    {
    // Older kernel has a smaller brightness range
    brightness = brightness*100/255;
    //err = write_int(LCD_FILE_1, brightness);
    if (err != 0)
    LOGI("write_int failed to open %s\n", LCD_FILE_1);
    }


    I commented out the err = write... part

    furthermore, I created an app that uses Android NDK to write directly to the /sys/class/backlight/omap3logic/brightness file directly when the user move the slider. Obviously I had to enable app access to that variable in the init.rc by changing the permission from 0666 to 0777 in the init.rc.


    ---