[ROOT][APP] Logo+ - OSS Implementation of Lighting Effects for Razer Phone 2

Search This thread

CurtisMJ

Senior Member
May 23, 2013
633
532
ic_launcher_round.png

My device has met with QC issues and I've elected not to replace it. Development on this project may stagnate
LogoPlus is an Open Source Alternative to the stock Razer Chroma Configurator app and corresponding service

The latest version can be downloaded from GitHub (cant load XDAs upload plugin in my browser for some reason)

Demo video attached to post #2

The current feature set includes:
  • Select custom notification color per app
  • Set LED brightness
  • Up to 4 apps' colors on the logo at once
  • 5 different passive effects
  • Animation for phone ringing, with different colors per contact
  • Pocket mode. Lights turn off if placed into a pocket or bag
  • Automation integration (Tasker/Locale)
  • Charging animation
  • Custom effect programs
  • Music visualizer (controllable via automation plugin)

In order to use the app correctly, please disable the "Chroma" system app
Currently notifications will only be displayed when the phone is locked (screen off or on lock screen)
Also please enable notification access for the app as it currently doesnt ask for it automatically
Also please disable battery optimisation for the app so Android doesn't kill the service

Also I haven't done apps for a while, so please excuse the very messy code :p

XDA:DevDB Information
LogoPlus, Device Specific App for the Razer Phone 2

Contributors
CurtisMJ
Source Code: https://github.com/CurtisMJ/LogoPlus


Version Information
Status: Stable
Current Stable Version: 1.0.13
Stable Release Date: 2020-04-09

Created 2019-01-26
Last Updated 2020-04-09
 

Attachments

  • Screenshot_20190131-223031.png
    Screenshot_20190131-223031.png
    109.3 KB · Views: 5,602
  • Screenshot_20190131-223019.jpg
    Screenshot_20190131-223019.jpg
    107.4 KB · Views: 5,584
  • Screenshot_20190131-223012.jpg
    Screenshot_20190131-223012.jpg
    215 KB · Views: 5,573
Last edited:

CurtisMJ

Senior Member
May 23, 2013
633
532
Reserved

Changelog:
v1.0:
- Initial release
v1.0.1:
- Improved service coordination
- Code cleanup
- Added passive effects
v1.0.2
- Bug fixes and code cleanup
- Service co-ordination improvements
v1.0.3
- Moved to Room DB for persistence
- Support libraries migrated to AndroidX
- Various threading and coordination improvements
v1.0.4
- Main service is now a proper state machine, allowing for functionality to be more easily added in future
- Notification listener caches settings in RAM for better performance and efficiency
- Various bug fixes
v1.0.5
- Tweaked microcode to be more efficient, as a result, 6 colors can now be displayed at once for app notifications.
- State machine paths improved
- Separation of concerns in state machine, allowing for more possible backends for controlling the lights (such as stock ROM system services)
- Phone ring animation! Complete with specific colors per contact!
Disclaimer:
This build contains dormant code for both the rootless mode and music visualizer, 'cause using feature branches would mean I have my life together. I'll activate them when they're stable enough to actually use.
v1.0.6
- Pocket mode! When the screen is switched off, the app will query various sensors for a few seconds afterwards and if it is determined the device is placed in a pocket or bag, the lights will be disabled, which can save battery.
- Some explanations added for the 2 toggles in the passive effect screen
- Service worker wakelock renamed to more accurately describe its source
- Code cleanup
v1.0.7
- First stable release
- New icon
- Automation integration (Tasker) first phase
- In order for automation to work, the "Allow Automation" switch must be turned on from the main drawer
- New "Roll" passive effect
- Code cleanup and optimization
v1.0.8
- Charging animation
- Various improvements to state machine
- Now asks for exemption from battery optimization
- Sped up fadeout effect
v1.0.9
- Dependency updates (newer libsuperuser)
- Added custom effects!
NOTE: Custom effect programs must be compiled with Texas Instruments' Lysti compiler which can be found on the support page of the LP5523 controller.
See my Chroma research thread on XDA for details:
https://forum.xda-developers.com/razer-phone-2/development/research-oss-chroma-service-t3890290
v1.0.10
- Limit of 6 apps on LEDs at once has been reduced to 4 in order to generate higher quality microcode, as there was an issue with timing before which could make it unclear what color the logo is flashing
- Now uses E164 format phone numbers internally for comparison. This should make number identification for ring animation more reliable.
- Notification preference for apps now previews the color on the logo while picking
v1.0.11
- Music Visualizer! Toggle the visualizer switch in the drawer and then play some music!
Side note: I'm pretty sure this is bad for the LEDs. Use sparingly :p
v1.0.12
Now asks for recording permissions!
Also BitDefender didn't mark it as malicious! I have literally no idea!
v1.0.13
Added ability to control visualizer state from automation plugin! (Tasker, Locale)
You may wish to disable the toggle for automatic visualization state control in the main UI as this may interfere with your custom logic in your automation application of choice.
 

Attachments

  • Logoplusdemo.zip
    7.1 MB · Views: 579
Last edited:

CurtisMJ

Senior Member
May 23, 2013
633
532
Reserved

Creating custom effects
The app supports loading of custom microcode programs into an effect slot. This allows for many possible lighting effects for the passive effect.
Please note that creating custom effects is very advanced! One should have at least some knowledge of assembly, programming and integrated circuits in general. Reading Texa Instruments' literature on the controller is strongly advised, the LED controller is very constrained in it's abilities.
In order to begin, you will need the TI Lysti compiler. You can find a link to it in post #1 of my Chroma Research Thread under "Controller OEM support"
The compiler compiles an assembly style language called Lysti into a .hex file. Rename the .hex to .txt and place the file somewhere on your phone's internal storage, then click the "Load Custom" button from in the app and select the file. The program will be validated and you will see either a success or failure message. Once loaded, the program will play as the passive effect if you have the "Custom" effect selected as your passive effect. Only one program at a time is currently supported.

Below is a sample of the "Pinwheel" effect used by the app in Lysti:
Code:
ENG1: dw 0000000001011000b ; R G B
ENG2: dw 0000000010100001b ; G B R
ENG3: dw 0000000100000110b ; B R G
ALL: dw 0000000111111111b

.segment program1 
mux_map_addr ALL
set_pwm 0
trigger s{2|3}
loop2: mux_map_addr ENG1 
ramp 2, 255 
ramp 2, -255 
ramp 2, -255 
branch 0, loop2 
rst

.segment program2 
trigger w{1} 
loop3: mux_map_addr ENG2 
ramp 2, -255 
ramp 2, 255 
ramp 2, -255 
branch 0, loop3 
rst

.segment program3 
trigger w{1} 
loop4: mux_map_addr ENG3 
ramp 2, -255 
ramp 2, -255 
ramp 2, 255 
branch 0, loop4 
rst
This compiles into the following .hex
Code:
00 58 00 A1 01 06 01 FF 9F 83 40 00 E0 0C 9F 80 
20 FF 21 FF 21 FF A0 03 00 00 E0 80 9F 81 21 FF 
20 FF 21 FF A0 01 00 00 E0 80 9F 82 21 FF 21 FF 
20 FF A0 01 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
@ 04 program1
@ 0D program2
@ 14 program3
The first 12 lines consist of the compiled bytes of the program followed by the offsets for the 3 program counters (The controller is a triple core :) )
 
Last edited:

Pete450

Senior Member
Dec 2, 2008
258
490
Awesome work! So glad someone has taken this on. Will definitely watch this thread and look forward to future updates, feature expansions, and bug fixes, etc. Good job so far.
 

CurtisMJ

Senior Member
May 23, 2013
633
532
Will it always be the case that the app requires root access?
It might be possible to implement the functionality in a daemon, or even as a system service for custom ROMs where we can add source code (this is how Razer did it).
It's also probably possible to use Razer's own system service, but that's a lot of reverse engineering on the Chroma Configurator, and won't work for custom ROMs. Using root seems more aligned to the purpose of the app at the moment but I'll consider alternatives. Most of the magic was figuring out the microcode anyway
 

CurtisMJ

Senior Member
May 23, 2013
633
532
I keep getting this when enabling the service
Just realized I have release builds up so the logs won't even be much use... Sorry about that, you can try clearing the app's data and see if it'll cooperate. I've got another version soon. I'll remember to enable debug build :D
 

Flippy125

Inactive Recognized Developer
Jan 14, 2010
1,005
308
Las Vegas
Awesome work! This is functionality that should have shipped with the phone from the factory. Been running the pinwheel animation for the past 1.5 days and haven't noticed any increased battery usage.
 
  • Like
Reactions: RKBD and CurtisMJ

CurtisMJ

Senior Member
May 23, 2013
633
532
OK, new build is up! v1.0.3
This is mostly just trying to stabilize the app. New features should come soon
If the release build gives issues, please switch to the debug build and capture some logcats. Only logcats for the application package is sufficient
Lastly, as I've changed the persistence system, unfortunately settings from v1.0.1 wont carry over
 
Last edited:
  • Like
Reactions: RKBD
Aug 20, 2018
16
5
It might be possible to implement the functionality in a daemon, or even as a system service for custom ROMs where we can add source code (this is how Razer did it).
It's also probably possible to use Razer's own system service, but that's a lot of reverse engineering on the Chroma Configurator, and won't work for custom ROMs. Using root seems more aligned to the purpose of the app at the moment but I'll consider alternatives. Most of the magic was figuring out the microcode anyway

I'm gonna level with you man, I don't understand a lot of this. I was hoping it was as easy as having one that worked on custom ROMs and another that could be sideloaded as another app on the stock non-rooted RP2, but now that I'm thinking about it I suppose you are controlling a pretty odd piece of actual physical hardware that isn't exactly standard on phones.

I'll keep this thread around and check it every now and then to see if a non-root version ever comes around. It seems super cool, and I'm glad someone is tackling the logo, even if (at least right now) I can't take advantage of it. Keep up the cool work, dude.
 

M1cky

Senior Member
Apr 22, 2011
100
18
Dublin
For anyone that hasn't given this a go, try it! It's spectacular. Exactly what the Chroma app should be. The pinwheel effect is sexy af too! Good work, keep it up.

Briefly had a issue with it not turning off when screen was off, toggle seemed to do nothing, reinstall fixed it. No issues otherwise.
 

CurtisMJ

Senior Member
May 23, 2013
633
532
v1.0.4 has been uploaded
Still mostly a bugfix build
If the release build gives issues, please switch to the debug build and capture some logcats. Only logcats for the application package is sufficient
 

Top Liked Posts

  • There are no posts matching your filters.
  • 32
    ic_launcher_round.png

    My device has met with QC issues and I've elected not to replace it. Development on this project may stagnate
    LogoPlus is an Open Source Alternative to the stock Razer Chroma Configurator app and corresponding service

    The latest version can be downloaded from GitHub (cant load XDAs upload plugin in my browser for some reason)

    Demo video attached to post #2

    The current feature set includes:
    • Select custom notification color per app
    • Set LED brightness
    • Up to 4 apps' colors on the logo at once
    • 5 different passive effects
    • Animation for phone ringing, with different colors per contact
    • Pocket mode. Lights turn off if placed into a pocket or bag
    • Automation integration (Tasker/Locale)
    • Charging animation
    • Custom effect programs
    • Music visualizer (controllable via automation plugin)

    In order to use the app correctly, please disable the "Chroma" system app
    Currently notifications will only be displayed when the phone is locked (screen off or on lock screen)
    Also please enable notification access for the app as it currently doesnt ask for it automatically
    Also please disable battery optimisation for the app so Android doesn't kill the service

    Also I haven't done apps for a while, so please excuse the very messy code :p

    XDA:DevDB Information
    LogoPlus, Device Specific App for the Razer Phone 2

    Contributors
    CurtisMJ
    Source Code: https://github.com/CurtisMJ/LogoPlus


    Version Information
    Status: Stable
    Current Stable Version: 1.0.13
    Stable Release Date: 2020-04-09

    Created 2019-01-26
    Last Updated 2020-04-09
    5
    Reserved

    Changelog:
    v1.0:
    - Initial release
    v1.0.1:
    - Improved service coordination
    - Code cleanup
    - Added passive effects
    v1.0.2
    - Bug fixes and code cleanup
    - Service co-ordination improvements
    v1.0.3
    - Moved to Room DB for persistence
    - Support libraries migrated to AndroidX
    - Various threading and coordination improvements
    v1.0.4
    - Main service is now a proper state machine, allowing for functionality to be more easily added in future
    - Notification listener caches settings in RAM for better performance and efficiency
    - Various bug fixes
    v1.0.5
    - Tweaked microcode to be more efficient, as a result, 6 colors can now be displayed at once for app notifications.
    - State machine paths improved
    - Separation of concerns in state machine, allowing for more possible backends for controlling the lights (such as stock ROM system services)
    - Phone ring animation! Complete with specific colors per contact!
    Disclaimer:
    This build contains dormant code for both the rootless mode and music visualizer, 'cause using feature branches would mean I have my life together. I'll activate them when they're stable enough to actually use.
    v1.0.6
    - Pocket mode! When the screen is switched off, the app will query various sensors for a few seconds afterwards and if it is determined the device is placed in a pocket or bag, the lights will be disabled, which can save battery.
    - Some explanations added for the 2 toggles in the passive effect screen
    - Service worker wakelock renamed to more accurately describe its source
    - Code cleanup
    v1.0.7
    - First stable release
    - New icon
    - Automation integration (Tasker) first phase
    - In order for automation to work, the "Allow Automation" switch must be turned on from the main drawer
    - New "Roll" passive effect
    - Code cleanup and optimization
    v1.0.8
    - Charging animation
    - Various improvements to state machine
    - Now asks for exemption from battery optimization
    - Sped up fadeout effect
    v1.0.9
    - Dependency updates (newer libsuperuser)
    - Added custom effects!
    NOTE: Custom effect programs must be compiled with Texas Instruments' Lysti compiler which can be found on the support page of the LP5523 controller.
    See my Chroma research thread on XDA for details:
    https://forum.xda-developers.com/razer-phone-2/development/research-oss-chroma-service-t3890290
    v1.0.10
    - Limit of 6 apps on LEDs at once has been reduced to 4 in order to generate higher quality microcode, as there was an issue with timing before which could make it unclear what color the logo is flashing
    - Now uses E164 format phone numbers internally for comparison. This should make number identification for ring animation more reliable.
    - Notification preference for apps now previews the color on the logo while picking
    v1.0.11
    - Music Visualizer! Toggle the visualizer switch in the drawer and then play some music!
    Side note: I'm pretty sure this is bad for the LEDs. Use sparingly :p
    v1.0.12
    Now asks for recording permissions!
    Also BitDefender didn't mark it as malicious! I have literally no idea!
    v1.0.13
    Added ability to control visualizer state from automation plugin! (Tasker, Locale)
    You may wish to disable the toggle for automatic visualization state control in the main UI as this may interfere with your custom logic in your automation application of choice.
    4
    New version v1.0.8 released!
    Now includes a charging animation!
    4
    Update

    New version v1.0.1 available in Downloads section!
    4
    v1.0.7 is released!
    Tasker integration has been added, and, not to be outdone, a new passive effect similar to Razer's "Wave" effect (except you can't choose the direction for the moment being :p )

    Edit: forgot to mention, I've also attached a demo video to post #2