Closed klic closed 3 years ago
I can't create any app specific rules in settings. Logcat shows multiple messages
LightsService: Light requested not available on this device. 2
.
EDIT: 2 is the type which maps to BUTTONS according to https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/master/light/2.0/types.hal
This commit (af23e1da97e532ba8c06fb4a2a47c405340c8bba) says it limits it to blue only. You can edit light/Light.cpp to enable it. Although I am not sure it has the hardware for other colours.
Try this: In file light/Light.cpp uncomment lines: 88 to 91 and 96 to 100. Rebuild and test.
Did someone already try building this with the suggestion above? I find it rather annoying that I can't differentiate between different apps with the color of the LED :-)
I haven't tested it because I don't own a fairphone. I can build it for you if you want to test it.
Do you already have a working build environment for this? If so, then sure, fire it up. I'll give it a shot :-)
If not, I'll figure that out myself tomorrow or so. Need to prepare some things first then.
I have a working environment. I started the build, I am at 55% should be done in 30-60 min.
Pc failed to build it. I will look into it tomorow.
Unfortunately commenting out the lines in light/Light.cpp
resulted in an ugly color changing. I guess because of a delay between the colors. So I modified it that it at least allows to select between red, green and blue. Would this be sufficient?
I built an image for testing (with microG).
However I didn't try to additionally play with the brightness of the colors. But I guess this will not work with breathing.
I can't try it out for the next few days as I'm out of town.
However, I don't currently run with MicroG (I have GApps installed as I need that for several apps I use), is your build compatible with that? Or can I expect breakage when I upgrade to that version? (I don't really mind, as long as it is fixable without restoring everything manually :-) )
I'm no programmer, but I know the OneplusX (onyx) also has an RGB LED), I looked up the source for the light library, maybe we can use this? https://github.com/LineageOS/android_device_oneplus_onyx/blob/lineage-15.1/liblight/lights.c
I still have one lying around and I just ran https://play.google.com/store/apps/details?id=com.coolbeans.ledtester in Disco Mode. All the colors work flawlessly, it blinks in different colors for each blink. If we can get that functionality for the FP3, I think we're golden.
I build it without microG. I also modified the overlay options. Not sure if it helps or makes it worse. Just make sure to backup, before you flash.
Cool, I'll check it out during the weekend when I have more time!
To be continued!
However, I don't currently run with MicroG (I have GApps installed as I need that for several apps I use), is your build compatible with that? Or can I expect breakage when I upgrade to that version?
This may cause issues most likely. I'll build a version w/o MicroG.
I'm no programmer, but I know the OneplusX (onyx) also has an RGB LED), I looked up the source for the light library, maybe we can use this? https://github.com/LineageOS/android_device_oneplus_onyx/blob/lineage-15.1/liblight/lights.c
This may not be easily possible. It seems that this kernel module allows configuration of all colors before it gets activated at once via rgb_blink. So also modification in the kernel module would be required before that can be used.
@mstaz Could you test this in an adb root shell(create a shell script in tmp):
echo 0 > /sys/class/leds/red/breath echo 0 > /sys/class/leds/green/breath echo 0 > /sys/class/leds/blue/breath echo 1 > /sys/class/leds/red/breath echo 1 > /sys/class/leds/green/breath echo 1 > /sys/class/leds/blue/breath
It should blink white. It would tell if it is a timing issue. Just make sure you don't get a notification etc while testing.
@csaba215 I will try the script tonight and will let you know :-)
I don't have that custom build installed but a previous LineageOS build and just tried the script: It does blink white. But the blink begins in red while it gets brighter (this is not very long but noticeable), then it is white and turns blueish for the last moment while it gets darker again. Switching the order in the script changes the colors that appear at the beginning and end. It seems the driver is quite slow in enabling the different colors.
Same for me, I'm on the last los build w/o microg
@benlorenz
Can you try it with tee
?
echo 0 | tee /sys/class/leds/red/breath /sys/class/leds/green/breath /sys/class/leds/blue/breath
echo 1 | tee /sys/class/leds/red/breath /sys/class/leds/green/breath /sys/class/leds/blue/breath
This should eliminate any delays caused by bash for running 6 commands in sequence.
There are still some different colors at the beginning and end, in this case slightly blue at the beginning and orange at the end.
Since It's a timing issue i modified light/Light.cpp to open the 3 files first then write the value to them. Might solve the the timing issue. I am building it now.
Here's my build : https://github.com/csaba215/android_device_fairphone_FP3/releases/tag/v1 You can also find the modifications I used here.
Got it running!
Still has a timing issue. I'll try to make a lil video so you can see ->http://ulukai.element-networks.nl/VID_20200907_213945.mp4
I'll leave it up for a few days, so you can download it. It's 134MB
I have also tried messaging myself with WhatsApp and Signal, that works :-) I have 2 differently colored notifications now!
FYI, the last 'unread' color sticks and if you think it's not fully off before breathing again, that's correct. I have verified it with my GF's FP3 and that's stock behaviour (hers is unmodded).
Thank you for the video. This issue is quite tricky. Breathing also has a kernel patch by Fairphone. I will look into it further in the kernel side. Also might worth a try using the stock settings instead of the one by fairphone on the kernel side.
I just want to mention that the same issue exists using a completly original FP3 with stock rom. There the colors also "fade" through some part of RGB and not every color is usable. So it would be even more awesome if we could fix this ;-)
I reverted the led patch by fairphone here. It should breath for shorter and faster.
I'll try flashing it tonight and make another video. But good to know the one I currently run already replicates stock behavior, that's a win in my book :-)
I'm currently running the build by @mstaz (PQ3A.190801.002 eng.root.20200824.191633). I see the same color shift when fading all leds, but different led colors depending on the app work great. I haven't noticed any side effects or unstability.
I'll try flashing it tonight and make another video. But good to know the one I currently run already replicates stock behavior, that's a win in my book :-)
No need to test this one. I think I found the issue. I'll write a test code and make a build tomorrow.
awesome! thanks a lot! :-)
https://github.com/csaba215/android_device_fairphone_FP3/releases/tag/v3 try this to see if it works. It should fix the color mix problem. Test white first. ;-)
@Thulium-Drake Did you manage to test it? I am curious if it works. If it works, I would submit a pr request :)
Sorry for the delay! Working on it right now!
Got it running, bad news, this time there's no LED color at all 🤔
That's interesting. I'll check my code to see what's wrong.
Word of warning to others fiddling around, restoring/downgrading was a bust.. I'm restoring my Titanium Backups on a freshly wiped install now. It just will not boot a TWRP backup... (which, I guess saves me a lot of time by not making them in the future).
From what I gather from places around the web is that it has something to do with the File Based Encryption.
So, learn from me, make TB backups and store them OUTSIDE your phone! (I use tasker to fire up an SSH server which is then targeted by rsync)
You could probably dirty flash It shouldn't cause problems.
I tried that (I had backups anyway), but after 2 attempts to boot LOS recovery prompted me to wipe it. Before doing so I tried:
None of the above allowed it to boot.
But it booted now, I'm going to try and restore Data only now. -> Also a bust, TB backups it is
I think I found the issue. I also added error reporting to the code this should help if things go wrong. I am doing a build now.
Sorry for the (massive) delay! But I didn't get around testing it earlier. Just flashed it to my phone, it booted up just fine.
I tried the LEDs and they work great!
I'll make a video when my girlfiend is home tonight (need more then 2 hands).
Colorwise, magenta is solid, yellow is a bit orange and white isn't perfect white, but it's definitely good enough! (which I expected as it's really hard to mix RGB leds :-) )
If it's not a timing issue then I can't help with mixing better colours. You would need to completely rework the whole thing assuming that it's even possible since it's done in hardware anyway. Also you can only have Red,Green,Blue on or off there's no brightness control for breathing. So that's 9 colour only.
I've seen LEDs like these before, you never get them fully right. But like I said, your latest patch makes it miles better then what we had before ;-)
I'd say it's ready for a PR!
The system does not honor the color definition for led color for notifications. Also, I seem to be able to define exception rules for LEDs in settings. I don't see anything in logcat when doing so
( Note: i compiled the rom myself, if this makes a difference. In the meantime i switched to the precompiled rom, same thing)