support for led notifications
-
@wdehoog Willem, according to the discussion we've had on Telegram, only for convenience I'm reporting here the required output taken out from my Pro5, reviving the present thread:
- Case from "Close to full charging" to "Fully charged": USB phone charging with black screen and white led blinking all the time - charged today from 77% to 100%-------> Full report - Pro5.
Thank you.
Matteo
-
@matteo could you paste the whole unity8.log file?
weird stuff going on:
-
sometimes deviceState is charging/discharging and sometimes it is empty
-
battery level sometimes is 0
-
while discharging the level goes up
-
-
I think what we've found is that the Meizu phones (MX4 and Pro 5) only have a single-color LED below the screen (where the Android home button would be), and for whatever reason Unity8 only knows how to make it blink, never solid.
-
@wdehoog updated the previous post with the full report. I also saw that 0% charging level....weird indeed. Thank you for your help.
-
I was a bit suprised about shining led couple days ago, when I charged my Nexus 5. And even more when it turned different color after charged full. Good job, whoever made it work!
-
Willem, here below the full unity8 report:
Let me know if you need additional check.
Regards.
Matteo
-
@matteo to test your leds. It is also interesting to see the permissions. For example on opo:
phablet@ubuntu-phablet:~$ find /sys -name brightness -ls 13414 0 -rw-rw-r-- 1 system android_input 4096 Jan 5 20:48 /sys/devices/f9924000.i2c/i2c-2/2-0068/leds/red/brightness 13442 0 -rw-rw-r-- 1 system android_input 4096 Jan 5 20:48 /sys/devices/f9924000.i2c/i2c-2/2-0068/leds/blue/brightness 13428 0 -rw-rw-r-- 1 system android_input 4096 Jan 5 20:48 /sys/devices/f9924000.i2c/i2c-2/2-0068/leds/green/brightness 11561 0 -rw-rw-r-- 1 system android_input 4096 Jan 5 20:48 /sys/devices/mdp.0/qcom,mdss_fb_primary.169/leds/lcd-backlight/brightness 19339 0 -rwxrwxrwx 1 system android_media 4096 Mar 3 1970 /sys/devices/leds-qpnp-f6287e00/leds/led:flash_torch/brightness 19303 0 -rwxrwxrwx 1 system android_media 4096 Mar 3 1970 /sys/devices/leds-qpnp-f6287e00/leds/led:flash_0/brightness 19320 0 -rwxrwxrwx 1 system android_media 4096 Mar 3 1970 /sys/devices/leds-qpnp-f6287e00/leds/led:flash_1/brightness 17399 0 -rw-r--r-- 1 root root 4096 Jan 7 20:27 /sys/devices/leds-qpnp-f628c000/leds/kpdbl-pwm-2/brightness 17421 0 -rw-r--r-- 1 root root 4096 Jan 7 20:27 /sys/devices/leds-qpnp-f628c000/leds/kpdbl-pwm-3/brightness 17443 0 -rw-r--r-- 1 root root 4096 Jan 7 20:27 /sys/devices/leds-qpnp-f628c000/leds/kpdbl-pwm-4/brightness 17377 0 -rw-rw-r-- 1 system android_input 4096 Jan 5 20:48 /sys/devices/leds-qpnp-f628c000/leds/button-backlight/brightness 16275 0 -rw-rw-r-- 1 system android_input 4096 Mar 3 1970 /sys/devices/qcom,camera-led-flash.83/leds/torch-light/brightness 17292 0 -rw-r--r-- 1 root root 4096 Jan 7 20:27 /sys/devices/msm_sdcc.1/leds/mmc0::/brightness 17335 0 -rw-r--r-- 1 root root 4096 Jan 7 20:27 /sys/devices/msm_sdcc.2/leds/mmc1::/brightness
If 'phablet' is allowed you can try:
echo 1 > /sys/...../brightness
if not you must do it as root:
sudo bash -c "echo 1 > /sys/...../brightness"
(replace the dots with the full path) and try to echo different values (0,1,64,255)
Then it would also be interesting to show what other files reside in the same directories as the 'brightness' file. For example on opo:
phablet@ubuntu-phablet:~$ ls -l /sys/devices/leds-qpnp-f6287e00/leds/led:flash_torch/ total 0 -rwxrwxrwx 1 system android_media 4096 Mar 3 1970 brightness lrwxrwxrwx 1 root root 0 Jan 7 20:33 device -> ../../../leds-qpnp-f6287e00 -rw-rw-r-- 1 root root 4096 Jan 7 20:33 flash_blink -rw-rw-r-- 1 root root 4096 Jan 7 20:33 led_mode -rw-r--r-- 1 root root 4096 Jan 7 20:33 max_brightness drwxr-xr-x 2 root root 0 Mar 3 1970 power -rw-rw-r-- 1 root root 4096 Jan 7 20:33 strobe lrwxrwxrwx 1 root root 0 Jan 5 20:48 subsystem -> ../../../../class/leds -rw-r--r-- 1 root root 4096 Jan 7 20:33 trigger -rw-r--r-- 1 root root 4096 Mar 3 1970 uevent
And please post a
dmesg
log somewhere. Maybe this is related: https://e2e.ti.com/support/power-management/f/196/t/421131 -
@wdehoog hi Willem, thank you for the suggestions. I searched on the internet and what @UniSuperBox said before about only the white color to be natively available on the Meizu phones seems correct: at least one app does exist on Flyme/Android side able to unleash all the other colors for the Pro5 as well, so maybe also for UT a work-around could be eventually feasible somehow ---------> RGB led notification Flyme
Now, here below the check I made.
phablet@ubuntu-phablet:~$ sudo find /sys -name brightness -ls 8459 0 -rw-rw---- 1 system system 4096 gen 9 09:06 /sys/devices/virtual/backlight/pwm-backlight.0/brightness 15318 0 -rw-rw-rw- 1 root root 4096 gen 9 09:06 /sys/devices/gpioi2c0.14/i2c-12/12-0030/leds/m86_led/brightness 15238 0 -rw-r--r-- 1 root root 4096 gen 9 09:23 /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/flash0/brightness 15252 0 -rw-r--r-- 1 root root 4096 gen 9 09:23 /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/flash1/brightness 15266 0 -rw-r--r-- 1 root root 4096 gen 9 09:23 /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/torch0/brightness 15280 0 -rw-r--r-- 1 root root 4096 gen 9 09:23 /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/torch1/brightness
I typed
sudo bash -c "echo 1 > /sys/...../brightness"
for all of the items listed above but apparently it didn't work; actually, the only consequence I've seen is when I got the usb cable connected powering up the phone with the notification light blinking, just after sending one of those commands the light suddenly disappeared.
The following is what I have got in each of the folders above listed:phablet@ubuntu-phablet:~$ ls -l /sys/devices/virtual/backlight/pwm-backlight.0/ total 0 -r--r--r-- 1 root root 4096 gen 9 09:35 actual_brightness -rw-r--r-- 1 root root 4096 gen 9 09:35 bl_power -rw-rw---- 1 system system 4096 gen 9 09:30 brightness -r--r--r-- 1 root root 4096 gen 9 09:35 max_brightness drwxr-xr-x 2 root root 0 gen 9 09:06 power lrwxrwxrwx 1 root root 0 gen 9 09:06 subsystem -> ../../../../class/backlight -r--r--r-- 1 root root 4096 gen 9 09:35 type -rw-r--r-- 1 root root 4096 gen 9 09:05 uevent
phablet@ubuntu-phablet:~$ ls -l /sys/devices/gpioi2c0.14/i2c-12/12-0030/leds/m86_led/ total 0 -rw-rw-rw- 1 root root 4096 gen 9 09:24 brightness lrwxrwxrwx 1 root root 0 gen 9 09:37 device -> ../../../12-0030 -rw-r--r-- 1 root root 4096 gen 9 09:37 led_current -r--r--r-- 1 root root 4096 gen 9 09:37 max_brightness -r--r--r-- 1 root root 4096 gen 9 09:37 max_current drwxr-xr-x 2 root root 0 gen 9 09:06 power lrwxrwxrwx 1 root root 0 gen 9 09:06 subsystem -> ../../../../../../class/leds -rw-r--r-- 1 root root 4096 gen 9 09:37 trigger -rw-r--r-- 1 root root 4096 gen 9 09:05 uevent
phablet@ubuntu-phablet:~$ ls -l /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/flash0/ total 0 -rw-r--r-- 1 root root 4096 gen 9 09:29 brightness lrwxrwxrwx 1 root root 0 gen 9 09:37 device -> ../../../13-0063 -rw-r--r-- 1 root root 4096 gen 9 09:37 enable -r--r--r-- 1 root root 4096 gen 9 09:37 max_brightness -rw-r--r-- 1 root root 4096 gen 9 09:37 onoff drwxr-xr-x 2 root root 0 gen 9 09:06 power -rw-r--r-- 1 root root 4096 gen 9 09:37 source lrwxrwxrwx 1 root root 0 gen 9 09:06 subsystem -> ../../../../../../class/leds -rw-r--r-- 1 root root 4096 gen 9 09:37 timeout -rw-r--r-- 1 root root 4096 gen 9 09:37 trigger -rw-r--r-- 1 root root 4096 gen 9 09:05 uevent
phablet@ubuntu-phablet:~$ ls -l /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/flash1/ total 0 -rw-r--r-- 1 root root 4096 gen 9 09:29 brightness lrwxrwxrwx 1 root root 0 gen 9 09:39 device -> ../../../13-0063 -rw-r--r-- 1 root root 4096 gen 9 09:39 enable -r--r--r-- 1 root root 4096 gen 9 09:39 max_brightness -rw-r--r-- 1 root root 4096 gen 9 09:39 onoff drwxr-xr-x 2 root root 0 gen 9 09:06 power lrwxrwxrwx 1 root root 0 gen 9 09:06 subsystem -> ../../../../../../class/leds -rw-r--r-- 1 root root 4096 gen 9 09:39 trigger -rw-r--r-- 1 root root 4096 gen 9 09:05 uevent
phablet@ubuntu-phablet:~$ ls -l /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/torch0/ total 0 -rw-r--r-- 1 root root 4096 gen 9 09:30 brightness --w--w---- 1 root root 4096 gen 9 09:40 chip_reg lrwxrwxrwx 1 root root 0 gen 9 09:40 device -> ../../../13-0063 -rw-r--r-- 1 root root 4096 gen 9 09:40 enable --w--w---- 1 root root 4096 gen 9 09:40 hwen -r--r--r-- 1 root root 4096 gen 9 09:40 max_brightness -rw-r--r-- 1 root root 4096 gen 9 09:40 onoff drwxr-xr-x 2 root root 0 gen 9 09:06 power -rw-r--r-- 1 root root 4096 gen 9 09:40 source lrwxrwxrwx 1 root root 0 gen 9 09:06 subsystem -> ../../../../../../class/leds -rw-r--r-- 1 root root 4096 gen 9 09:40 trigger -rw-r--r-- 1 root root 4096 gen 9 09:05 uevent
phablet@ubuntu-phablet:~$ ls -l /sys/devices/gpioi2c1.15/i2c-13/13-0063/leds/torch1/ total 0 -rw-r--r-- 1 root root 4096 gen 9 09:30 brightness lrwxrwxrwx 1 root root 0 gen 9 09:40 device -> ../../../13-0063 -rw-r--r-- 1 root root 4096 gen 9 09:40 enable -r--r--r-- 1 root root 4096 gen 9 09:40 max_brightness -rw-r--r-- 1 root root 4096 gen 9 09:40 onoff drwxr-xr-x 2 root root 0 gen 9 09:06 power lrwxrwxrwx 1 root root 0 gen 9 09:06 subsystem -> ../../../../../../class/leds -rw-r--r-- 1 root root 4096 gen 9 09:40 trigger -rw-r--r-- 1 root root 4096 gen 9 09:05 uevent
-
In regard to the dmesg log, may I ask you what's that for? Only to understand the purpose, generally speaking. I looked for /var/log directory and I found several archived dmesg files but a bit outdated I'd say. However, I'd copied the most up to date dmesg file and in the following link you can find the details: dmesg.log
Please, tell me if you need something else from me. Needless to say, I really appreciate what you are doing
-
@matteo in this link they mention a problem with the led driver your phone has (I don't have one so I could be totally wrong). And this link mentions how you could get it to show something (if it works).
So do you get any results with
find /sys/bus/i2c -name select_engine
or withfind /sys/bus/i2c -name lp5562
-
@matteo If the led went off with
sudo bash -c "echo 1 > /sys/...../brightness"
then you are on to something. Try other values (64, 255).
Also check whatcat /sys/.../onoff
says orcat /sys/.../enable
. -
@wdehoog Willem, I started looking around at the references you gave to me. According to an other post in this Forum, it seems the RGB leds are disabled on purpose; see here below the section of the kernel file
leds-lp5562.c
commented out for this reason:static struct lp55xx_led_config lp5562_led_config[] = { /*{ .name = "R", .chan_nr = 0, .led_current = 20, .max_current = 40, }, { .name = "G", .chan_nr = 1, .led_current = 20, .max_current = 40, }, { .name = "B", .chan_nr = 2, .led_current = 20, .max_current = 40, },*/ { .name = "m86_led", .chan_nr = 0, .led_current = 80, .max_current = 80, }, };
I think this is the major culprit for not having any other colors but the white for the RGB led installed on the Meizu Pro5. My question is: how can I flash only this part of the kernel, prior modifying that code to see if it helps to solving that issue?
-
@matteo I dindβt find Time to do it but I think the best way would be to download the kernel turbo from github, modify the driver, compil the kernel and simply copy paste the module on the device with a write fs activated. My plan was to do that like this.
-
@matteo if the led support is build as a module then this module can be copied to the rootfs. If not I guess you can test a new kernel with
fastboot boot
which boots the kernel without installing it first. -
You do miss a point here: Channel 0 in this definition would then be used by red and white. So to me that sounds as if there is no RGB led installed, but just a white one. You will probably gain nothing from this experiment, maybe even damage your hardware. I would be very careful, this code was commented for a reason (and reminds me of deleting unused code, never leave commented code like this in a production driver.)
-
@Flohack they are in fact 4 leds on the meizu pro 5 hardware, RGB and White. We can see the colors when the phone is running Flyme. I dont know the reason Why they only activate the white one but in hardware point of view, from the lp5562 datasheet we can see that it is able to drive 4 Leds, so I'm not sure that we can damage anythings on the phone by trying to activate other channels registers.
If you don't feel it, I can try it as I have 5 Pro5 and one of the isn't usable as phone because the IMEI are missing.
but you will have to wait as I don't have so many time to do that for now.
-
Ok in this case I still dont get the same channel number 0 for red and white?
-
@Flohack in my opionion, normally not, it must be a channel per color. a Year ago I modifyed the file already in order to use the 3 other channels but I don't remember where I put this file ...
-
@Flohack @matteo Ok I have to correct what I say, you can forget the RGB on Meizu Pro 5, I unmounted one, and there is only a single white LED, no RGB LED on the PCB. I then powered up my Pro5 running Flyme and try to send it different notification (low batt, charging, sms messaging, missed call), all the time the notification was white, the only difference between sms and call is the led pattern. When a sms arrive, the LED is breathing like actually on ubport, when a call is missed, the led blink once quickly, then once quickly with a breath effect.
They are no LED indications on low battery or charging on Flyme.There is no way of getting RGB colors on Meizu Pro 5.
We can only play with pattern.
That's why the driver was commented and the white LED was connected on the Red channel from the LD5562 chip. -
@AlainW94 I assumed this sorry to say