[MOD] viper4android + MIUI 12 + Magisk 21.1

Search This thread

RheinPirat

Senior Member
Can you tell me when I have to make these changes?

I tried diff. ways, but Viper show always that the driver isn't installed (12.5.4 EU ROM).

I make these changes -> Open viper, "install" the driver -> reboot -> driver is not installed and all changes on the file are gone...

What are the steps to install Viper on MIUI 12 (Android 11)?
 

leobahlis

Senior Member
Nov 14, 2018
58
5
Can you tell me when I have to make these changes?

I tried diff. ways, but Viper show always that the driver isn't installed (12.5.4 EU ROM).

I make these changes -> Open viper, "install" the driver -> reboot -> driver is not installed and all changes on the file are gone...

What are the steps to install Viper on MIUI 12 (Android 11)?
Have to be permissive to work... You can change only the viper to be permissive with some codes...
 

_mysiak_

Senior Member
Apr 1, 2009
2,413
1,393
Xiaomi Mi 10T Lite
Can you tell me when I have to make these changes?

I tried diff. ways, but Viper show always that the driver isn't installed (12.5.4 EU ROM).

I make these changes -> Open viper, "install" the driver -> reboot -> driver is not installed and all changes on the file are gone...

What are the steps to install Viper on MIUI 12 (Android 11)?
Which Viper version are you trying? With the latest one it worked on the first try for me (install Viper, install driver, reboot, modify module file as described in OP, reboot).

Have to be permissive to work... You can change only the viper to be permissive with some codes...
Not true, at least the latest Viper version works with enforcing SElinux - as long as sepolicy rules are applied properly.
 

_mysiak_

Senior Member
Apr 1, 2009
2,413
1,393
Xiaomi Mi 10T Lite
The latest from the magisk repo - v2.7.2.1

I always get the the info, that the driver is not installed. I also tried it with SELinux permissive - dind't change anything.
If it doesn't work with permissive, then instructions from OP won't help you. I would advise checking EU ROM forum, there might be explanation for behavior you're experiencing. With stock ROM it works, so I guess that there is something else needed for that custom ROM.
 

BarryViper

Senior Member
Jun 20, 2018
86
13
I'm running on stock rom with viper 2.7.2.1. Did exactly as mentioned in OP still no luck. But when I switch to permissive, viper works.
 

Attachments

  • Screenshot_2021-05-18-04-11-54-025_pl.solidexplorer2.jpg
    Screenshot_2021-05-18-04-11-54-025_pl.solidexplorer2.jpg
    134.5 KB · Views: 39

TheFixItMan

Senior Member
  • Jul 8, 2012
    7,774
    3,979
    London
    I'm running on stock rom with viper 2.7.2.1. Did exactly as mentioned in OP still no luck. But when I switch to permissive, viper works.
    Are you using an app that can replace/save a root file?

    Either
    Copy the file to user directory eg downloads
    Edit it with a text editor and save
    Using a file browser with read/write permissions to root copy the file back replacing existing file and set permissions for the file to 6-4-4 or r-w-w

    Or
    Boot into twrp recovery and edit the file there
     

    _mysiak_

    Senior Member
    Apr 1, 2009
    2,413
    1,393
    Xiaomi Mi 10T Lite
    I'm running on stock rom with viper 2.7.2.1. Did exactly as mentioned in OP still no luck. But when I switch to permissive, viper works.
    Maybe Magisk changed SElinux policy behavior again (I noticed something in the changelog, but did not dig into it), but since I switched to JamesDSP I don't have Viper installed anymore. I would recommend to give JamesDSP a try. Most of the features are similar to Viper + Viper distorts sound (even with all effects turned off), which doesn't happen with James.
     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    Are you using an app that can replace/save a root file?

    Either
    Copy the file to user directory eg downloads
    Edit it with a text editor and save
    Using a file browser with read/write permissions to root copy the file back replacing existing file and set permissions for the file to 6-4-4 or r-w-w

    Or
    Boot into twrp recovery and edit the file there
    Tried everything, twrp, edit the module file and giving it all sorts of permissions etc, no love.
    Thanks anyway for your thoughts of helping. Appreciate that.
     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    Maybe Magisk changed SElinux policy behavior again (I noticed something in the changelog, but did not dig into it), but since I switched to JamesDSP I don't have Viper installed anymore. I would recommend to give JamesDSP a try. Most of the features are similar to Viper + Viper distorts sound (even with all effects turned off), which doesn't happen with James.
    Is it a standalone Selinux enforcing apk installer not needing root? Have not heard of it but will check it out since viper is dead with Selinux enforcing. Thanks for the recommendation.
     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    @ mysiak

    I installed Jamesdsp via magisk module, launched it, give it permissions it asks for, then it closes and became unresponsive even when I launch it again. Definitely not my day.

     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    Oh, that's rather strange indeed. It works "out of the box" for me. What Magisk version and other modules do you have at the moment?
    I'm on magisk 23. Got it working after installing audio modification library. Played with the settings in Jamesdsp, pretty decent audio performance but still something is lacking compared to viper. IMO viper produces a more complete audio output as a package, a badass punch which I couldn't get out of Jamesdsp. Well, hopefully a selinux enforcing fix on viper will surface sometime soon. Thanks my friend, for everything you rendered here.
     

    _mysiak_

    Senior Member
    Apr 1, 2009
    2,413
    1,393
    Xiaomi Mi 10T Lite
    I'm on magisk 23. Got it working after installing audio modification library. Played with the settings in Jamesdsp, pretty decent audio performance but still something is lacking compared to viper. IMO viper produces a more complete audio output as a package, a badass punch which I couldn't get out of Jamesdsp. Well, hopefully a selinux enforcing fix on viper will surface sometime soon. Thanks my friend, for everything you rendered here.
    If you need audio modification library, it means that you most probably have another audio mod active. I would try turning all other modules off and enable just Viper or James.

    I am not trying to sell you James DSP, but in my experience it provides higher quality audio processing and I was able to replicate all features from Viper (but I admit that I did not use a lot of them). What exactly do you find missing in James? My first impression was similar to yours, but at the end I prefer it over Viper now. The only thing I miss is home screen widget for quick preset changing.
     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    If you need audio modification library, it means that you most probably have another audio mod active. I would try turning all other modules off and enable just Viper or James.

    I am not trying to sell you James DSP, but in my experience it provides higher quality audio processing and I was able to replicate all features from Viper (but I admit that I did not use a lot of them). What exactly do you find missing in James? My first impression was similar to yours, but at the end I prefer it over Viper now. The only thing I miss is home screen widget for quick preset changing.
    Without AML, James just wouldn't launch, at least on my end. Gave it another go after uninstalling Viper and still I'm leaning towards Viper with it's much superior compact audio output.

    Currently I'm on stock Redmi note 9 miui 12.0.7 global and I'm toying with the idea of flashing a Kraken A11 custom rom that I know of which is selinux enforcing then root and install Viper and see if there's any joy ;)

    What's your take on that?
     

    _mysiak_

    Senior Member
    Apr 1, 2009
    2,413
    1,393
    Xiaomi Mi 10T Lite
    Without AML, James just wouldn't launch, at least on my end. Gave it another go after uninstalling Viper and still I'm leaning towards Viper with it's much superior compact audio output.

    Currently I'm on stock Redmi note 9 miui 12.0.7 global and I'm toying with the idea of flashing a Kraken A11 custom rom that I know of which is selinux enforcing then root and install Viper and see if there's any joy ;)

    What's your take on that?
    I am not a fan of custom ROMs, so can't really advise.

    I tried steps from my first post and Viper still works with Magisk v23. Not sure why is it different for you. All I did is:
    1. installed Viper from Magisk repo
    2. opened Viper app, installed driver, it rebooted automatically
    3. once the phone started, checked the Viper driver status (abnormal)
    4. applied all Magiskpolicy commands from terminal emulator as root
    5. opened Viper app, toggled legacy/compatibility mode on and off, checked the driver status = normal
     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    I am not a fan of custom ROMs, so can't really advise.

    I tried steps from my first post and Viper still works with Magisk v23. Not sure why is it different for you. All I did is:
    1. installed Viper from Magisk repo
    2. opened Viper app, installed driver, it rebooted automatically
    3. once the phone started, checked the Viper driver status (abnormal)
    4. applied all Magiskpolicy commands from terminal emulator as root
    5. opened Viper app, toggled legacy/compatibility mode on and off, checked the driver status = normal
    Via terminal emulator? Not just edit the post-fs-data.sh file? Btw is this the correct way to apply the policy, pic attached

    1621651868344.png
     

    BarryViper

    Senior Member
    Jun 20, 2018
    86
    13
    I use terminal emulator for quick test - I would advise you to try it first as well. And yes, the picture shows how I was using it long term.
    The death of me (fuming mad). Whatever ways I tried, including copying the .sh file to my computer, edit with notepad, paste it back in device root folder and giving it 644 permission still, couldn't get Viper stick on enforcing. Could it be device specific, I wonder? Redmi note 9 12.0.7.0

    Btw, I am willing to share the settings on Viper I configured including the .irs file if anyone is interested. I'm still mad.
     

    _mysiak_

    Senior Member
    Apr 1, 2009
    2,413
    1,393
    Xiaomi Mi 10T Lite
    The death of me (fuming mad). Whatever ways I tried, including copying the .sh file to my computer, edit with notepad, paste it back in device root folder and giving it 644 permission still, couldn't get Viper stick on enforcing. Could it be device specific, I wonder? Redmi note 9 12.0.7.0

    Btw, I am willing to share the settings on Viper I configured including the .irs file if anyone is interested. I'm still mad.
    What happens when you repeat these steps?

    1. install Viper from Magisk repo
    2. open Viper app, install driver
    3. once the phone starts, check the Viper driver status (should be abnormal)
    4. apply all Magiskpolicy commands from terminal emulator as root (open any terminal app, type in "su" and copy&paste all magiskpolicy commands) - some will give an error but that's expected
    5. open Viper app again, toggle legacy/compatibility mode on and off, check the driver status, it should be normal

    Do NOT keep compatibility mode enabled, it doesn't seem to be working with it. You can keep legacy mode ON (for system wide audio modification) or legacy OFF (audio will be processed only from compatible apps).
     

    Top Liked Posts

    • There are no posts matching your filters.
    • 24
      Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

      1. Locate and edit file
      Code:
      /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
      2. Add this text to the end of the file
      Code:
      magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
      magiskpolicy --live 'allow audioserver system_file file { execmod }'
      magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
      magiskpolicy --live 'allow mediaserver system_file file { execmod }'
      magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
      magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
      magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
      magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
      magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
      magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
      3. save, reboot phone
      4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled

      Edit:
      One user needed few extra lines to make it working on his Redmi Note 9:
      Code:
      magiskpolicy --live 'allow mtk_hal_audio sysfs_dt_firmware_android file { read }'
      magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio process { execmem }'
      magiskpolicy --live 'allow vendor_default_prop vendor_default_prop file { read }'
      magiskpolicy --live 'allow mtk_hal_audio metadata_file dir { search }'
      magiskpolicy --live 'allow mtk_hal_audio debugfs_ion dir { search }'
      1
      Thank you, this fix is working for me on MIUI 12.0.6 xiaomi.eu running on viper4android 2.7.2.1
      Although I had to edit it externally on my PC since my rootexplorer keep crashing while editing on the phone.
      Btw I'm using Mi 9T Pro.
      1
      This fixed it, i think the problem is because of A11 because a lot of people have this problem with it.
      Hopefully those people can find this post too.
      Thanks
      Glad to be of help. The fix is most probably needed due to Magisk 21.1 changes in SELinux policy handling though. I had the very same issue/fix in Android 10 as well.