[MOD] viper4android + MIUI 12 + Magisk 21.1 - Xiaomi Mi 10T Lite Guides, News, & Discussion

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 }'

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.

Thanks Bro, this works for me on Oneplus 7T. V4A broke after updating Magisk to v21.2. Followed your method now's golden.

Thanks a lot. i just received the MIUI 12 update and i couldn't get V4A to work anymore. Followed your instruction and its working fine now. V4A is the only reason i keep my phone rooted so far. I'm on Redmi N5P

I did it with root explorer it works thank you

It works in enforcing! Thanks a lot

Thanks. This fixed it.

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

Xosrov said:
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
Click to expand...
Click to collapse
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.

_mysiak_ said:
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
Click to expand...
Click to collapse
Thanks very much! - I think this was my last little nit on V11.0 / OP7T Global and adding these magiskpolicy lines to the end of the file and a reboot worked fine. I used root-explorer / Edit and had to just clean up from the cut&Paste I did so it matched exactly the above.
FWIW: I'm using ViperFX as installed via Magisk repo 2.5.0.4 Legacy mode. I'd forgotten how much I liked Viper . - Oh - Meant to mention I was using Magisk 22.0 since it came out. No problems.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

_mysiak_ said:
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
Click to expand...
Click to collapse
Thanks a lot man! Huge respect. Follow your instructions and it works like charm in Samsung M21 One UI 3.0

Thank you! Works like a charm on my Pixel 4a! Can I post this in that device's forum?
EDIT: found out you can quote from other threads.

_mysiak_ said:
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
Click to expand...
Click to collapse
What's difference with legacy mode on to off?( Not talking about this method to work...talking in general)

leobahlis said:
What's difference with legacy mode on to off?( Not talking about this method to work...talking in general)
Click to expand...
Click to collapse
Legacy mode connects to the default audio session, which works system wide. Non-legacy mode connects to dedicated audio sessions created by each app, but some don't use/announce their audio session ID and Viper might not work in such apps (e.g. Youtube or Netflix). In theory, non-legacy mode should offer higher quality, but I wasn't able to tell the difference. Legacy mode offers better compatibility.
Btw. those who want "plug&play" experience and/or higher sound processing quality should give James DSP a try.

_mysiak_ said:
Legacy mode connects to the default audio session, which works system wide. Non-legacy mode connects to dedicated audio sessions created by each app, but some don't use/announce their audio session ID and Viper might not work in such apps (e.g. Youtube or Netflix). In theory, non-legacy mode should offer higher quality, but I wasn't able to tell the difference. Legacy mode offers better compatibility.
Btw. those who want "plug&play" experience and/or higher sound processing quality should give James DSP a try.
Click to expand...
Click to collapse
Thanks for the explanation
this james dsp works in miui selinux enforced?

leobahlis said:
Thanks for the explanation
this james dsp works in miui selinux enforced?
Click to expand...
Click to collapse
Yes, James DSP works with selinux enforcing.

I can't find " /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh" on my phone...
I only find this folder, but its empty:
Mi 10T Lite\android\Android\data\com.pittvandewitt.viperfx\files
I dont get it

br4t0 said:
I can't find " /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh" on my phone...
I only find this folder, but its empty:
Mi 10T Lite\android\Android\data\com.pittvandewitt.viperfx\files
I dont get it
Click to expand...
Click to collapse
Found it. I wasnt in recovery mode

I does not work on poco m3 I'm on crdroid and stock miui kernel

_mysiak_ said:
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
Click to expand...
Click to collapse
Thanks , it worked for my Mi 10T Pro with MIUI 12.6 weekly channel Rom

Related

Noob Apps2sd question (rooted N1)

I have, I think successfully, installed apps2sd on my N1 (CM7 build 22). Titanium Backup shows the ext2 partition with 90MB used. And all my applications that used to be on the FAT32 partition have been moved to the phone, which I understand means that they are really on the ext2 partition of the sdcard.
But using terminal emulator to enter a2sd commands gives a bunch of errors (see below). Can someone tell me what the problem is?
$a2sd cachesd
cp: can't create '/data/dta2sd.lg1': Permission denied
rm: can't remove '/data/dta2sd.log': Permission denied [ ] Apps2SD is launching...
/system/bin/a2sd: line 24: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 25: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 26: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 35: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 37: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 38: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 39: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 40: can't create /data/dta2sd.log: Permission denied
/system/bin/a2sd: line 41: can't create /data/dta2sd.log: Permission denied
grep: /init.rc: Permission denied
tee: /data/dta2sd.log: Permission denied __ _____
tee: /data/dta2sd.log: Permission denied
| \ |
tee: /data/dta2sd.log: Permission denied
| | |
tee: /data/dta2sd.log: Permission denied
|__/ | Darktremor Apps2SD 2.7.5.3 Beta 3a (2011-01-25)
tee: /data/dta2sd.log: Permission denied

[Script]Tools Menu v.05

IF USING AN OLD VER RUN THE UNINSTALL BEFORE INSTALLING A NEW VER
This is a batch file i made to install a tools menu i made. it came to be out of me being lazy and not wanting to have to open menus or hold shift
i did not make the scripts that some of the options use(credit is in the script).
see pictures to see the options and what it looks like in the end
IF ON WINDOWS RT YOU MUST BE JAILBROKEN TO USE. Thanks GoodDayToDie, it is now perfect
Main
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Install
Uninstall
Installs finished
Tools
Power
Power with extras
Changelog
v0.2 - added open powershell as admin here, fixed open cmd as admin here, no longer need ele.exe and the e.cmd file
v0.3 - able to remove the restart explorer.bat file thanks to coldbloc
v0.4 - added power menu. normal has lock, logoff, restart, restart with boot options, and shut down. the second has all of the first but sleep, hibernate, and switch user.
v0.5 - fixed an issue in the hidden files vbs(thanks LEDelete for pointing it out), fixed missing icon folder copy command in install script (thanks trm96 for pointing that out) should fix icons not showing up
the script has some swears i found them funny, again the script was made for me i just figured others my find it helpful.
if the icons dont show up reboot
Download Tools Menu
Looks cool.
So imagine I copy a registry key to my clipboard, does this regedit command capture it and open directly ? I checked, it only opens registry. Wonder if this MJ snippet would work in RT.
http://forums.mydigitallife.info/threads/38208
FYI, I don't prefer to kill-explorer like that, I think some settings that are not finalized until logoff can be lost when doing so, so instead I just logoff. But to each his own.
You can also change the position setting and the flyout will move to top or bottom of your menu. Make change in same key as the muiverb.
Code:
[FONT=monospace]
[/FONT][HKEY_CLASSES_ROOT\Directory\background\shell\Tools]
"MUIVerb"="Tools"
"SubCommands"="regedit.Tools;Open Admin Cmd here.Tools;Open Cmd Here.Tools;Files Extensions.Tools;Hidden Files.Tools;Restart Explorer.Tools"
"Icon"="C:\\Windows\\tools.ico"
"Position"="Top"
I forget the trick to add an extra divider line.
EDIT: I've never been able to get more then 12 subcommands even with nested flyouts, if anyone knows how I am all ears.
coldbloc said:
Looks cool.
So imagine I copy a registry key to my clipboard, does this regedit command capture it and open directly ? I checked, it only opens registry. Wonder if this MJ snippet would work in RT.
http://forums.mydigitallife.info/threads/38208
FYI, I don't prefer to kill-explorer like that, I think some settings that are not finalized until logoff can be lost when doing so, so instead I just logoff. But to each his own.
You can also change the position setting and the flyout will move to top or bottom of your menu. Make change in same key as the muiverb.
Code:
[FONT=monospace]
[/FONT][HKEY_CLASSES_ROOT\Directory\background\shell\Tools]
"MUIVerb"="Tools"
"SubCommands"="regedit.Tools;Open Admin Cmd here.Tools;Open Cmd Here.Tools;Files Extensions.Tools;Hidden Files.Tools;Restart Explorer.Tools"
"Icon"="C:\\Windows\\tools.ico"
"Position"="Top"
I forget the trick to add an extra divider line.
DIT: I've never been able to get more then 12 subcommands even with nested flyouts, if anyone knows how I am all ears.
Click to expand...
Click to collapse
tbh the reason i didnt put a position in is i couldnt decide where i wanted it and where it was worked with the rest of the stuff in my context.
as for restarting explorer i run in testmode 24/7 so after i remove the watermarks i just restart explorer rather then logging off. its also helpful if explorer decides to lock up.
well i was bored so i added the option to choose position to it
pbanj said:
i run in testmode 24/7 so after i remove the watermarks
Click to expand...
Click to collapse
That sounds like you have to do it every reboot. Are the mui files protected in RT and we are unable to edit the watermark permanently ?
If I write a snip to add powershell run-as admin would you add it to your Tool™
coldbloc said:
That sounds like you have to do it every reboot. Are the mui files protected in RT and we are unable to edit the watermark permanently ?
If I write a snip to add powershell run-as admin would you add it to your Tool™
Click to expand...
Click to collapse
not at every boot once its done its done but i added it as it was more for when i do fresh installs, im adding it in now
edit one
i was able to get the admin cmd to work without the need of the extra files so those have been removed. i will be uploading it in a few min
edit two
new ver is uploaded, i added a ver number to it to help me keep track of it. you will have to run the uninstall part in the old one first before running the install on this as i have removed some unneeded stuff
pbanj said:
not at every boot once its done its done but i added it as it was more for when i do fresh installs, im adding it in now
edit one
i was able to get the admin cmd to work without the need of the extra files so those have been removed. i will be uploading it in a few min
edit two
new ver is uploaded, i added a ver number to it to help me keep track of it. you will have to run the uninstall part in the old one first before running the install on this as i have removed some unneeded stuff
Click to expand...
Click to collapse
That's a different way of doing it. Lately for elevation most people are using APPCOMPATFLAGS or an inline elevator script. Had never seen an example using just "ExplorerCommandHandler" and "ImpliedSelectionModel" settings before.
http://windowssucks.wordpress.com/file-type-registration/
Does that only work on newer builds, I searched my W7x64 registry for that canonical GUID (the powershell one) didn't come up with anything. Where did you find it.
coldbloc said:
That's a different way of doing it. Lately for elevation most people are using APPCOMPATFLAGS or an inline elevator script. Had never seen an example using just "ExplorerCommandHandler" and "ImpliedSelectionModel" settings before.
http://windowssucks.wordpress.com/file-type-registration/
Does that only work on newer builds, I searched my W7x64 registry for that canonical GUID (the powershell one) didn't come up with anything. Where did you find it.
Click to expand...
Click to collapse
i found it in a program that adds items to the context menu but when it added powershell it would crash explorer so i used it as a base and started messing with it until it worked without crashing explorer(fun times). im not sure if it works in windows 7 as im on 8.1
Understood, not available in W7, likely only 8.0 and up. I find it here in W8.1.
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{BF0AC53F-D51C-419F-92E3-2298E125F004}]
@="Open Powershell as Admin Command"
[HKEY_CLASSES_ROOT\CLSID\{BF0AC53F-D51C-419F-92E3-2298E125F004}\InProcServer32]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,68,00,\
65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"
Maybe can even use the GUID list of control panel items the same way.
http://msdn.microsoft.com/en-us/library/windows/desktop/ee330741(v=vs.85).aspx
Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OAPS.Tools]
"ImpliedSelectionModel"=dword:00000001
"Icon"="imageres.dll,-5373"
"ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
@="Admin Pshell Here"
and I remembered how to do the divider line trick.
Code:
"SubCommands"="regedit.Tools;|;OACh.Tools;OCH.Tools;|;OAPS.Tools;|;FE.Tools;HF.Tools;|;RE.Tools"
Think you can get rid of the Restart_Explorer.bat with this.
http://www.robvanderwoude.com/condexec.php
Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools]
"Icon"="C:\\Windows\\explorer.exe"
"MUIVerb"="Restart Explorer"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools\command]
@="taskkill /f /im explorer.exe && start explorer.exe"
and this could toggle file extensions, without the .vbs
Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools]
"Icon"="C:\\Windows\\file.ico"
"MUIVerb"="Files Extensions"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools\command]
@="start /wait /b powershell -command \"$check = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt').HideFileExt;if ($check -eq 0){Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 1} else {Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 0}\""
;
;
coldbloc said:
Think you can get rid of the Restart_Explorer.bat with this.
http://www.robvanderwoude.com/condexec.php
Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools]
"Icon"="C:\\Windows\\explorer.exe"
"MUIVerb"="Restart Explorer"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools\command]
@="taskkill /f /im explorer.exe && start explorer.exe"
and this could toggle file extensions, without the .vbs
Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools]
"Icon"="C:\\Windows\\file.ico"
"MUIVerb"="Files Extensions"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools\command]
@="start /wait /b powershell -command \"$check = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt').HideFileExt;if ($check -eq 0){Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 1} else {Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 0}\""
;
;
Click to expand...
Click to collapse
tried both of those with no luck, the restart explorer one made a cmd window pop up real fast, all i could see was it said invalid something. the file extension one didnt do anything
i would love to be able to get rid of the scripts
pbanj said:
tried both of those with no luck, the restart explorer one made a cmd window pop up real fast, all i could see was it said invalid something. the file extension one didnt do anything
i would love to be able to get rid of the scripts
Click to expand...
Click to collapse
On the file extension, I forget the refresh. Here is the snip, it goes somewhere near the end. FYI, I need rewrite it registry > cmd > powershell escape character safe.
I want to be sure it's just the refresh causing the problem and that the registry still got toggled, proving the powershell did run in the background and was not stopped by execution policy. Will you confirm by running the old script and manually hitting refresh.
Code:
;[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');[System.Windows.Forms.SendKeys]::SendWait('{F5}');
coldbloc said:
On the file extension, I forget the refresh. Here is the snip, I need rewrite it registry > cmd > powershell escape character safe (triple double quotes nesting issues mostly).
I want to be sure it's just the refresh causing the problem and the registry still got toggled, meaning the powershell did run in the background. Will you confirm by running the old script and manually hitting refresh to verify.
Code:
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');[System.Windows.Forms.SendKeys]::SendWait("{F5}")
Click to expand...
Click to collapse
i thought it might not have been refreshing so i tried that and it still didnt change
pbanj said:
i thought it might not have been refreshing so i tried that and it still didnt change
Click to expand...
Click to collapse
So you are on 8.1 RT, with powershell policy enabled and it still doesn't work.
Been bing'ing around for RT Powershell Limitations and it seems Microsoft might be the reason it doesn't work. Don't have RT hardware to test, cannot find a VM emulator either.
http://www.contextis.com/research/blog/windows-rt-and-powershell/
http://social.technet.microsoft.com...vated-but-on-windows-rt-ie-surface?forum=ITCG
http://www.reddit.com/r/netsec/comments/1khcw0/windows_rt_and_powershell/
coldbloc said:
So you are on 8.1 RT, with powershell policy enabled and it still doesn't work.
Been bing'ing around for RT Powershell Limitations and it seems Microsoft might be the reason it doesn't work. Don't have RT hardware to test, cannot find a VM emulator either.
http://www.contextis.com/research/blog/windows-rt-and-powershell/
http://social.technet.microsoft.com...vated-but-on-windows-rt-ie-surface?forum=ITCG
http://www.reddit.com/r/netsec/comments/1khcw0/windows_rt_and_powershell/
Click to expand...
Click to collapse
im on normal 8.1 pro with media center
pbanj said:
im on normal 8.1 pro with media center
Click to expand...
Click to collapse
OK, is my bad then. Found the issue with Restart Explorer. Working on 2012-R2
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools]
"Icon"="C:\\Windows\\explorer.exe"
"MUIVerb"="Restart Explorer"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools\command]
@="\"C:\\Windows\\System32\\cmd.exe\" /c \"taskkill /f /im explorer.exe & start explorer.exe\""
coldbloc said:
OK, is my bad then. Found the issue with Restart Explorer. Working on 2012-R2
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools]
"Icon"="C:\\Windows\\explorer.exe"
"MUIVerb"="Restart Explorer"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\RE.Tools\command]
@="\"C:\\Windows\\System32\\cmd.exe\" /c \"taskkill /f /im explorer.exe & start explorer.exe\""
Click to expand...
Click to collapse
that one works like a charm, i added it to the regfiles and added a mention to u in the changelog
updated it again, i added power options to the context menu it only shows on the desktop and i did not give it the option to have its position changed
Fixed the toggle file extensions added restart explorer kludge
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools]
"Icon"="C:\\Windows\\file.ico"
"MUIVerb"="Files Extensions"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools\command]
@="cmd /c start /wait /b powershell -command \"$check = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt').HideFileExt;if ($check -eq 0){Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 1} else {Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 0};taskkill /f /im explorer.exe;explorer.exe\""
coldbloc said:
Fixed the toggle file extensions added restart explorer kludge
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools]
"Icon"="C:\\Windows\\file.ico"
"MUIVerb"="Files Extensions"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools\command]
@="cmd /c start /wait /b powershell -command \"$check = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt').HideFileExt;if ($check -eq 0){Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 1} else {Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 0};taskkill /f /im explorer.exe;explorer.exe\""
Click to expand...
Click to collapse
if it didnt restart explorer it would be better then it is now.
pbanj said:
if it didnt restart explorer it would be better then it is now.
Click to expand...
Click to collapse
Fixed the toggle file extensions sans restart explorer kludge
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools]
"Icon"="C:\\Windows\\file.ico"
"MUIVerb"="Files Extensions"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools\command]
@="cmd /c start /wait /b powershell -command \"$check = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt').HideFileExt;if ($check -eq 0){Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 1} else {Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 0}\""
coldbloc said:
Fixed the toggle file extensions sans restart explorer kludge
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools]
"Icon"="C:\\Windows\\file.ico"
"MUIVerb"="Files Extensions"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\FE.Tools\command]
@="cmd /c start /wait /b powershell -command \"$check = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt').HideFileExt;if ($check -eq 0){Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 1} else {Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced' -Name 'HideFileExt' -Value 0}\""
Click to expand...
Click to collapse
im looking but finding it but maybe u know it, is there a way to have it send the f5 key with powershell?

Can I calibrate the accelerometer? Camera horizon level is not indicated correctly.

Hello,
I tried some camera apps (Cameringo+, aillis, and ProShot) which had a horizontal level indicator, but all the indicators did not indicate the true horizontal level. It seems that the built-in accelerometer is wrong. Is there any method to calibrate the wrong sensor?
Thanks,
*push*
I have the same problem. I can't play racing games or use cardboard apps. Can anyone help?
best regards
I have the same problem.
More precisely, when I run the "GPS Status & Toolbox" app and the device is stationery, I get a non-zero rotation vector.
GPS Status shows a 3 degrees/second rotation, even when the device is still.
Since it's a brand new unit, I'm likely to return it to Goog.
I have the same problem, but don't know any solution. Seems it's a common problem.
After further investigations, it seems like there is some calibration data that's not being read when the device boots.
If anyone has the same problem and has root, can you:
Post the contents of:
Code:
/persist/sensorcal.json
Code:
/data/misc/sensorcal_saved.json
Then turn off SELinux or patch the SELinux policy (SuperSU required) by either running:
Code:
setenforce 0
OR
Code:
supolicy --live 'allow sensortool devpts chr_file { read write getattr }' 'allow sensortool persist_sensortool_file file { write }'
Then run:
Code:
/vendor/bin/sensortool.bullhead -c gyro
while the phone is still. This will overwrite
Code:
/persist/sensorcal.json
.
And finally post the contents of
Code:
/persist/sensorcal.json
after this modification.
Your gyro should now be functioning correctly until the next reboot.
It looks like Nexus 5X "forgets" to read the calibration data upon boot.
The above procedure will force a recalibration and forces the sensor hub to use the new calibration data.
I'm looking at a way to load the calibration data into the sensor hub without having to recalibrate, but this may need some serious hacking.
Fif_ said:
After further investigations, it seems like there is some calibration data that's not being read when the device boots.
If anyone has the same problem and has root, can you:
Post the contents of:
Code:
/persist/sensorcal.json
Code:
/data/misc/sensorcal_saved.json
Then turn off SELinux or patch the SELinux policy (SuperSU required) by either running:
Code:
setenforce 0
OR
Code:
supolicy --live 'allow sensortool devpts chr_file { read write getattr }' 'allow sensortool persist_sensortool_file file { write }'
Then run:
Code:
/vendor/bin/sensortool.bullhead -c gyro
while the phone is still. This will overwrite
Code:
/persist/sensorcal.json
.
And finally post the contents of
Code:
/persist/sensorcal.json
after this modification.
Your gyro should now be functioning correctly until the next reboot.
It looks like Nexus 5X "forgets" to read the calibration data upon boot.
The above procedure will force a recalibration and forces the sensor hub to use the new calibration data.
I'm looking at a way to load the calibration data into the sensor hub without having to recalibrate, but this may need some serious hacking.
Click to expand...
Click to collapse
Thanks for your post. Inspired by what you said, I found the other guys and myself are having an miscalibrated accelerate sensor. And it's a little bit difficult to calibrate this sensor than the gyro, since a flat table is needed and the back of 5x is not flat (due to the camera).
P.S. can you post the undo command of this?
Code:
supolicy --live 'allow sensortool devpts chr_file { read write getattr }' 'allow sensortool persist_sensortool_file file { write }'
yaoppp said:
Thanks for your post. Inspired by what you said, I found the other guys and myself are having an miscalibrated accelerate sensor. And it's a little bit difficult to calibrate this sensor than the gyro, since a flat table is needed and the back of 5x is not flat (due to the camera).
Click to expand...
Click to collapse
Great to be able to help.
I found it easy to calibrate the accelerometer: just raise the middle and bottom section of the phone over a book. The camera parts can be dangling.
I have since made more discoveries and was able to calibrate the device correctly and have the calibration persist on reboot.
My sensors problems are now gone!
Instructions follow below.
yaoppp said:
P.S. can you post the undo command of this?
Code:
supolicy --live 'allow sensortool devpts chr_file { read write getattr }' 'allow sensortool persist_sensortool_file file { write }'
Click to expand...
Click to collapse
Just reboot. These changes are in memory only.
If you actually want to undo the policy changes without rebooting, run as root:
Code:
supolicy --live 'deny sensortool devpts chr_file { read write getattr }' 'deny sensortool persist_sensortool_file file { write }'
---------- Post added at 04:30 PM ---------- Previous post was at 03:47 PM ----------
After struggling with this for a while, here's the latest update about what I found.
Contrarily about what I wrote earlier on, the Nexus 5X does read the calibration data in /persist/sensorcal.json at boot.
What happens is the calibration procedure (as initiated by /vendor/bin/sensortool.bullhead -c <sensor>) correctly calibrates the sensor, updates the sensor with the new calibration data, then writes the calibration file /persist/sensorcal.json wrong.
That's why running /vendor/bin/sensortool.bullhead -c <sensor> fixes the problem until the next reboot.
So the fix is to edit by hand the /persist/sensorcal.json file, trying to tweak the calibration values, reboot, check the sensor and do that a few times until you have no sensor bias.
Well, you can do it this way (rebooting between every change to /persist/sensorcal.json), or you can look at the next post for an alternate method that does not involve rebooting twenty times.
WARNING: If you make a typo editing /persist/sensorcal.json, like adding a comma where it's not needed or removing one where it's needed, your device will not boot. You will have to get into recovery and fix the file there. What's even worse, a factory reset will not fix a busted /persist/sensorcal.json as /persist is not wiped during factory reset.
DO THIS AT YOUR OWN RISK
Before you make any change to /persist/sensorcal.json:
Make a backup of the file
Make sure you know how to restore that backup from recovery, without Android booting.
Again: a mess up will softbrick your phone.
My particular case:
My gyrometer readings were off. When the device was still, a simple app to report the gyro reading was returning a non-zero value. The device was thinking it was rotating around only one axis.
Needless to say all apps that used the gyro (eg. driving games) were not happy about this.
My original /persist/sensorcal.json file looked like this:
Code:
{
"accel": [
22,
-2,
-8
],
"gyro": [
22,
-9,
-9
],
"proximity": 1
}
}
I started changing the numbers in the gyro section. After changing the "22" to "100" and rebooting, I saw that my original faulty axis was still wrong, but also another axis was now busted.
So I reverted that change, moved on the next number.
Finally I found that the third figure was the one that was corresponding to my busted axis.
I managed to tweak that number until my gyro was reporting no motion at rest.
And now my Nexus 5X's sensors are just fine, and I can play driving games
My final /persist/sensorcal.json looks like this:
Code:
{
"accel": [
22,
-2,
-8
],
"gyro": [
22,
-9,
-73
],
"proximity": 1
}
}
Since the problem is likely to be memory corruption in /vendor/bin/sensortool.bullhead, on your device, a different calibration value may be affected.
If you want to "factory recalibrate the device" (and re-break your sensors), just follow the instructions in post #5.
Rereading /persist/sensorcal.json without rebooting
The method therein allows you to edit /persist/sensorcal.json then have the on-board sensor re-read that file without having to reboot.
Requirements:
A Nexus 5X device (duh)
Busybox installed
Supersu installed
The attached bullhead-reread-sensor-calibration.zip file.
A root shell (either via ADB or with a Terminal app + su)
Instructions:
Unzip bullhead-reread-sensor-calibration.zip under /sdcard. This will create two new files:
bullhead-reread-sensor-calibration
sensortool-writewrap.so
After every change to /persist/sensorcal.json, run in your root shell:
Code:
sh /sdcard/bullhead-reread-sensor-calibration
. You should see:
Code:
supolicy v2.74 (ndk:arm64-v8a) - Copyright (C) 2014-2016 - Chainfire
Patching policy ...
(Android M policy compatibility mode)
-allow:sensortool:devpts:chr_file:read=ok
-allow:sensortool:devpts:chr_file:write=ok
-allow:sensortool:devpts:chr_file:getattr=ok
- Success
resetting target.
sensorhub said: 'Hello, world!'
sensorhub said: 'Found Bosch BMP280 Pressure/Temperature Sensor'
sensorhub said: 'Found Rohm RPR-0521 Proximity/ALS Sensor'
sensorhub said: 'Found Bosch BMI160 Accel/Gyro Sensor'
sensorhub said: 'init: 22 -2 -8, 22 -9 -73, 0.00, 1'
The numbers on the last line will be different for your device.
Your sensor hub's calibration data has been updated. Note that if you had an app actively reading from the sensors, since they were reset, you will need to quit the app and restart it.
Further notes:
The above script makes no permanent changes to your system (but temporarily alters your SELinux policy, a reboot will reset the policy to its secure default).
The script uses an interposition shared library (sensortool-writewrap.so) that was compiled with the Android NDK from the C file source attached. If you're just using this tool, there is no need to download the C file.
Good guide on how to calibrate your sensors manually.
This should help calibrating your sensor manually if you use the method above:
https://docs.google.com/document/d/14uwBu0R7Yv6bwl5Y7CE1vpFWetnSzgs-zt0GwOaDwIg/edit?pref=2&pli=1
If you don't want to go through the Excel route and exporting the data from the phone, the app "Sensor Kinetics Pro" has a low-pass filter option for all sensors.
You can check that your sensor readouts are as close as possible to zero after tweaking /persist/sensorcal.json as explained in the previous posts.
Fif_ said:
The method therein allows you to edit /persist/sensorcal.json then have the on-board sensor re-read that file without having to reboot.
Click to expand...
Click to collapse
Just wanted to thank you for all these instructions. My accelerometer was 5 degrees off in landscape and while the calibration tool did manage to calibrate it correctly (these settings also stuck for me after reboot), it also calibrated the upright position off by 2 degrees. Some quick manual editing thanks to your method and I now have everything calibrated correctly. It was impossible to take a panorama in landscape before this, so I owe you a really big thank you!
CazeW said:
Just wanted to thank you for all these instructions. My accelerometer was 5 degrees off in landscape and while the calibration tool did manage to calibrate it correctly (these settings also stuck for me after reboot), it also calibrated the upright position off by 2 degrees. Some quick manual editing thanks to your method and I now have everything calibrated correctly. It was impossible to take a panorama in landscape before this, so I owe you a really big thank you!
Click to expand...
Click to collapse
Happy it was useful to someone.
I would have thought the problem was more widespread.
Ok, I probably know the answer, but is there any chance to calibrate it without root permissions? Even if it resets after reboot. I have brand new phone without any scratches, I don't want to loose warranty and change it to a perfect shiny brick (at least not yet). I know my luck, it's gonna be just like that.
I've tried to force Google to admit, that this problem affects every (or almost every) single one Nexus 5X and they should at least add calibration option, because sending phone to the service takes time and isn't the best option. They gave me a standard answer to contact the service :good:
productforums.google.com/forum/?utm_medium=email&utm_source=footer#!topic/nexus/2Xkk3X4KvYQ;context-place=forum/nexus (I can't add link as link, I'm not a trusted user )
Yes, root is required.
However, you can unlock the bootloader, root, follow the instructions and calibrate, and then reimage the device and relock the bootloader.
You'll then have a calibrated stock device, which should be covered by the warranty.
Can You tell me which values did You edited? I have 5 degrees off in landscape too and just can't get right value. I think I actually has problem with accel sensor, not with gyroscope.
P.S. Seems like in Android 7.0 there is no /vendor/bin/sensortool.bullhead .
Instead in init.bullhead.sensorhub.rc I found it uses /system/bin/nanoapp_cmd which have little different format like
/system/bin/nanoapp_cmd calibrate gyro
Click to expand...
Click to collapse
But it actually throws me an "Failed to open /dev/nanohub: err=13 [Permission denied]" error, even after I called both
supolicy --live 'allow sensortool devpts chr_file { read write getattr }' 'allow sensortool persist_sensortool_file file { write }
supolicy --live 'allow nanoapp_cmd devpts chr_file { read write getattr }' 'allow nanoapp_cmd persist_sensortool_file file { write }
Click to expand...
Click to collapse
Any ideas? Anyone tried that hack on Android 7.0 stock?
I've just changed values in /persist/sensorcal.json. My tilt was almost 6 degrees and I knew that the y-axis is bad.
My origin values:
Code:
{
"accel": [
21,
-21,
-8
],
"gyro": [
-1,
-9,
-10
],
"proximity": 9
}
I've changed -21 to -31, then reboot and then i had almost 8 degrees error so it was a bad direction. I've changed it to 0 and now it is perfect.
Now my sensorcal.json loks like this:
Code:
{
"accel": [
21,
0,
-8
],
"gyro": [
-1,
-9,
-10
],
"proximity": 9
}
I'm on the stock rom again and it still works.
@Fif_ I have no words to tell you how awesome you are. THANKS!
Denfox said:
Can You tell me which values did You edited? I have 5 degrees off in landscape too and just can't get right value. I think I actually has problem with accel sensor, not with gyroscope.
P.S. Seems like in Android 7.0 there is no /vendor/bin/sensortool.bullhead .
Instead in init.bullhead.sensorhub.rc I found it uses /system/bin/nanoapp_cmd which have little different format like
But it actually throws me an "Failed to open /dev/nanohub: err=13 [Permission denied]" error, even after I called both
Any ideas? Anyone tried that hack on Android 7.0 stock?
Click to expand...
Click to collapse
Just try to disable SELinux entirely with:
Code:
setenforce 0
and then run nanoapp_cmd.
Fif_ said:
Just try to disable SELinux entirely with:
Code:
setenforce 0
and then run nanoapp_cmd.
Click to expand...
Click to collapse
This not works for me unfortunately.
But actually I did calibration by doing values bust.
As a result to compensate 5 degrees at the Y axis I've changed the value in the calibration json on 25 units.
Thanks for a solution! :good:
Hi, thanks, this worked great.
It was tilted almost 7°
As a note I have to modify "accel" section, not "gyro".
Code:
{
"accel": [
27,
-8,
-4
],
"gyro": [
5,
7,
-10
],
"proximity": 8
}
Main post should be as permanent is 5x section
JP
Hi guys, I have the same problem but only in landscape mode. For example if i take a pano in portrait the image is aligned well, while if i try to do it on landscape it's inclined on the right. Which value i have to change in that file?
giorgis91 said:
Hi guys, I have the same problem but only in landscape mode. For example if i take a pano in portrait the image is aligned well, while if i try to do it on landscape it's inclined on the right. Which value i have to change in that file?
Click to expand...
Click to collapse
Some people had to change the gyro section, others the accel section.
Please read the entire thread, make a backup of sensorcal.json, then try to run sensortool/nanoapp_cmd, see if that helps.

Runtime exec not behaving like adb exec

I've built a C++ native Android app with NDK toolcahain.
I've first tested the app using the adb tool and got the following output:
Code:
generic:/ $ run-as cardservice.hr.cardservice
generic:/data/data/cardservice.hr.cardservice $ cd card/
generic:/data/data/cardservice.hr.cardservice/card/ $ ./cardService
2016-11-30 20:36:06,245 INFO [default] Starting CardService
App continues to run
But problem starts when I try to do the same thing from a Android application.
The following code:
Code:
private void exec_command() throws IOException, InterruptedException {
String command = "./data/data/cardservice.hr.cardservice/card/cardService"
Process check_card_service = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(check_card_service.getInputStream()));
String line;
String content = "";
while ((line = in.readLine()) != null) {
System.out.println(line);
content = content + line;
}
check_card_service.waitFor();
};
It starts the application but the application fails, and stops working.
Code:
2016-11-30 19:25:11,417 INFO [default] Starting CardService
2016-11-30 19:25:11,447 INFO [default] Underlying Transport Error, Code: websocketpp.transport.asio:3
So my question is what is different in my approaches, what changes if i run it from my app or from the adb shell?
The application does not need root access.
Do you need any extra information?

Question Viper4android?

Hey people,
is there someone who got Viper4android to work?
I have tried a lot but just can't figure out how to do it.
I always get stuck at the starting screen which prompts me to download files.
When I tap on download, it says "installing", goes quickly to 100% and restarts the device.
The same things happens after the reboot.
Unbreakeable said:
Hey people,
is there someone who got Viper4android to work?
I have tried a lot but just can't figure out how to do it.
I always get stuck at the starting screen which prompts me to download files.
When I tap on download, it says "installing", goes quickly to 100% and restarts the device.
The same things happens after the reboot.
Click to expand...
Click to collapse
Try this way:
[18.04.23] G998B I Dr.Ketan ROM I OneUI 5.1 I OneUI 4.1 I OneUI 3.1
G998B Dr.Ketan ROM Supported device : G998B We do support usually 2-3 years since device launched, but yet no guarantee, We may drop support for any device / any variant/s anytime without any prior notice. ROM Features ROM Features varies...
forum.xda-developers.com
Unbreakeable said:
Hey people,
is there someone who got Viper4android to work?
I have tried a lot but just can't figure out how to do it.
I always get stuck at the starting screen which prompts me to download files.
When I tap on download, it says "installing", goes quickly to 100% and restarts the device.
The same things happens after the reboot.
Click to expand...
Click to collapse
I had that issue too, but I can't quite remember how I solved it. I think I reinstalled the magisk module and it finally worked.
xxspark89xx said:
I had that issue too, but I can't quite remember how I solved it. I think I reinstalled the magisk module and it finally worked.
Click to expand...
Click to collapse
You have to set your SELinux to permissive for it to work.
Hi, I installed James Dsp, android modification library, viper4android legacy materialized magisk module, and android compatible module, and all is working fine.
My steps were: Install Jamesdsp and audio modification library through magisk repo, reboot. Install viper4android through the magisk repo, reboot. Open viper and install drivers, it'll reboot automatically. After that follow the tutorial here https://www.droidwin.com/fix-viper4android-not-working-with-selinux-enforcing/ to get viper to work with selinux enforcing. Reboot. After that viper4android should be working.
TheKnux said:
You have to set your SELinux to permissive for it to work.
Click to expand...
Click to collapse
My phone first slowed down a lot and caused problems when it was set to permissive.
It got better later but my sim cards couldn't be detected.
So in short, it breaks functionality when I set it to that.
vibrantliker said:
Try this way:
[18.04.23] G998B I Dr.Ketan ROM I OneUI 5.1 I OneUI 4.1 I OneUI 3.1
G998B Dr.Ketan ROM Supported device : G998B We do support usually 2-3 years since device launched, but yet no guarantee, We may drop support for any device / any variant/s anytime without any prior notice. ROM Features ROM Features varies...
forum.xda-developers.com
Click to expand...
Click to collapse
Didn't work either, again just asking for updates over and over again.
I'll look if the other suggestions work when I have the time.
But still, thank you.
This is the procedure I do. I used RootExplorer to modify the file. Reboot when it says. This is important
uninstall any previous versions of V4A and other audio mods
install Audio Modification Library from the Magisk repository; reboot
install Audio Compatibility Patch from the Magisk repository; reboot
install V4A v2.7.2.1 from local storage if you have the zip file or from the Magisk repository; do not reboot
open the V4A application, grant root access and follow the prompts to install the Magisk module; reboot
open V4A and go to Settings and enable Legacy Mode
modify the following file: /data/adb/modules/Viper4Android/post-fs.sh
add the following lines to the end of post-fs.sh
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 }’
open V4A and go to Settings and disable Legacy Mode; reboot
open V4A and go to Settings and enable Legacy Mode
JWhetstone02 said:
This is the procedure I do. I used RootExplorer to modify the file. Reboot when it says. This is important
uninstall any previous versions of V4A and other audio mods
install Audio Modification Library from the Magisk repository; reboot
install Audio Compatibility Patch from the Magisk repository; reboot
install V4A v2.7.2.1 from local storage if you have the zip file or from the Magisk repository; do not reboot
open the V4A application, grant root access and follow the prompts to install the Magisk module; reboot
open V4A and go to Settings and enable Legacy Mode
modify the following file: /data/adb/modules/Viper4Android/post-fs.sh
add the following lines to the end of post-fs.sh
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 }’
open V4A and go to Settings and disable Legacy Mode; reboot
open V4A and go to Settings and enable Legacy Mode
Click to expand...
Click to collapse
Still the same issue.
Everythinf works except for the downloading of the drivers.
It prompts me to download the drivers, goes to 100% and immediately reboots at that point.
That's what happens every single time, no matter what I do.
I can see the settings in the background but not use it.
Anyone was able to set presets ?
Whenever I tried v4a has no permission to read folders. Sucks

Categories

Resources