lg-devs / android_kernel_lge_msm8974

Other
4 stars 29 forks source link

back button notification led flashing fix #15

Open sandys opened 9 years ago

sandys commented 9 years ago

hi, posting this issue (and possible rough fix ) here, because I do not know which one is the right repo.

  1. the back button led on the g2 is classified as LIGHT_ID_ATTENTION and is defined here
  2. In platforms/frameworks, this notification is actually disabled because most phones dont have a attention led.
  3. even if we enable the notification LED, the function that has the most amount of work (things like - dont flash notification while in a call, etc.) are in updateLightsLocked and that only works with notification lights and not attention lights
  4. my proposal is to change the code in android_device_lge_g2-common/liblight/lights.c and to change set_speaker_light_locked. This the piece of code that ultimately sets the blink pattern. I recommend that the code from set_light_attention be duplicated in it ... in such a way at LIGHT_FLASH_TIMED and LIGHT_FLASH_NONE are taken care of.
Rashed97 commented 9 years ago

Hmm never looked into it, but thanks for the insight. I'm a bit tied up with the HTC One M9 right now so I won't be able to try that for a bit, but if you want to take a shot at it and of it works I'll happily merge it.

On Wed, Jun 24, 2015, 8:53 PM Sandeep Srinivasa notifications@github.com wrote:

hi, posting this issue (and possible rough fix ) here, because I do not know which one is the right repo.

1.

the back button led on the g2 is classified as LIGHT_ID_ATTENTION https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L262 and is defined here https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L207 2.

In platforms/frameworks, this notification is actually disabled https://github.com/android/platform_frameworks_base/blob/3f453164ec884d26a556477027b430cb22a9b7e3/core/res/res/values/config.xml#L502 because most phones dont have a attention led. 3.

even if we enable the notification LED, the function that has the most amount of work (things like - dont flash notification while in a call, etc.) are in updateLightsLocked https://github.com/android/platform_frameworks_base/blob/dc22cfed5d3a65dcd3979113dbce468ad8ec2868/services/core/java/com/android/server/notification/NotificationManagerService.java#L2751 and that only works with notification lights and not attention lights 4.

my proposal is to change the code in android_device_lge_g2-common/liblight/lights.c and to change set_speaker_light_locked https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L137. This the piece of code that ultimately sets the blink pattern https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L162. I recommend that the code from set_light_attention https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L209-L229 be duplicated in it ... in such a way at LIGHT_FLASH_TIMED https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L148 and LIGHT_FLASH_NONE https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593%0D%20fa/liblight/lights.c#L152 are taken care of.

— Reply to this email directly or view it on GitHub https://github.com/lg-devs/android_kernel_lge_msm8974/issues/15.

sandys commented 9 years ago

will try - I'm on the road without my dev laptop :(

btw - I confirmed this works using adb shell and su

echo 255 > /sys/class/leds/button-backlight1/brightness will start the back button and echo 0 > /sys/class/leds/button-backlight1/brightness will shut it

echo 255 > /sys/class/leds/button-backlight1/blink will make it blink echo 10 > /sys/class/leds/button-backlight1/ramp_step_ms will change the blink frequency

additionally there is no such thing as /sys/class/g2_rgb_led/use_patterns/blink_patterns

there is only _/sys/class/lg_rgb_led/use_patterns/blinkpatterns

Rashed97 commented 9 years ago

Yeah I know about that blink patterns. I'll change it soon.

On Wed, Jun 24, 2015, 11:11 PM Sandeep Srinivasa notifications@github.com wrote:

will try - I'm on the road without my dev laptop :(

btw - I confirmed this works using adb shell and su

echo 255 > /sys/class/leds/button-backlight1/brightness will start the back button and echo 0 > /sys/class/leds/button-backlight1/brightness will shut it

echo 255 > /sys/class/leds/button-backlight1/blink will make it blink echo 10 > /sys/class/leds/button-backlight1/ramp_step_ms will change the blink frequency

additionally there is no such thing as /sys/class/g2_rgb_led/use_patterns/blink_patterns https://github.com/CyanogenMod/android_device_lge_g2-common/blob/a59bc35a286c1ce8f2d8bba22f8875a40f2593fa/liblight/lights.c#L48

there is only _/sys/class/lg_rgb_led/use_patterns/blinkpatterns

— Reply to this email directly or view it on GitHub https://github.com/lg-devs/android_kernel_lge_msm8974/issues/15#issuecomment-115086595 .