[Help] Creating Module for vendor partition changes - Magisk

Hello Fellow Users,
Let me start with the fact that I have zero experience of making flash modules (TWRP/Magisk) and am just dabbling around.
Some background, I found a TWRP flash zip file which makes changes to vendor partition of Redmi Note 7 Pro (violet) running MIUI OS (Android Q) - this is a sound mod.
Now, with TWRP file the issue is that if it doesn't work or has any issues, we need to dirty flash ROM all times (or atleast dirty flash the vendor partition). There is no one-click remove option.
Hence I thought why can't the same be done via Magisk systemless and dabbled around a bit. Below is my experience of the last 2 days.
Now, coming to the original TWRP file - it copies/replaces three folders with included files to vendor partition. Path of folders is following
Code:
/vendor/etc
/vendor/lib/soundfx
/vendor/lib64/soundfx
These 3 folders and similarly named files within them already exist by default in the phone prior to flashing.
Now basis the Magisk guides I saw around and wiki from @Zackptg5 I did the following changes to the default template:
1) Edited customize.sh to define folders to be replaced
Code:
REPLACE="
/vendor/etc
/vendor/lib/soundfx
/vendor/lib64/soundfx"
2) Since Magisk will always look for the vendor under the system folder and so I moved the vendor folder under system folder
Basis same, created attached module and flashed and it installed.
But then three queries in my mind:
1) Are the new files actually replaced systemless and in-use? My concerns as don't see any intended change in sound
2) Is there a way to check if new files are being used o available to system?
3) Is this method of putting replace under customize.sh file the way out? While studying some similar modules making changes to vendor partition, I found that they have default (no change) customize.sh but rather make changes to common/post-fs-data.sh etc
So, looking forward to feedback from users experienced in making Magisk module. Thanks in advance for your time and efforts!
PS: attached is the WIP module which I wrote and also got installed in Magisk Manager
TLDR: How to make a Magisk Module using TWRP files to ensure systemless modification of folder/files in the vendor partition

1 - The REPLACE variable is used to replace the directories you specify with empty folders, not with what you want to add systemlessly. You might want to follow the advice written in the customize.sh file and read the documentation (@topjohnwu has everything explained there):
https://topjohnwu.github.io/Magisk/guides.html
Edit: If you do want to first "remove" (systemlessly, of course) everything in those folders, then keep them in the REPLACE variable. I just realised that it's a little unclear if that's what you want to do or not...
2 - That's the correct procedure. If all you want to do is to add or replace some files to your device, the only thing you need is to put those files in the /system directory of your module. That's it. The customize.sh file is used if you want to customise the installation logic of your module (not necessary if you're just adding files to your device) and post-fs-data.sh and service.sh are boot scripts to run code at boot (again not necessary if you're just adding files systemlessly to your device, see the linked docs for details).
Right now your module isn't adding anything, since the directories in the module's system folder are all empty. There's nothing to add. All it does is to replace those directories with empty ones (see #1 above). I'd say that using MMT is way overkill for such a simple module...
One you've installed a module Magisk will mount that modules files over your existing ones at boot. If the file under the real system path matches the one found in the module directory (under /data/adb/modules) everything is working as it should.

@Didgeridoohan Thanks for taking our time to give detailed reply and guidance
Finally was able to successfully install the module (named AudioEngine) and I do see files under /data/adb/modules but I have the following issue:
All these new files are under:
/data/adb/modules/AudioEngine/system/vendor folder and not under
/data/adb/modules/AudioEngine/vendor folder
Is that ok? If yes, why do we see /data/adb/modules/AudioEngine/vendor separately too?
Attached is final module as well as the screenshot of /data/adb/modules/AudioEngine/ as seen in file manager.

The /vendor folder is a symlink to /system/vendor, created by Magisk. That's just how Magisk works...
From your screenshot it looks like things are working as they should.
That uninstall script looks unnecessary though. The module isn't placing or altering anything outside the module folder, so when uninstalled there won't be any leftovers anyway.

im also try to do something similar with some audio libs in vendor partition for poco f2 with miui12 however if i add any libs to go into vendor/lib, for some strange reason, i lose wifi. theres no issues if vendor/lib/soundfx or vendor/lib64 is occupied with files just the lib directory only. the actual files that are going into lib are not replacing anything but are new files

Related

Creating a module to replace an executable in /system/sbin?

There is an executable I am trying to replace in /system/sbin natively which appears in /sbin after booting, but doing so in a module doesn't appear to work since the sbin folder gets wiped in the modules directory after rebooting.
The executable appears to be extracted fine which I can see in /data/adb/modules_update/{mod}/system/sbin before rebooting, but after rebooting, the /data/adb/modules/{mod}/system folder is just empty.
I am looking at the module guide which also talks about overlay.d, but creating a overlay.d folder in the module folder doesn't appear to do anything (although the file does not get wiped unlike putting it in system).
Is this a bug or is there a different way of doing this? I am currently on Magisk 20.1.
Thanks!
I just realized that the overlay.d folder is inside the ramdisk of the boot image, rather than the module folder... I guess I will play around with it further and see how it goes...
It could also be a good idea to upload your module, module install log and the Magisk log from the reboot after installing.

Magisk Module development help

This is my first attempt at a Magisk Module (to fix a issue with a few poorly coded legacy apps and not trip safety net) inject or replace a font and set proper permission on the file
My super simple experiment is here (based on the template from Git)
https://drive.google.com/file/d/1PHdRjzefpSMg51KUOffo4FtqlfoxshOM
Magisk gives me a error when I try to install
I probably did something wrong, hopefully someone can point me in the correct direction (error one, not a valid Magisk Module, error two Magisk is not activated)
I appreciate any insight - please move this post to the correct location if needed
If you want someone to look at the module you'll have to enable sharing for the file first...
But, your errors are usually:
1 - the zip has been packaged wrongly (not the proper file/directory structure
2 - using an old template
Take a look in the official docs on how to work with the current module and module installation setup:
https://topjohnwu.github.io/Magisk/guides.html
Let's try this link:
https://drive.google.com/file/d/1PHdRjzefpSMg51KUOffo4FtqlfoxshOM/view?usp=sharing
I started on Git, but I may have inadvertently been in the wrong place / pulled the wrong file -- I will go back through that link you provided tomorrow and see if something jumps out at me
Yeah, you have a whole host of mixed issues there...
First, all the module files have to be in the root of the module zip, not in the magisk-module-DroidSansFallback you have them in now (this is the "not a Magisk module").
Second, your update-binary is a webpage... That ain't gonna work very well. When you download the module_installer.sh script, save it from the raw view (there's a button above the code when you open the file on GitHub).
Last (but this is only cosmetical really, since it won't affect anything) you found some really old module to base your work on, because the config.sh file hasn't been used for ages, and the readme file is ancient.
Fix the above and follow the instructions in the docs and you should be good to go.
Is there a current template on Git for the blank files?
I am here:
https://topjohnwu.github.io/Magisk/guides.html
Made the updates, going to try it now - but I would like to get a proper template setup
There is no longer an official template provided.
The current module installation setup is so simple that it really doesn't need it. Put whatever files you want to mount in /system, whatever boot script or prop files (as described in the docs) you want to run in the root of the zip, create the module.prop (again, described in the docs) so that you'll have some info about the module in the Manager, zip it up and flash it.
If you want to customise things more you do that with the customize.sh script (described in the docs).
If you really need a template there's always @Zackptg5's MMT-Ext...
So I downloaded a current module and looked through the files / structure and then the docs -- and now I have this
https://drive.google.com/file/d/1z4tlH6wGDpq0UnkxPF0f6i-DohcKnux-/view?usp=sharing
When I go to /system/fonts I now see DroidSansFallback.ttf (it was not present before installing the module)
and no error messages!!
I think I need to read a little more, on Android 5-8 adding this font into /system/fonts (manually) fixed my problem - now I am on Android 9 (OnePlus 6t TMO variant) and I do not see any changes from adding the file (fonts.xml issue?)
I really wanted to try this as a learning experience, and because the old method trips CTSProfile to false
I appreciate your patience - at least now I have a better starting point
All you need for the font file to be mounted is the /system/fonts/DroidSansFallback.ttf file in the module society directory. The REPLACE variable you've set in customize.sh is only for replacing directories with empty ones, not files (so you can remove it since it might be causing a conflict). Details in the docs:
https://topjohnwu.github.io/Magisk/guides.html#remove-folders
updated (linked file updated as well) no change.. .. ..
I did double check that the module places the file in the correct location, and when the module is disabled the file is removed
I found this on a random Google search (ASE) from a unrelated topic (Chinese character support)
On Android 9 it's Noto CJK, e. g. "Noto Sans CJK JP" font family (located in /system/fonts/NotoSansCJK-Regular.ttc). There is no DroidSansFallback.ttf anymore.
Could that explain why adding the file did not work?
Very possible. As you say, the module looks fine and works as intended (places the file where you want it), so the issue likely lies elsewhere.
I will take a stab at injecting a modified fonts.xml and see if that changes anything - thanks!
I experimented with adding a line into the fallback section of the fonts.xml (to reference the new font), and replacing the fonts.xml with a older version from Android 8 --- neither had any effect that I could discern

Trying to create a magisk module to edit rootfs

I am attempting to create a magisk module that will "replace" a file in /system/etc. I have created the module and successfully installed it but the changes are not reflected upon booting multiple times. I can 'adb shell cat $MAGISK/system/etc/file.xml' and see the changes have not been made by magisk and I can adb shell cat system/etc/audio_policy_configuration.xml and see the files have not been altered in any way.
I just want to copy a fuggin file to system/etc. I have spent hours trying to research how to copy files to system with magisk modules but they are dead end roads.
I need someone to finally answer the question of how to copy a file using magisks built in module function. I can create and install the module but I am not understanding the process of actually copying the file. I thought anything you put in the system folder in the module template, that it would get used instead of the one in the actual read only system/etc. But I made the directories and file with changes I want, installed it but it doesn't show up in magisk manager and the changes arent made by the module.
Any and all help is appreciated
I've already replied here:
https://forum.xda-developers.com/t/...agisk-module-developers.3846678/post-84749791
But, in your post in that thread (please don't double post) you didn't mention anything about already having created a module.
If you have the module installed already but don't see any changes, provide the Magisk log. But, make sure you're on the latest Magisk Canary release first so that the log is more detailed.
Providing your module could also be a good idea, to see if it's built correctly.

General [Bounty] Viper4android fix

So I'm not sure if I'm doing this the right way, but I think in an effort to get experienced devs to take a look into our viper4android driver loop issue a bounty is in order.
I have tried every method I could find to get viper4android to work on our OnePlus 10 pro with no success.
Below I'll start a list of pledgers who are willing to pay the bounty when/if a fix is found. I'll add to the list as other pledgers come forward. Any pledge amount helps.
•ecera -$50
•Aldonski - $10
On a side note, I'll be willing to test any fixes that are thrown my way. I'm also ready to provide any files or logs that are requested. Also, if you guys/gals want to tag some members that may be willing to take on this task please do so. Thanks.
@shadowstep @dorimanx @zgfg @vczilla @Juniiim
Hope you guys don't mind me tagging you. From posts I have read of yours, you guys know your stuff. Or maybe you can recommend someone who will be interested in the bounty.
So I'm guessing a little basic info would be helpful. The OnePlus 10 pro is running oos12, the normal post-fs-data.sh fix where vendor/etc and odm/etc "audio_effects.xml" is binded doesn't work(as expected since the file doesn't exist under vendor/etc on this device.) I'll attach a photo where audio_effects.xml can be found on this device. Another thing to note is that the viper4android.zip by @shadowstep actually adds audio_effects.xml &.conf to vendor/etc. But trying to bind this newly created audio_effects.xml to the one in odm/etc doesn't make any changes to the one in odm. I'm also unable to launch the viper4android app using his version, but installing the apk again allows me to open the app. I'm just not sure if that affects anything as far as the functionality of his module. I could though bind the audio_effects.xml located in vendor/etc/audio/sku_cape to the odm/etc one, but driver loop persists. I'm out of ideas I've literally tried every module(aml, jdsp, ainur, acp, v4a from the magisk repo, other versions of v4a zips in different orders/ combinations. Nothing has worked so far.
Aldo - $10
great ideea mate
try this:
remove all sound mods you have added, including the module from magisk and the viper app!
reboot!
Install attached Audio-Modification-Library_v4_0-OS12-op10
reboot!
install com.pittvandewitt.viperfx_2.7.2.1-2721.apk
open the viper app, and click install drivers.
phone auto reboot.
copy attached post-fs-data.sh to /data/adb/modules/ViPER4AndroidFX/ (use adb or rooted file manager)
REBOOT, do not open the app!!!!
now if we hit the FIX, if you will open the app it's should not ask to install drivers.
if it's stop asking, check the state, if it's not NORMAL then tick the Legacy Mode, and check state.
should be Status Normal.
I hope this will work for you.
ecera said:
So I'm guessing a little basic info would be helpful. The OnePlus 10 pro is running oos12, the normal post-fs-data.sh fix where vendor/etc and odm/etc "audio_effects.xml" is binded doesn't work(as expected since the file doesn't exist under vendor/etc on this device.) I'll attach a photo where audio_effects.xml can be found on this device. Another thing to note is that the viper4android.zip by @shadowstep actually adds audio_effects.xml &.conf to vendor/etc. But trying to bind this newly created audio_effects.xml to the one in odm/etc doesn't make any changes to the one in odm. I'm also unable to launch the viper4android app using his version, but installing the apk again allows me to open the app. I'm just not sure if that affects anything as far as the functionality of his module. I could though bind the audio_effects.xml located in vendor/etc/audio/sku_cape to the odm/etc one, but driver loop persists. I'm out of ideas I've literally tried every module(aml, jdsp, ainur, acp, v4a from the magisk repo, other versions of v4a zips in different orders/ combinations. Nothing has worked so far.
Click to expand...
Click to collapse
I could give you suggestions/hints based on how I made it to work on my phone - but it was Xiaomi with stock A11, not your OnePlus 10 with oos12:
https://forum.xda-developers.com/t/...ndroid-10-11-12-devices.4213647/post-86870983
Anyway, before we start, please disable ALL audio moudules (any V4A, AML, etc you may have) and REBOOT
And then please respond/confirm the following:
1) Check, does your system show the same content (one should be mounted to another) for /system/vendor/etc and vendor/etc ?
You can use a root explorer like MiXPlorer or you cah check with ls command in terminal window, and when you boot with the Magisk root.
I.e, do not check from a custom recovery (mounting points must be properly in place when system/Android + Magisk are booted)
2) Check, does your system show the same content (one should be mounted to another) for /system/odm/etc and /odm/etc ?
3) Do you have audio_effects.xml in the following folders (with /vendor = /system/vendor and /odm = /system/odm as mentioned above):
/odm/etc
/vendor/etc/
/vendor/etc/audio/sku_cape
/vendor/etc/audio/sku_diwali
/vendor/etc/audio/sku_taro
4) Do you also have audio_effects.conf in the same folders as listed in 3) - if not, list in which of the folders you do have the conf file
For 1) and 2), we need to be sure if standard montings (as needed for V4A to mount files and work on your system).
For 3) and 4), we need to be sure if you originally (without the intervention from any audio module like the previous installation of V4A or AML, etc)
do have the audio_effects.xml and audio_effects.conf files in all those folders, or in which of them exactly
dorimanx said:
try this:
remove all sound mods you have added, including the module from magisk and the viper app!
reboot!
Install attached Audio-Modification-Library_v4_0-OS12-op10
reboot!
install com.pittvandewitt.viperfx_2.7.2.1-2721.apk
open the viper app, and click install drivers.
phone auto reboot.
copy attached post-fs-data.sh to /data/adb/modules/ViPER4AndroidFX/ (use adb or rooted file manager)
REBOOT, do not open the app!!!!
now if we hit the FIX, if you will open the app it's should not ask to install drivers.
if it's stop asking, check the state, if it's not NORMAL then tick the Legacy Mode, and check state.
should be Status Normal.
I hope this will work for you.
Click to expand...
Click to collapse
Thank you for responding! I'm going to test out your methods first, I will report back.
Edit: so I tried the method you suggested and unfortunately driver loop persists. So what I noticed is that audio_effects.xml in all directories on this phone remain untouched. They remain "stock". Also, under /data/adb/modules/aml or /Viper4Androidfx in the system folder in both directories subfolders were created, but remain empty. Not sure if there's any info you would like to take from the phone that I could get for you? I took a few screenshots, not sure if that'll help. I started clean with no mods and I took these after attempting the fix.
zgfg said:
I could give you suggestions/hints based on how I made it to work on my phone - but it was Xiaomi with stock A11, not your OnePlus 10 with oos12:
https://forum.xda-developers.com/t/...ndroid-10-11-12-devices.4213647/post-86870983
Anyway, before we start, please disable ALL audio moudules (any V4A, AML, etc you may have) and REBOOT
And then please respond/confirm the following:
1) Check, does your system show the same content (one should be mounted to another) for /system/vendor/etc and vendor/etc ?
You can use a root explorer like MiXPlorer or you cah check with ls command in terminal window, and when you boot with the Magisk root.
I.e, do not check from a custom recovery (mounting points must be properly in place when system/Android + Magisk are booted)
2) Check, does your system show the same content (one should be mounted to another) for /system/odm/etc and /odm/etc ?
3) Do you have audio_effects.xml in the following folders (with /vendor = /system/vendor and /odm = /system/odm as mentioned above):
/odm/etc
/vendor/etc/
/vendor/etc/audio/sku_cape
/vendor/etc/audio/sku_diwali
/vendor/etc/audio/sku_taro
4) Do you also have audio_effects.conf in the same folders as listed in 3) - if not, list in which of the folders you do have the conf file
For 1) and 2), we need to be sure if standard montings (as needed for V4A to mount files and work on your system).
For 3) and 4), we need to be sure if you originally (without the intervention from any audio module like the previous installation of V4A or AML, etc)
do have the audio_effects.xml and audio_effects.conf files in all those folders, or in which of them exactly
Click to expand...
Click to collapse
1) Ok, so /system/vendor/etc and /vendor/etc does show the same content. I'd note that audio_effects.xml and .conf are both missing in this directory from an untouched unmodified standpoint though.
2) system/odm/etc is non-existent on this phone. Odm/etc is there though. There is /vendor/odm/etc and shows the same content as odm/etc.
3) audio_effects.xml exists in the following locations.
- /odm/etc
- /vendor/etc/audio/sku_cape
- /vendor/etc/audio/sku_diwali
- /vendor/etc/audio/sku_taro
It is absent in
- /vendor/etc
4) audio_effects.conf exists under
- /vendor/etc/audio/sku_cape
- /vendor/etc/audio/sku_diwali
- /vendor/etc/audio/sku_taro
- /system/etc or /etc
It is absent from
- /odm/etc
- /vendor/etc
Again thanks so much for giving this a shot.
ecera said:
1) Ok, so /system/vendor/etc and /vendor/etc does show the same content. I'd note that audio_effects.xml and .conf are both missing in this directory from an untouched unmodified standpoint though.
2) system/odm/etc is non-existent on this phone. Odm/etc is there though. There is /vendor/odm/etc and shows the same content as odm/etc.
3) audio_effects.xml exists in the following locations.
- /odm/etc
- /vendor/etc/audio/sku_cape
- /vendor/etc/audio/sku_diwali
- /vendor/etc/audio/sku_taro
It is absent in
- /vendor/etc
4) audio_effects.conf exists under
- /vendor/etc/audio/sku_cape
- /vendor/etc/audio/sku_diwali
- /vendor/etc/audio/sku_taro
- /system/etc or /etc
It is absent from
- /odm/etc
- /vendor/etc
Again thanks so much for giving this a shot.
Click to expand...
Click to collapse
Ok, thanks
Then shortly based on 1) and 2):
/odm/etc
/vendor/odm/etc
/system/vendor/odm/etc
are all pointing to the same?
ecera said:
1) Ok, so /system/vendor/etc and /vendor/etc does show the same content. I'd note that audio_effects.xml and .conf are both missing in this directory from an untouched unmodified standpoint though.
2) system/odm/etc is non-existent on this phone. Odm/etc is there though. There is /vendor/odm/etc and shows the same content as odm/etc.
3) audio_effects.xml exists in the following locations.
- /odm/etc
- /vendor/etc/audio/sku_cape
- /vendor/etc/audio/sku_diwali
- /vendor/etc/audio/sku_taro
It is absent in
- /vendor/etc
4) audio_effects.conf exists under
- /vendor/etc/audio/sku_cape
- /vendor/etc/audio/sku_diwali
- /vendor/etc/audio/sku_taro
- /system/etc or /etc
It is absent from
- /odm/etc
- /vendor/etc
Again thanks so much for giving this a shot.
Click to expand...
Click to collapse
Following up, please have again all audio modules uninstlled, reboot and then follow:
- Install the official V4A FX module
- Reboot
- Run V4A app, it will complain that there is no driver installed and it will attempt to install
REBOOT but THEN DO NOT RUN V4A app yet!
1) Instead:
- go to /data/adb/modules/ViPER4AndroidFX/system/vendor
- there must be a subfolder etc with audio_effects.xml and audio_effects.conf
- check are those xml and conf files 'patched' by V4A as on my attached screenshots (they should be)?
2) Create the following system of folders:
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc (that one must have been existed)
/data/adb/modules/ViPER4AndroidFX/system/vendor/odm/etc
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_cape
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_diwali
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_taro
Copy that patched audio_effects.xml from:
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc
to the newly created folders:
/data/adb/modules/ViPER4AndroidFX/system/vendor/odm/etc
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_cape
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_diwali
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_taro
Copy also that patched audio_effects.conf from:
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc
for the beginning only to:
/data/adb/modules/ViPER4AndroidFX/system/vendor/odm/etc
Copy also the attached post-fs-data.sh to /data/adb/modules/ViPER4AndroidFX
3) Then reboot, again DO NOT RUN V4A app but first check:
- do you still have the created folders and files from (1) and (2) in /data/adb/modules/ViPER4AndroidFX/system/vendor/...
Also, now in the 'real' folders, starting from root / (no more in /data/adb/modules...):
/vendor/etc
/vendor/odm/etc
/vendor/etc/audio/sku_cape
/vendor/etc/audio/sku_diwali
/vendor/etc/audio/sku_taro
- check if every of them now contains your patched audio_effects.xml from (1).
- and check if the first two contain the patched audio_effects.conf also from (1).
(they are actually not copied there but Magisk must have mounted them from /data/adb/modules/ViPER4AndroidFX/system/vendor/...)
Pls check and confirm.
Then open V4a app and if it does no more complain, switch to Legacy mode and enjoy
4) If V4a app does not pass yet but still complains that driver is missing, it will delete everything that you did in (2).
Hence reboot, redo step (2) again but this time copy both the patched audio_effects.xml and audio_effects.conf from:
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc
to all those folders:
/data/adb/modules/ViPER4AndroidFX/system/vendor/odm/etc
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_cape
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio/sku_diwali
Reboot, again do not run yet V4A app but check if all the 'real' folders (starting from root /) contain the patched audio_effects.xml and audio_effects.conf:
/vendor/etc
/vendor/odm/etc
/vendor/etc/audio/sku_cape
/vendor/etc/audio/sku_diwali
/vendor/etc/audio/sku_taro
Pls check/confirm.
Now try again V4A app (with Legacy mode)...
Not sure would V4A app now really work but that was based on what you previously confirmed about your folders, trying to adapt how V4A mounts the patched xml and conf files to your case
zgfg said:
Ok, thanks
Then shortly based on 1) and 2):
/odm/etc
/vendor/odm/etc
/system/vendor/odm/etc
are all pointing to the same?
Click to expand...
Click to collapse
Yes, sorry had to drop the kiddo off at school. But, yeah they all point to the same.
ecera said:
Yes, sorry had to drop the kiddo off at school. But, yeah they all point to the same.
Click to expand...
Click to collapse
Ok, try the follow up, my subsequent post above. Let's see the results
@zgfg I installed the official viper magisk module, rebooted, opened the app, allowed the driver to install, rebooted, didn't open the viper app, went to /data/adb/modules/Viper4AndroidFX/system/vendor, it's empty. Besides a lib folder.
@zgfg something interesting though, I copied audio_effects.xml and .conf from /vendor/etc/audio/sku_cape and created a folder named "etc" in /data/adb/modules/Viper4AndroidFX/system/vendor and copied them there. Now, in /vendor/etc both audio_effects.xml & .conf exist. They aren't "patched" though.
ecera said:
@zgfg something interesting though, I copied audio_effects.xml and .conf from /vendor/etc/audio/sku_cape and created a folder named "etc" in /data/adb/modules/Viper4AndroidFX/system/vendor and copied them there. Now, in /vendor/etc both audio_effects.xml & .conf exist. They aren't "patched" though.
Click to expand...
Click to collapse
Yes, of course, that's the way how mounting works (and how all modules, including V4A utilize that)
Everything that Magisk finds in
/data/adb/modules/<some module folder>/system/<subfolders>/<file>
will be mounted to
system/<subfolders>/<file>
Eg, if you use Systemless hosts and AdAway in the root mode, then AdAway writes to:
/data/adb/modules/hosts/system/etc/hosts
and Magisk mounts that (upon reboot) to:
/system/etc/hosts
---
You could try to run V4A app now with your 'fake' XML and conf files in /vendor/etc (although I'm not sure how would VA app react when it already finds the XML and conf file in /data/adb/modules/Viper4AndroidFX/system/vendor/etc - the same place where it must write its own patched files with the same names)
to check would it then find the (mounted) XML and conf file from /vendor/etc
and would it create the corresponding patched files in its /data/adb/... folder
If it does, then you could continue with my previous post
@zgfg so following your instructions everything is working as far as binding all the locations. The only one that is not sticking is /data/adb/modules/ViPER4AndroidFX/system/vendor/odm/etc. I'm able to copy the patched audio_effects.xml and .conf in there, but they aren't reflecting in the "real" folder (/system/vendor/odm/etc/ or odm/etc.
ecera said:
@zgfg so following your instructions everything is working as far as binding all the locations. The only one that is not sticking is /data/adb/modules/ViPER4AndroidFX/system/vendor/odm/etc. I'm able to copy the patched audio_effects.xml and .conf in there, but they aren't reflecting in the "real" folder (/system/vendor/odm/etc/ or odm/etc.
Click to expand...
Click to collapse
Ok, then copy the attached post-fs-data.sh to /data/adb/modules/ViPER4AndroidFX
(Instead of the previously given sh file)
In the sh script you will see two mount -o bind commands, one for XML and the other for conf, like:
mount -o bind /data/adb/modules/ViPER4AndroidFX/system/vendor/etc/audio_effects.xml /system/vendor/odm/etc/audio_effects.xml
Their purpose is to manually mount from:
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc
to:
/system/vendor/odm/etc/
And REBOOT
Hence again, in the first path (folder) the patched XML and conf files must be present
If it doesn't work you can try shortening the second folder path (both for XML and conf) to:
/vendor/odm/etc
or even to:
/odm/etc
zgfg said:
Ok, then copy the attached post-fs-data.sh to /data/adb/modules/ViPER4AndroidFX
(Instead of the previously given sh file)
In the sh script you will see two mount -o bind commands, one for XML and the other for conf, like:
mount -o bind /data/adb/modules/ViPER4AndroidFX/system/vendor//audio_effects.xml /system/vendor/odm/etc/audio_effects.xml
Their purpose is to manually mount from:
/data/adb/modules/ViPER4AndroidFX/system/vendor/etc
to:
/system/vendor/odm/etc/
And REBOOT
Hence again, in the first path (folder) the patched XML and conf files must be present
If it doesn't work you can try shortening the second folder path (both for XML and conf) to:
/vendor/odm/etc
or even to:
/odm/etc
Click to expand...
Click to collapse
That works as far as binding the existing audio_effects.xml that is located in /odm/etc. The .conf file doesn't appear in /odm/etc/. It does appear in /system/etc/ which I was able to mount a patched version by creating a corresponding folder in /data/adb/modules/Viper4AndroidFX/system/etc.
So I think it's safe to say that every audio_effects.xml & .conf are patched at this point.
Driver loop still persists though, I read one member point out that if he ran dumpsys media.audio_flinger, he noticed that the OnePlus 10 pro is using lib64 audio folders instead of the regular lib folders. It seems like viper tries to use the regular lib folder since the lib files that are patched are under lib and not lib64. Not sure how significant that is.
ecera said:
That works as far as binding the existing audio_effects.xml that is located in /odm/etc. The .conf file doesn't appear in /odm/etc/. It does appear in /system/etc/ which I was able to mount a patched version by creating a corresponding folder in /data/adb/modules/Viper4AndroidFX/system/etc.
So I think it's safe to say that every audio_effects.xml & .conf are patched at this point.
Driver loop still persists though...
Click to expand...
Click to collapse
I see now that in post #9 you already wrote that conf file was originally not present in /odm/etc, hence you don't need to bind it there (remove the corresponding mount -o bind command from sh file)
Now, upon the V4A still looped, did you check, do you still have all the folders and files in /data/adb/modules/ViPER4AndroidFX (you previously created) in place.
Ie, are the patched XML and conf files still in 'real' folders after you rebooted?
If so, you are lucky (you don't need to start all over again) - but then copy the whole structure:
/data/adb/modules/ViPER4AndroidFX
to eg (not a nice place to keep but it will be close to your hands and will not harm):
/data/adb/ViPER4AndroidFX
Then you can experiment further if you have an idea what to do with the libs
If, at any moment, V4A (by looping) deletes what you had in /data/adb/modules/ViPER4AndroidFX
you could then easily repair it from your copy, reboot and continue experimenting
---
If you zip and attach the complete content of that /data/adb/modules/ViPER4AndroidFX
I can give you then a flashable zip (module) file that you could easily install through Magisk app to start from that 'frozen' point all over again
ecera said:
Driver loop still persists though, I read one member point out that if he ran dumpsys media.audio_flinger, he noticed that the OnePlus 10 pro is using lib64 audio folders instead of the regular lib folders. It seems like viper tries to use the regular lib folder since the lib files that are patched are under lib and not lib64. Not sure how significant that is.
Click to expand...
Click to collapse
Regarding the lib vs lib64:
Check in the patched audio_effects.conf file
There should be a number of libraries listed as:
path /vendor/lib/soundfx/*.so
Are they really listed with /vendor/lib/
or with
vendor/lib64/
---
Disable the V4A module (through Magisk app or by placing an empty file named disable into /data/adb/modules/ViPER4AndroidFX - Magisk app by itself disables a particular module that way) and REBOOT and then check the original, not-patched conf file in those 'real' folders and check if it refers to lib or lib64
PS: Check those not-patched conf files in all four locations you said you had them in the post #9
Also, with the disabled V4A module, run su and then your dumpsys command directly from Terminal app and look does it list /vendor/lib/soundfx/ or /vendor/lib64/soundfx/ libraries

[REQUEST] Module to replace a file in vendor/etc

I have an LG V60 phone and I would like to put the phone in "high impedance mode" all the the time for more power to the earphones even if they are less than 50 ohm impedance.
In LG V40/50, it was very simple by rooting the phone and making some modifications in the one of the files that was in the "vendor/etc" directory. The problem with LG V60 is it does not allow any write access to the vendor folder at all.
So the only feasible option that I can think of is to create a Magisk module that replaces the original file with the modified one. My biggest disadvantage is not knowing anything about writing codes including Magisk module ones. So I was wondering if anyone could create a Magisk module that would replace the original file through Magisk?
ADDTIONAL INOFRMATION:
I am running Magisk 25 on a fully rooted LG V60.
The file that needs to be changed is mixer_paths.xml and it resides in the "vendor/etc" folder. I have created the modified file.
So if someone is able to develop a module to accomplish this, I will place the modified file in the "system/vendor/etc" folder of the Magisk module, as I understand it.
Many thanks for your support!
You can use this template system in future as its super easy
The template itself is here
GitHub - Zackptg5/MMT-Extended: Magisk Module Template Extended
Magisk Module Template Extended. Contribute to Zackptg5/MMT-Extended development by creating an account on GitHub.
github.com
click the Code button, then download zip
then extract the zip into a folder and rename the folder "MMT-Extended-master" to the something more meaningful, like the name of your module
Read the wiki and docs here to go step by step to create your first module:
Home
Magisk Module Template Extended. Contribute to Zackptg5/MMT-Extended development by creating an account on GitHub.
github.com
Notably the heading:
How do I make a MMT Extended mod?​
The steps for a simple file addition/replacement module, which are simple, should be steps 1-4, then 8. Then zip up the modules (as a zip) and test.
For you, if you read along (in Step 3) you will need to create a folder vendor, under the existing system one, and then a further etc folder under vendor, and put the necessary file (mixer_paths.xml in there.
If you try and fail, post back and someone will assist. But we prefer people to at least read the documentation and try first, ideally...this is the way the great didgeridoohan mentored myself and many others, he was not big on spoonfeeding
Imagine the satisfaction you might get finding out youre capable of such feats...i promise its not rocket surgery
Feel free to PM even, if you get stuck and think you have a silly question - of course knowing me, and i do, you'll probably get an even sillier, and off topic answer as well...
hint: you can knock out this basic module in far far less time than it took me to write all this
Thank you!
So my changes look like this:
1. Put the modified file in the system/vendor/etc folder of the Magisk module.
2. Made the needed changes to the customize.sh as attached.
Royaltiger said:
Thank you!
So my changes look like this:
1. Put the modified file in the system/vendor/etc folder of the Magisk module.
2. Made the needed changes to the customize.sh as attached.
Click to expand...
Click to collapse
Yes, though you'll need to uncomment (remove the leading #) from the set_perm lines to make them active, also you only really need the 2nd one
Royaltiger said:
Thank you
73sydney said:
Yes, though you'll need to uncomment (remove the leading #) from the set_perm lines to make them active, also you only really need the 2nd one
Click to expand...
Click to collapse
Click to expand...
Click to collapse
So I made the module with the suggested changes in customize.sh and put the modified mixer_path.xml file in the system/vendor/etc folder of the module. Module installs fine with Magisk but when it reboots, the device hangs on the initial LG screen and does not go anywhere from there.
I am attaching the customize.sh snapshot. Also, attached is the module file.
See here under "Disabling/uninstalling modules manually" if youre not able to boot
Module Issues:Magisk and MagiskHide Installation and Troubleshooting guide
www.didgeridoohan.com
I am assuming that it is not possible to accomplish what I wanted to achieve.
Royaltiger said:
I am assuming that it is not possible to accomplish what I wanted to achieve.
Click to expand...
Click to collapse
mixer_paths files have been replaced for years, long before magisk even...i did it back as far as the Galaxy S2 from memory, so im not sure why this didnt work for you, was the mxer_paths file specifically for your device? i have no clear idea why it hasnt worked for you
this thread has a guide to making /system RW, so you could manually copy the file and overwrite it, but id really consider how much you want to replace mixer_paths before i set out to do that
V60 Bootloader Unlock and Magisk Root
Earlier today I was alerted to https://www.cnblogs.com/yanhua-tj/p/15525593.html which has the actual firehose and steps to unlock! However it seems to be in Simplified Chinese so I'll translate it here for you. The firehose is attached below...
forum.xda-developers.com
73sydney said:
mixer_paths files have been replaced for years, long before magisk even...i did it back as far as the Galaxy S2 from memory, so im not sure why this didnt work for you, was the mxer_paths file specifically for your device? i have no clear idea why it hasnt worked for you
this thread has a guide to making /system RW, so you could manually copy the file and overwrite it, but id really consider how much you want to replace mixer_paths before i set out to do that
V60 Bootloader Unlock and Magisk Root
Earlier today I was alerted to https://www.cnblogs.com/yanhua-tj/p/15525593.html which has the actual firehose and steps to unlock! However it seems to be in Simplified Chinese so I'll translate it here for you. The firehose is attached below...
forum.xda-developers.com
Click to expand...
Click to collapse
Actually I had no problem in editing the mixer_tavil.xml file in LG V40/50. But when it comes to LG V60, the file is read-only. There is no way to edit it due to dynamic partition. Hence, I was seeking the only option available i.e., via Magisk module.
Royaltiger said:
Actually I had no problem in editing the mixer_tavil.xml file in LG V40/50. But when it comes to LG V60, the file is read-only. There is no way to edit it due to dynamic partition. Hence, I was seeking the only option available i.e., via Magisk module.
Click to expand...
Click to collapse
So, I encountered the same problem and found what you did wrong. I was able to write my own Magisk module and it works wonderfully. It took so much time to understand how to do it because there is no proper tutorial.
If you are still active and trying to know how to do it the right way, here comes the explanation:
The Replace = " /system/vendor/etc/ " must not be written as it completely wipes the actual folder from your phone. This is why you were not able to turn the phone on. It should be like this:
Replace = " " (That part must be blank)
The rest of the code is good. If you try it like this now, you will see it will work, just like mine did.
Cheers
Does not work. May I see your module? Please upload it here as attachment.
I even put my edited file under /data/adb/modules/<my directory>/system/vendor/etc. It shows up in Magisk as a module and the file loads (as it is not visible in file explorer) but there is no change in volume. So the thing is not working.

Categories

Resources