[TOOL][MOD][WIN][SHARE] Take Screenshots in Recovery & Aroma! - Galaxy Y GT-S5360 Themes and Apps

[SIZE="4']Note : I'm just sharing the work of the XDA Member.Here's a little introduction by him :[/B][/U][/SIZE]
[QUOTE="makers_mark, post: 0"]This is a tool to capture screenshots while in Recovery or the Aroma Installer.
One big problem people are having when trying to capture screenshots in recovery is the extra framebuffer info that is tacked on to the end of each pixel row. Through a lot of digging and not finding too much information on it, I've finally found a way to determine what dimensions to use for, I believe, all android devices.
Fb2png is a great program, but unfortunately it only works with framebuffers that don't have a stride. FFmpeg is what I use here. That is a major problem with fb2png but it seems like it would be an easy thing to fix. The only thing to get it working, besides some random pixel formats maybe, is taking care of this stride.
I found that if you divide your width, for the nexus 7 2013 it's 1200, by 32, your stride will equal the value to add to 1200 to go up and make it evenly divisible by 32, that is your stride. Look at a bunch of resolutions and the width; the short side, think portrait mode; is usually evenly divisible by 32. Not all the time though, like the case of the Nexus 7 2013, Nexus 5 with 1080, and many more devices nowadays, AND those are the devices fb2png gives distorted screenshots with. Maybe @Phil3759 knows how to fix this for fb2png.
By the way the Nexus 5's stride is 8
1080/32 = 33 with a remainder of 24. 32-24 = 8
Anyways I made this batch script that takes into account your stride, if you have one. If your width is 768 for example, you won't have one because 32 goes into 768 an even 24 times.
Instructions:
Download the RS_all.rar file
Extract it to a new folder.
You will have the programs FFmpeg & ADB. Two .dll files for ADB. And the batch script RUNrs.bat
I assume you have your ADB drivers squared away.
Reboot into your recovery.
Run RUNrs.bat and it will ask you for you screen width in pixels, and your height. Input them.
It will then pull your framebuffer and make a bunch of viewable pngs with different pixel formats.
Don't close the program or anything, but go look in the folder you unzipped everything, and go through the images until you find one that is exactly like you screen, don't settle for close. Look at the filename of the one, and input that into the next prompt for your pixel format.
If I get any feedback I will change the first set of pixel formats to more common ones only, then some rarer ones if the first set didn't work.
Feel free to run 'ffmpeg -pix_fmts' and put in any of the other input-able pixel formats when you are asked to select which one you want to use.
Your set from there, all of that will be saved into settings.cfg.
If you change your recovery, you may have to clear the settings. You can do so easily in the program, or you can just delete settings.cfg
Same thing if you try a different device.
I am severely limited in devices to test. But I'd like to find a universal way with all android devices to pull the screen resolution from the phone/tablet and..
- add a check for the framebuffer in /dev/fb0 instead of just /dev/graphics/fb0. For now, if you get errors and it won't pull the framebuffer. Just change the code in the batch, two different places, from 'adb pull /dev/graphics/fb0 frmbfr' to 'adb pull /dev/fb0 frmbfr'
- make folders for screenshots to go into, and also a temp folder that gets deleted, for the pixel format test images.
- add the double frame buffer, two images. I have already done it, but am a little baffled as some devices seem to have six; or at least room for six raw fb0 NUL 2>&1
ADB pull /dev/graphics/fb0 frmbfr > nul
IF ERRORLEVEL 1 (cls
SET TS="NOGOOD"
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your device from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO SETTINGS
)
CLS
REM ECHO The width of your framebuffer is %widthwithstride%
SET line=
ECHO %widthwithstride% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%%A
ECHO %width% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%line% %%A
ECHO %height% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%line% %%A
REM echo %width% %height% %stride% %widthwithstride%
REM echo %framebufferpixels% %bytespp%
REM echo %fb0size%
SET TS=%_%.png
FOR /D %%A IN (%pixfmt%) DO call FFMPEG %ffshowb% %ffdebug% -f rawvideo -vcodec rawvideo -pix_fmt %%A -s %widthwithstride%x%height% -i frmbfr -vframes 1 -vf crop=%width%:%height%:0:0 -y %%A%TS%
ECHO Check in the folder you ran this program in and there
ECHO should be several images. If any are a 'correct'
ECHO screenshot, make a note of what pixel format is in
ECHO the start of the filename.
ECHO[
ECHO YOU MUST USE LOWERCASE LETTERS!
ECHO[
ECHO Example: file that is correct color is rgb565.png
ECHO then you would enter 'rgb565'
SET /p pixfmt=Pixel format?
REM IF %pixfmt%=none GOTO SORRY
ECHO %pixfmt% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%line% %%A
ECHO %line% > settings.cfg
DEL frmbfr
DEL temp.tmp
CLS
GOTO START
:FINISH
ADB kill-server -d
SET width=""
SET height=""
SET widthwithstride=""
SET framebufferpixels=""
SET bytespp=""
SET fb0size=""
SET TS=""
EXIT
ROCESS
SET widthwithstride=%1
SET width=%2
SET height=%3
SET pixfmt=%4
GOTO GOTPARAMETERS
:SORRY
REM SLIM DOWN ORIGIANL PIXEL FORMATS, AND SOME RARER ONES HERE
GOTO FINISH
[/CODE][/HIDE]
[/QUOTE]
Original Thread : http://forum.xda-developers.com/showthread.php?t=2635736

Related

[11/24/2011] Adb tools/Mod tools [WIP]

Here is a simple script for adb push and more.​Developed by Chubbzlou and myself.​
Over the coming days there will be more added. Some will be for experienced developers while some for the newer developers. My goal is to make a one stop tool to help with the following.
Changelog 11/24/2011
Updated the menu to simplify the options plus added HP Touchpad support
New Link
Changelog 10/12/2011
Ok, things got overhauled on this one to simplify things more. Currently there are 23 options with most of them working. The zip menu isn't working 100% but other than that you will have a lot of usefull stuff here.
It's been reorganized to the following.
Section 1
Apk editing
* Framework apks
* Decompile apks
* Compile apks
* Sign apks
* Install apks
* Compile/sign, install apks
Section 2
Classes.dex
* Decompile Classes.dex
* Compile classes.dex
Section 3
Logcat Menu
* Screen Logcat
* Logcat Text
Section 4
Push/Pull Menu
* Push system/folders
* Push data/app
* Pull system from phone
* Adb Shell
* Push to sdcard to create pushed folder or to root of sdcard
* New Back up your sdcard
Section 5
Reboot Menu
* Reboot Phone
* Reboot to Recovery
* Reboot to Bootloader
Section 6
Zip Menu
* Extract apk (not fuctional)
* Zip apk (not functional)
* Zip align/Png opting (completely functional now)
* Compression level (not functional)
Section 7
Odexing Menu
* You can now choose this for an automated odexing. It will odex your ROM, pull system/app and system/framework to device/app and device/framework
edit: Confirmed it will do multiple zipalign/opt pngs. Place apks in folder called apks. Choose menu 22, select zp. It will place them in tools/optimized. However, you have to hit enter after each apk for now. we are working on a fix to move folder to main directory and fix the hit enter. this will let you zipalign and opt all the apks and walk away.
Mirror
More to come...
Credit:
Chubbz, for helping with a lot of the scripting and ideas. Viddywell, thanks for your help. TommyT, your Android Utility inspired me to simplify things, Misfit, testing is always appreciated! Also, Virus. Always helping the community. Thanks brotha!
Sounds like we're thinking on similar wavelengths in terms of making things more easy and user friendly.
I am working on a wrapper to help with troubleshooting and running pre checks to assure any adb scripts will run properly here.
Interested in combining the two?
viddywell said:
Sounds like we're thinking on similar wavelengths in terms of making things more easy and user friendly.
I am working on a wrapper to help with troubleshooting and running pre checks to assure any adb scripts will run properly here.
Interested in combining the two?
Click to expand...
Click to collapse
sure
Plans are to expand this a lot more. Add decomplie/compile classes.dex, decompile/compile apks and jars, and sign non system jars, decompile systemui, framework-res, resources.apks and configure them to ur needs and recompile.
I am tired of using 4-5 different folders when one would surfice.
OMG man this is exactly what I've been wanting to see for the longest time...I'm not very familiar with ADB although I've been wanting to get to learn it for the longest time...thanks a bunfh man...much appreciated as always....
Sent from my PG86100 using Tapatalk
reverepats said:
OMG man this is exactly what I've been wanting to see for the longest time...I'm not very familiar with ADB although I've been wanting to get to learn it for the longest time...thanks a bunfh man...much appreciated as always....
Sent from my PG86100 using Tapatalk
Click to expand...
Click to collapse
+1 thanks Leo!
Nice write up as always Leo
Sent from the CM powered 3d
Leoisright said:
sure
Plans are to expand this a lot more. Add decomplie/compile classes.dex, decompile/compile apks and jars, and sign non system jars, decompile systemui, framework-res, resources.apks and configure them to ur needs and recompile.
I am tired of using 4-5 different folders when one would surfice.
Click to expand...
Click to collapse
Sounds good to me - I see a lot of wasted effort around troubleshooting and working through the basics that can be eliminated by building solid tools.
I've put our two works together. I renamed the file to adbtool.bat, you can change it to whatever you'd like but I'd steer you away from using the name "command" as it is also the same as the system variable for calling the cmd window on a machine.
You can test this by running the script with your device unplugged - that's the only time my portion should do anything. Otherwise it will jump right down to your section.
The .bat is attached and the code below:
Code:
@echo off
REM ========================================================================================================
REM PRE CHECK TEST SCRIPT WRITTEN BY VIDDYWELL (XDA)
REM FURTHER DETAILS AND FUTURE UPDATES AVAILABLE @ http://forum.xda-developers.com/showthread.php?t=1294880
REM ========================================================================================================
REM ====================== BEGIN PRE CHECK TEST SCRIPT ======================
:top
color f0
set reportrun=0
REM Check for HTC Sync
tasklist | findstr htcUPCTLoader >nul
If %errorlevel% equ 0 (set htcsync=1) ELSE (set htcsync=0)
REM Check for Easy Tether
tasklist | findstr easytthr >nul
If %errorlevel% equ 0 (set easyt=1) ELSE (set easyt=0)
REM Check for device connection
adb devices | findstr /r "device$" >nul
If %errorlevel% neq 0 goto devmis
REM Get device state (this can be used as an error checking variable later if necessary)
for /f %%a in ('adb get-state') do @set state=%%a
cls
Echo Device found! In %state% mode.
GOTO ADBCODE
REM ====================== ERROR HANDLING BELOW ======================
exit
:devmis
set sys=n
color 4f
CLS
Echo No device found - please check the following items:
Echo.
If %htcsync% equ 1 Echo - HTC Sync found - Please try disabling
If %easyt% equ 1 Echo - Easy Tether found - Please try disabling
Echo - Device is connected
Echo - USB Debugging is enabled
Echo.
Echo ------------------------------------------
Echo We can collect further information to assist with troubleshooting.
Echo This will query your system and generate a report with information
Echo about your computer. You will be given a chance to review and edit
Echo the collected information and share via copy/paste. No information
Echo will be shared without your consent.
Echo.
Set /p sys=Would you like to collect system information (y/n):
if /I %sys% equ y GOTO sysinfo
if /I %sys% equ yes sysinfo
goto tryagain
:tryagain
cls
echo.
If %reportrun% equ 1 (echo Text from window can be copied to forum for troubleshooting)
Echo Press any key to try running script again
Pause >nul
goto top
:sysinfo
Echo System information - Generated on %date% at %time% >report.txt
Echo ----------------------------------------------------- >>report.txt
echo ADB Version: >>report.txt
adb version >>report.txt
Echo. >>report.txt
echo Windows Version: >>report.txt
ver >>report.txt
Echo. >>report.txt
Echo Files in Directory of Script Execution >>report.txt
dir /b >>report.txt
Echo. >>report.txt
Echo Running Applications: >>report.txt
tasklist >>report.txt
Echo. >>report.txt
Echo Started Services: >>report.txt
sc query >>report.txt
start "" report.txt
set reportrun=1
goto tryagain
REM ====================== END PRE CHECK TEST SCRIPT ======================
REM ========================================================================================================
REM CODE BELOW THIS LINE WRITTEN BY LEOISRIGHT (XDA)
REM FURTHER DETAILS AND FUTURE UPDATES AVAILABLE @ http://forum.xda-developers.com/showthread.php?t=1297096
REM ========================================================================================================
:ADBCODE
setlocal enabledelayedexpansion
COLOR f0
mode con:cols=70 lines=34
setLocal EnableDelayedExpansion
cls
echo.
:restart
echo. **presented by Leoisright**
echo.
echo.
echo HELLO WHAT CAN I DO FOR YOU
echo.
echo.
ECHO 1 - CMD
echo.
ECHO 2 - Logcat
echo.
ECHO 3 - push system/folders
echo.
ECHO 4 - push data/app
echo.
ECHO 5 - Reboot to Recovery
echo.
ECHO 6 - Pull System from phone
echo.
set M=GARBAGE
SET /P M= Choose a Task then press ENTER:
IF %M%==1 GOTO CMD
IF %M%==2 GOTO LOGCAT
IF %M%==3 GOTO push
IF %M%==4 GOTO adb push data/app
IF %M%==5 GOTO RECOVERY
IF %M%==6 GOTO pull system
if %M%==7 GOTO Adb Shell
echo.
:CMD
start %windir%\system32\cmd.exe
cls
goto restart
echo.
echo.
:LOGCAT
start %windir%\system32\cmd.exe /k adb logcat
cls
goto restart
echo.
echo.
:push
start %windir%\system32\cmd.exe /k adb push push/system system/
cls
goto restart
echo.
echo.
cls
:adb push data/app
cd adb push
start %windir%\system32\cmd.exe /k adb push push/data/app data/app
cls
goto restart
echo.
echo.
cls
goto restart
:RECOVERY
cd TOOLS
adb reboot recovery
echo.
echo.
cls
:pull system
cd adb pull
start %windir%\system32\cmd.exe /k adb pull system xron/
cls
goto restart
echo.
echo.
cls
viddywell said:
Sounds good to me - I see a lot of wasted effort around troubleshooting and working through the basics that can be eliminated by building solid tools.
I've put our two works together. I renamed the file to adbtool.bat, you can change it to whatever you'd like but I'd steer you away from using the name "command" as it is also the same as the system variable for calling the cmd window on a machine.
You can test this by running the script with your device unplugged - that's the only time my portion should do anything. Otherwise it will jump right down to your section.
The .bat is attached and the code below:
Code:
@echo off
REM ========================================================================================================
REM PRE CHECK TEST SCRIPT WRITTEN BY VIDDYWELL (XDA)
REM FURTHER DETAILS AND FUTURE UPDATES AVAILABLE @ http://forum.xda-developers.com/showthread.php?t=1294880
REM ========================================================================================================
REM ====================== BEGIN PRE CHECK TEST SCRIPT ======================
:top
color f0
set reportrun=0
REM Check for HTC Sync
tasklist | findstr htcUPCTLoader >nul
If %errorlevel% equ 0 (set htcsync=1) ELSE (set htcsync=0)
REM Check for Easy Tether
tasklist | findstr easytthr >nul
If %errorlevel% equ 0 (set easyt=1) ELSE (set easyt=0)
REM Check for device connection
adb devices | findstr /r "device$" >nul
If %errorlevel% neq 0 goto devmis
REM Get device state (this can be used as an error checking variable later if necessary)
for /f %%a in ('adb get-state') do @set state=%%a
cls
Echo Device found! In %state% mode.
GOTO ADBCODE
REM ====================== ERROR HANDLING BELOW ======================
exit
:devmis
set sys=n
color 4f
CLS
Echo No device found - please check the following items:
Echo.
If %htcsync% equ 1 Echo - HTC Sync found - Please try disabling
If %easyt% equ 1 Echo - Easy Tether found - Please try disabling
Echo - Device is connected
Echo - USB Debugging is enabled
Echo.
Echo ------------------------------------------
Echo We can collect further information to assist with troubleshooting.
Echo This will query your system and generate a report with information
Echo about your computer. You will be given a chance to review and edit
Echo the collected information and share via copy/paste. No information
Echo will be shared without your consent.
Echo.
Set /p sys=Would you like to collect system information (y/n):
if /I %sys% equ y GOTO sysinfo
if /I %sys% equ yes sysinfo
goto tryagain
:tryagain
cls
echo.
If %reportrun% equ 1 (echo Text from window can be copied to forum for troubleshooting)
Echo Press any key to try running script again
Pause >nul
goto top
:sysinfo
Echo System information - Generated on %date% at %time% >report.txt
Echo ----------------------------------------------------- >>report.txt
echo ADB Version: >>report.txt
adb version >>report.txt
Echo. >>report.txt
echo Windows Version: >>report.txt
ver >>report.txt
Echo. >>report.txt
Echo Files in Directory of Script Execution >>report.txt
dir /b >>report.txt
Echo. >>report.txt
Echo Running Applications: >>report.txt
tasklist >>report.txt
Echo. >>report.txt
Echo Started Services: >>report.txt
sc query >>report.txt
start "" report.txt
set reportrun=1
goto tryagain
REM ====================== END PRE CHECK TEST SCRIPT ======================
REM ========================================================================================================
REM CODE BELOW THIS LINE WRITTEN BY LEOISRIGHT (XDA)
REM FURTHER DETAILS AND FUTURE UPDATES AVAILABLE @ http://forum.xda-developers.com/showthread.php?t=1297096
REM ========================================================================================================
:ADBCODE
setlocal enabledelayedexpansion
COLOR f0
mode con:cols=70 lines=34
setLocal EnableDelayedExpansion
cls
echo.
:restart
echo. **presented by Leoisright**
echo.
echo.
echo HELLO WHAT CAN I DO FOR YOU
echo.
echo.
ECHO 1 - CMD
echo.
ECHO 2 - Logcat
echo.
ECHO 3 - push system/folders
echo.
ECHO 4 - push data/app
echo.
ECHO 5 - Reboot to Recovery
echo.
ECHO 6 - Pull System from phone
echo.
set M=GARBAGE
SET /P M= Choose a Task then press ENTER:
IF %M%==1 GOTO CMD
IF %M%==2 GOTO LOGCAT
IF %M%==3 GOTO push
IF %M%==4 GOTO adb push data/app
IF %M%==5 GOTO RECOVERY
IF %M%==6 GOTO pull system
if %M%==7 GOTO Adb Shell
echo.
:CMD
start %windir%\system32\cmd.exe
cls
goto restart
echo.
echo.
:LOGCAT
start %windir%\system32\cmd.exe /k adb logcat
cls
goto restart
echo.
echo.
:push
start %windir%\system32\cmd.exe /k adb push push/system system/
cls
goto restart
echo.
echo.
cls
:adb push data/app
cd adb push
start %windir%\system32\cmd.exe /k adb push push/data/app data/app
cls
goto restart
echo.
echo.
cls
goto restart
:RECOVERY
cd TOOLS
adb reboot recovery
echo.
echo.
cls
:pull system
cd adb pull
start %windir%\system32\cmd.exe /k adb pull system xron/
cls
goto restart
echo.
echo.
cls
Click to expand...
Click to collapse
Good work Bro. Adbtool is much better. I set out to make a simple folder so I could push multiple libs/apps/bin for porting purposes. I will refine my scripts to be more Refined. While I've used lots of great bats, none are an all in one utility.
Tommytomatoe has a fantastic android utility for ubuntu and we need the same stuff for windows.
Let's keep building this. I will keep the OP updated
Sent from my PG86100 using Tapatalk
Hell yea nice, thanx
Sent from my PG86100 using XDA App
updated the thread more and have better adb .bat file for everyone. thanks
Good **** leo definitely gonna give this a shot
Sent from my PG86100 using Tapatalk
OP has been updated with more options and better description of the menu.
Leoisright said:
OP has been updated with more options and better description of the menu.
Click to expand...
Click to collapse
Thanks for the excellent contribution Leo, thanks chubbz!
Leo, your the best. This is Awesome!! Can't wait to be able to compile apks. Thanks for all you do for me and the rest of the community.
Tiffany84 said:
Leo, your the best. This is Awesome!! Can't wait to be able to compile apks. Thanks for all you do for me and the rest of the community.
Click to expand...
Click to collapse
we are very very close to compile right now. Also, we may have figured out a way to extract a zip to folder and zip it back up. will be nice to extract roms this way...mod, then zip back up
Leoisright said:
we are very very close to compile right now. Also, we may have figured out a way to extract a zip to folder and zip it back up. will be nice to extract roms this way...mod, then zip back up
Click to expand...
Click to collapse
WoW!! Just sounding better and better. Please, if you don't mind and can remember, keep me informed on your progress.
solver404 said:
Thanks for the excellent contribution Leo, thanks chubbz!
Click to expand...
Click to collapse
No prob just a little contibution for you guys. Enjoy
Looking good, this will help out so many people
Update. Will fill out OP more later but probaly will have another update before.. Enjoy.
Still a WIP but lots of stuff added.
Very nice tool. Keeps me from having to type adb commands out. Just one comment/suggestion:
Shouldn't the system be mounted before executing adb push(es)??

[Q] Building script help

Hi guys...
I'm a translator for MIUI, so i edit apks a lot.
To make things easier, i made this small tool, to help me automate things.. Something like Android Utility and APK Multitool..
But, i'm no programmer, i just got a lot of help from various places, ending up with this tool.
It's far from perfect, needs a lot of improvement and here's where xda comes in
The script is running more or less fine as it is, but it has some (serious?) issues i can't figure out how to fix..
It's a little tricky to explain, but here goes..
First, i press c to clean everything, the operation completes fine.
I press e. to extract apks from a rom zip, operation completes.
Then i install frameworks, operation completes..
BUT, if i now press 2 to decompile all, i get an error:
Code:
/home/dan/buildtool/functions.sh: line 44: no match: *jar
Invalid choice
#?
Thing is, if i quit the tool and restarts it, press2, then it runs fine... ( the *.jar error is expected, it's the "invalid choice" which is interesting..)
So, it has to be something in the menu function, in a loop somewhere, i don't know..
I was hoping someone could run through the script and perhaps catch the error.. I'm really hoping for a simple answer
Other than that, i could use some good inputs about how to improve the script, add functionality and develop it in general...
The script is on github:
https://github.com/1982Strand/buildtool
I don't think you have a looping problem.
Code:
[COLOR=Gray]1067[/COLOR] [[ -z $zip ]] && echo "Invalid choice" && continue
Looks like you explicitly want it to echo "Invalid choice"
I think the problem lies in line #53
Code:
for file in *.apk *jar; do
...you will receive an error if *jar doesn't exist.
You may want to split it up with an if/then...for, for both *.apk and *jar like so:
Code:
if [ -f *.apk ]; then
for file in *.apk; do
...
done
fi
if [ -f *jar ]; then
for file in *jar; do
...
done
fi
[Edit:] Also, you should be aware of this if you aren't already....You can debug your bash scripts with the -vx switch in your shabang statement like so:
Code:
#!/bin/bash -vx
okay, i tried changing line #53 as you said, but now i get another error:
Code:
/home/dan/buildtool/functions.sh: line 53: [: too many arguments
/home/dan/buildtool/functions.sh: line 64: no match: *jar
Invalid choice
#?
And with the -vx set in the shebang:
Code:
/home/dan/buildtool/functions.sh: line 53: [: too many arguments
/home/dan/buildtool/functions.sh: line 64: no match: *.jar
++ [[ -z '' ]]
++ echo 'Invalid choice'
Invalid choice
++ continue
#?
Before i changed the code, it was normal that i threw the error with the *.jars not found, but it's supposed to continue anyway..
As i said, if i quit the tool when the error came up, start the tool again and press 2, it works. (it still gives me the error with the *.jar not found, but that was normal)
I don't understand why it takes me back to the prompt as if i were about to extract the apks??
It seems to me it's because i'm still "in" the "e. extract apks from zip" - function...?? I must admit,i don't fully understand the code in that function, so i'm having a hard time troubleshooting it..
1982Strand said:
okay, i tried changing line #53 as you said, but now i get another error:
Code:
/home/dan/buildtool/functions.sh: line 53: [: too many arguments
/home/dan/buildtool/functions.sh: line 64: no match: *jar
Invalid choice
#?
And with the -vx set in the shebang:
Code:
/home/dan/buildtool/functions.sh: line 53: [: too many arguments
/home/dan/buildtool/functions.sh: line 64: no match: *.jar
++ [[ -z '' ]]
++ echo 'Invalid choice'
Invalid choice
++ continue
#?
Before i changed the code, it was normal that i threw the error with the *.jars not found, but it's supposed to continue anyway..
As i said, if i quit the tool when the error came up, start the tool again and press 2, it works. (it still gives me the error with the *.jar not found, but that was normal)
I don't understand why it takes me back to the prompt as if i were about to extract the apks??
It seems to me it's because i'm still "in" the "e. extract apks from zip" - function...?? I must admit,i don't fully understand the code in that function, so i'm having a hard time troubleshooting it..
Click to expand...
Click to collapse
Sorry, I forgot using an 'if' statement in that way would produce the "too many arguments" error. This is from '*.apk' having more than one match, so this is what I came up with:
Code:
cd $IN
if [ "$(ls -1 | grep '.\+\.apk$' | wc -l)" -gt 0 ]; then #if there are more than 0 results of *.apk...
for file in *.apk ; do
echo "Decompiling $file" 2>&1 | tee -a $LOG/decompile_log.txt
apktool -q d -f $file $DEC/$file
done
cp -f $HJEM/sort.py $DEC
cd $DEC
python sort.py
rm -r sort.py
fi
if [ "$(ls -1 | grep '.\+\jar$' | wc -l)" -gt 0 ]; then #if there are more than 0 results of *jar...
for file in *jar; do
echo "Decompiling $file" 2>&1 | tee -a $LOG/decompile_log.txt
apktool -q d -f $file $DEC/$file
done
fi
After running options 'e' & 'c', then running option 2, there is no error and the script runs as it should (That is, assuming you chose option 2 of 'c' - "Clean all but apks in apk_in folder". Chosing option 1 of 'c' will obviously result in an error because no .apk or jar files will exist to decompile).
The reason you keep getting the "Invalid choice" error is because you're explicitly asking for it.
With the line #1067 mention earlier and others similar to it like the example below:
Code:
[COLOR=Gray]914[/COLOR] [[ -z $file ]] && echo "Invalid choice" && continue
When the variable string for '$file' has a zero length, as would be the case if '*jar' doesn't exist, the script will echo "Invalid choice". My example above ensures that the '$file' variable string will not have a zero length.
My suggestion would be to change "Invalid choice" to something more specific to the function for which it is being used, that way you can get a better idea of the source of your error.
As far as why you would get that error only after choosing options 'e' & 'c' and not after restarting the script, I couldn't say for sure without digging into it a little more, but at least this fixes your original problem.
I hope that helps.
Wow! That did the trick for option 2!!
But then it returns when i continue and get to option 4 "Fix sources":
Code:
[--- Fix MIUI sources ---]
...Fixing framework-miui-res.apk
patching file /home/dan/buildtool/apk_in/decompiled/framework-miui-res.apk/apktool.yml
/home/dan/buildtool/functions.sh: line 132: no match: *.rej
Invalid choice
#?
The point here is, that sometimes the patching fails and patch will generate some files (*.rej and *.orig) that needs to be deleted. But often, like most of the time really, the patching succeeds, so these files are not generated and my simple "remove" commands fail, obviously..
So, i'm guessing here that i get this zero-length issue and my script returns me to this code...
Well, this brings us back to
Code:
[[ -z $file ]] && echo "Invalid choice" && continue
From the "e" option..
This seems to be it.. I'm not entirely sure about what the code exactly means, except the "invalid choice" and continue..
The point with the option "e. Extract apks from zip", is that the user gets a list of zip files contained in the source_rom folder, then choose one.
Then a set of apks (defined in translation_list.txt) must be extracted to apk_in.
The function should simply give the options to choose a zip, x to return to the main menu, or write "invalid choice" if wrong key is entered...
But something seems broken in code, i just can't figure out what and where...
Btw, the code itself is from stackoverflow.com, so i didn't write it myself like that, i just used it for my script as it seemed to do what i needed, but i guess it needs some adjustment still
Okay, in the previous example, you had a 'for' loop that was written like this...
Code:
for file in *.apk *jar; do
this
and that
done
...which is saying, For every file (one at a time) in the current directory that matches the patterns *.apk and *jar, assign that filename to the variable '$file', then do..."this and that" while plugging in the value of '$file' for that particular iteration of the loop to the set of commands represented by "this and that". If for some reason, say, no files match the pattern *jar, then for each iteration of the loop regarding that pattern, $file will be equal to ' ' instead of something like 'filename.jar'. That is a variable string length of 0.
Code:
[[ -z $file ]] && echo "Invalid choice" && continue
...what that is, is a test to see if the string (or in this case filename) represented by '$file' has a zero length as with the example above where there were no jar files to assign to the variable '$file'. Similarly, it would most likely be the case with option 4 when there is no match for '*.rej' & '*.orig'.
In my example:
Code:
if [ "$(ls -1 | grep '.\+\.apk$' | wc -l)" -gt 0 ]; then
...I'm testing to see if the output of the command 'ls -1 | grep '.\+\.apk$' | wc -l' is greater than 0, before continuing with the 'for' loop.
The 'ls -1'command lists the contents of the current directory to one column, instead of the typical two or more. The 'wc -l' counts the number of lines in the resulting output. And grep '.\+\.apk$' is a regular expression that makes sure the resulting output only contains filenames that end in '.apk'. So if there are files that end in .apk, then the output of the command 'ls -1 | grep '.\+\.apk$' | wc -l' would be greater than 0, and the same would hold true for jar files. I'm sure there's a more elegant way of doing it, but it works.
Side note: Regular Expressions are powerful pattern matching tools that you definitely need to learn if you want to get the most our of your shell scripts. Google "regexp" or "Bash regexp" to learn more. It can be very confusing to understand at first, but once you get the hang of it, it is really pretty easy.
Anyway, getting back on track...
After running option 2 to decompile, then running option 4 to fix MIUI sources, everything runs fine...even with, or without '*.rej' & '*.orig'. I'll use the following debug as an example:
Code:
+ echo '...Fixing framework-miui-res.apk'
...Fixing framework-miui-res.apk
+ echo ''
+ patch -i /home/soup/buildtool/src_fix/framework-miui-res/apktool.diff /home/soup/buildtool/apk_in/decompiled/framework-miui-res.apk/apktool.yml
patching file /home/soup/buildtool/apk_in/decompiled/framework-miui-res.apk/apktool.yml
+ cd /home/soup/buildtool/apk_in/decompiled/framework-miui-res.apk/
[COLOR=Red]# notice there are no files that match '*.rej' or '*.orig' [/COLOR]
+ rm -f -r '*.rej'
+ rm -f -r '*.orig'
[COLOR=Red]# and there are no errors as a result of it[/COLOR]
+ echo ''
+ echo '...Fixing MiuiCompass.apk'
...Fixing MiuiCompass.apk
+ echo ''
+ patch -i /home/soup/buildtool/src_fix/MiuiCompass/apktool.diff /home/soup/buildtool/apk_in/decompiled/MiuiCompass.apk/apktool.yml
patching file /home/soup/buildtool/apk_in/decompiled/MiuiCompass.apk/apktool.yml
Hunk #1 FAILED at 4.
1 out of 1 hunk FAILED -- saving rejects to file /home/soup/buildtool/apk_in/decompiled/MiuiCompass.apk/apktool.yml.rej
[COLOR=Red]# here, there is now a match available for 'apktool.yml.rej' but not 'apktool.yml.orig'[/COLOR]
+ cd /home/soup/buildtool/apk_in/decompiled/MiuiCompass.apk/
+ rm -f -r apktool.yml.rej
+ rm -f -r apktool.yml.orig
[COLOR=Red]# still no error[/COLOR]
+ echo ''
...so I wouldn't know what to tell you without being able to recreate it on my end.
It may be helpful to give your variables $file and $zip in those functions a non-zero value after they are run to make sure there isn't any zero length hangover from a previous option, like so...
Code:
pull () {
shopt -s failglob
echo "[--- Choose rom zip to extract from, or x to exit ---]"
echo ""
echo ""
select zip in $SRC/*.zip
do
[[ $REPLY == x ]] && . $HJEM/build
[[ -z $zip ]] && echo "Invalid choice" && continue
echo
for apk in $(<$HJEM/translation_list.txt); do
unzip -j -o -q $zip system/app/$apk -d $IN 2&>1 > /dev/null;
done
unzip -j -o -q $zip system/framework/framework-res.apk -d $IN 2&>1 > /dev/null;
unzip -j -o -q $zip system/framework/framework-miui-res.apk -d $IN 2&>1 > /dev/null;
done
zip=dummy [COLOR=Red]<-- after the script is run, assign the string 'dummy' to $zip[/COLOR]
}
soupmagnet said:
In my example:
Code:
if [ "$(ls -1 | grep '.\+\.apk$' | wc -l)" -gt 0 ]; then
...I'm testing to see if the output of the command 'ls -1 | grep '.\+\.apk$' | wc -l' is greater than 0, before continuing with the 'for' loop.
The 'ls -1'command lists the contents of the current directory to one column, instead of the typical two or more. The 'wc -l' counts the number of lines in the resulting output. And grep '.\+\.apk$' is a regular expression that makes sure the resulting output only contains filenames that end in '.apk'. So if there are files that end in .apk, then the output of the command 'ls -1 | grep '.\+\.apk$' | wc -l' would be greater than 0, and the same would hold true for jar files. I'm sure there's a more elegant way of doing it, but it works.
Side note: Regular Expressions are powerful pattern matching tools that you definitely need to learn if you want to get the most our of your shell scripts. Google "regexp" or "Bash regexp" to learn more. It can be very confusing to understand at first, but once you get the hang of it, it is really pretty easy.
Click to expand...
Click to collapse
Really good stuff! Learning a lot from this, thanks! I'll dig into regular expressions right away
Anyways, i think i got around the missing *.rej and *.orig by approaching the operation with SED instead of PATCH..
First of all, it makes my code shorter and i don't need an external .diff file for the operation to succeed. (Given that i write the SED code correctly of course..)
It may be helpful to give your variables $file and $zip in those functions a non-zero value after they are run to make sure there isn't any zero length hangover from a previous option, like so...
Code:
pull () {
shopt -s failglob
echo "[--- Choose rom zip to extract from, or x to exit ---]"
echo ""
echo ""
select zip in $SRC/*.zip
do
[[ $REPLY == x ]] && . $HJEM/build
[[ -z $zip ]] && echo "Invalid choice" && continue
echo
for apk in $(<$HJEM/translation_list.txt); do
unzip -j -o -q $zip system/app/$apk -d $IN 2&>1 > /dev/null;
done
unzip -j -o -q $zip system/framework/framework-res.apk -d $IN 2&>1 > /dev/null;
unzip -j -o -q $zip system/framework/framework-miui-res.apk -d $IN 2&>1 > /dev/null;
done
zip=dummy [COLOR=Red]<-- after the script is run, assign the string 'dummy' to $zip[/COLOR]
}
Click to expand...
Click to collapse
Added the code
For now, the script runs through all options fine without halting. Great! But i still need to test it more thoroughly.
Now, i will look into refining the script. Especially the "5. mods" and "10. build flashable zip".
Here's how i'd like it to operate:
When option 4 is processed, i'd like to be able to add some modding to the files. I think it's better to do this before recompiling (option 6/12) because if an apk needs to be edited, it's already decompiled.
For the 3way reboot, it needs to modify some jars. I'd like the user to choose which zip from the source_roms folder to work with and extract the version number the zip filename. (The filename will ALWAYS contain a version number..) So that when the jars are processed, the output files will be placed in a folder with the version number (like /out/"version") This is because, when i want to build my flashable zip, i want the user to input which version number to build it for and then it would pull whatever mods are made for this version number. (Because the entire ROM would probably break if those version numbers don't match)
For the crt-off effect, it should do the same, but it has to check wether a jar file is already existing in /out/"version" and modify that one if it is. (Both mods need to modify the same file)
Right now, i have extra options for OFFICIAL roms. The mods are exactly the same, only the file naming in the function are different. I'd like to eliminate those options, by having the user choose what file to process, like i explain in the above..
Guess that gets a little complicated, hope you get what i mean.. It'll take some time to re-write my functions and the code, but eventually, i'll get there!
Ok, so I got it working, with the creation of the folder from the filename. Cool, one step further, I'll continue development tonight or tomorrow
Ok, next problem
In the following function, i want the script to check, if any apks exist in the folder. If yes, present the menu to choose which one to decompile. If no, display an error message and return to the main menu.
But something is up with the LS command, no matter if there are files or not in the folder, it returns the message "no files found"..
Having trouble figuring this one out..
Code:
decompile_single () {
shopt -s failglob
echo "[--- Choose apk number, or x to exit ---]"
echo ""
echo ""
cd $IN
if [ "$(ls -A $IN)" ]; then
echo ""
echo "No files found.."
echo ""
else
select file in *.apk
do
cat /dev/null > $LOG/decompile_log.txt
[[ $REPLY == x ]] && . $HJEM/build
[[ -z $file ]] && echo "Invalid choice for single decompiling" && continue
echo
echo "Decompiling $file" 2>&1 | tee -a $LOG/decompile_log.txt
apktool d -f "$file" $DEC/$file
cp -f $HJEM/sort.py $DEC/$file
python $DEC/$file/sort.py
rm -r $DEC/$file/sort.py
break
done
fi
}
Any ideas?
Okay...
The output of the command "ls -A $IN" exits with 0 if successful, otherwise it exits with 1. A good way to look at 'if' constructs is...(if "0" (goto)-> then.....if "anything else" (goto)-> else). If you're unsure of what the exit status of a command is, you can enter it in the terminal while piping it into the "echo $?" command. "$?" is a bash variable that represents the exit code of the previous command only.
For your example, you can test the exit status of that command like so...
Code:
ls -A ~/buildtool/apk_in | echo $?
Since the exit status is 0, then your output will be "No files found.." But here's where it gets tricky...The exit status of the 'ls' command will always be 0 unless the directory just cannot be accessed, which is why you will always get the same output..."No files found..". You can find out more about the exit status of a command by visiting its man page (man ls).
To get around this, you need to write the command in such a way that will give you an exit status of anything other than 0 if the condition is not met. Since you only want to check for the existence of ".apk" files you could expand on the command using a regular expression and the 'wc' command, like with my previous example...
Code:
if [ "$(ls -A $IN | grep '.\+\.apk$' | wc -l)" -eq 0 ]; then
echo ""
echo 'No ".apk" files found..'
echo ""
else
...
soupmagnet said:
Okay...
The output of the command "ls -A $IN" exits with 0 if successful, otherwise it exits with 1. A good way to look at 'if' constructs is...(if "0" (goto)-> then.....if "anything else" (goto)-> else). If you're unsure of what the exit status of a command is, you can enter it in the terminal while piping it into the "echo $?" command. "$?" is a bash variable that represents the exit code of the previous command only.
For your example, you can test the exit status of that command like so...
Code:
ls -A ~/buildtool/apk_in | echo $?
Since the exit status is 0, then your output will be "No files found.." But here's where it gets tricky...The exit status of the 'ls' command will always be 0 unless the directory just cannot be accessed, which is why you will always get the same output..."No files found..". You can find out more about the exit status of a command by visiting its man page (man ls).
To get around this, you need to write the command in such a way that will give you an exit status of anything other than 0 if the condition is not met. Since you only want to check for the existence of ".apk" files you could expand on the command using a regular expression and the 'wc' command, like with my previous example...
Code:
if [ "$(ls -A $IN | grep '.\+\.apk$' | wc -l)" -eq 0 ]; then
echo ""
echo 'No ".apk" files found..'
echo ""
else
...
Click to expand...
Click to collapse
Yes, thankyou!! Again, learning new stuff..
I just added your earlier code to this function.. Of course, it works like a charm! Facepalm on me! Hehe!
Been reading page after page about regular erxpressions, tests and all kinds of commands this weekend, i kinda stares blind at my code sometimes, haha!
1982Strand said:
Yes, thankyou!! Again, learning new stuff..
I just added your earlier code to this function.. Of course, it works like a charm! Facepalm on me! Hehe!
Been reading page after page about regular erxpressions, tests and all kinds of commands this weekend, i kinda stares blind at my code sometimes, haha!
Click to expand...
Click to collapse
I would say, the things you need to be comfortable with are (in order of importance IMO)...
man pages
exit statuses
debugging
regular expressions
pipes
data manipulation
loops
conditions
everything else
soupmagnet said:
I would say, the things you need to be comfortable with are (in order of importance IMO)...
man pages
exit statuses
debugging
regular expressions
pipes
data manipulation
loops
conditions
everything else
Click to expand...
Click to collapse
Got some more reading ahead of me
Anyways, i think the script is pretty good now, it suits my needs so far and most of the errors are taken care of..
I can always improve the code, so i'll probably continue developing on this.. Also because it's not perfect at all and still got some flaws here and there...

[TOOL][WIN]Take screenshots of Aroma and Recovery v1.1

This is a tool to capture screenshots while in Recovery or the Aroma Installer.
Support has ended, due to the possibility of pixel formats changing from each recovery update you receive.
But I did make a better Recovery Screenshot that handles this problem, and it can be found here or below.:cyclops:
http://forum.xda-developers.com/showthread.php?p=50029759​
It's no big secret around XDA that you can use the program FFmpeg to convert your raw framebuffer file into a normal image file. I've found the values for the Nexus 5 and made a batch script that incorporates the programs adb, and ffmpeg; to save screenshots to your computer. I don't have a Nexus 5, but thanks to an XDA user, @ikslawlok, who posted his raw framebuffer from TWRP 2.6.3.4 on another website, I was able to get it working. Also thanks to @rootSU for testing in Philz, a CWM based recovery. This should work on all versions of Windows. I have only tested in Windows 7 personally. The process, as far as using ffmpeg and adb, used here is also possible in Linux. Some versions of ffmpeg for Linux are antiquated, hence there isn't really a write one script; work for all.
Why would anyone use this or do this?
Most people, that probably includes you reading this, have actually no use for it, nor can you think of a reason too. The uses of this are limited to people that write tutorials, custom recovery themes, and the rare event that you have an anomaly in your recovery and you can't describe it.
I owe a big thanks to @Whiskey103 with his work in this thread over in the HTC One forum. :good:
You have to have the adb drivers installed before you can do anything. Go here for more information.
This rar file contains the programs adb and ffmpeg. This 32-bit version of ffmpeg is one of the newest versions available on their downloads page. You must have adb.exe, ffmpeg.exe, and the two dll files for adb in the same directory as the batch file. The easiest thing to do is just extract the rar to a new directory, then run the file named "RUNrsn511.bat" The screenshots you capture will be saved in the same folder that you unzipped everything in as 'timestamp'.png
Thank you @weihan1102 for helping me test and providing your framebuffer from the modified version of TWRP for multirom!
Download Recovery Screenshot v1.1
If you have already downloaded the original version, and wish to update with support for the modified twrp for multirom without downloading the whole new rar, then hit the button below.
The only difference is the RUNrs.bat batch script. You may wish to just download the new batch file here, it is only 1.7KB zipped. It is RUNrsn511.rar and can just be unzipped into the folder you originally unzipped the other files into. I would then delete the original batch file.
An easier way, I think, is to click show content below and click anywhere in the box. Hit Ctrl+A to select everything, hit Ctrl+C to copy it to the clipboard. Then right click on your original RUNrs.bat file, and select edit. Click in that screen anywhere, hit Ctrl+A to select everything in there, then Ctrl+V to paste the new batch script into RUNrs.bat.
Code:
@ECHO OFF
CLS
TITLE Recovery Screenshot v1.1
MODE CON:COLS=54 LINES=40
COLOR 0B
SET TS=0
SET "ffshowb=-hide_banner"
SET "ffdebug=-loglevel fatal"
IF "%~1"=="-d" (
REM @ECHO ON
SET "ffdebug=-loglevel debug"
SET "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO __________________________________________________________________
ECHO DEBUG INFO
ECHO __________________________________________________________________
)
:START
ECHO[
ECHO ______________________________________________________
ECHO This will pull a screenshot from your Nexus 5 and
ECHO save it to the directory that you ran this bat
ECHO file in. Connect USB ^& reboot into your recovery.
ECHO ______________________________________________________
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO ______________________________________________________
IF NOT EXIST ffmpeg.exe GOTO NOFILES
IF NOT EXIST adb.exe GOTO NOFILES
ADB kill-server -d >nul 2>&1
IF %TS%=="NOGOOD" GOTO SKIPPEDthatPause
ECHO Press 1 or 2
ECHO 1 - Save a screenshot using multirom twrp recovery
ECHO 2 - Save a screenshot using other recoveries
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 SET "pixfmt=-pix_fmt rgb565"
IF %K%==2 SET "pixfmt=-pix_fmt rgb0"
:SKIPPEDthatPause
ECHO[
ECHO Pulling framebuffer from /dev/graphics/fb0
adb pull /dev/graphics/fb0 frmbfr >nul
IF ERRORLEVEL 1 (cls
SET TS="NOGOOD"
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your N5 from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO START
)
SET TS=%DATE:/=%_%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo %pixfmt% -s 1088x1920 -i frmbfr -vf crop=1080:1920:0:0 -y %TS%
IF NOT EXIST %TS% GOTO ERRNE
DEL frmbfr >nul
ECHO ______________________________________________________
ECHO Screenshot saved as %TS%
ECHO ______________________________________________________
ECHO Press 1 or 2
ECHO 1 - Save another screenshot
ECHO 2 - Exit
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SKIPPEDthatPause
IF %K%==2 GOTO FINISH
:NOFILES
CLS
ECHO The directory that you are running this script in is:
ECHO %~dp0
ECHO[
ECHO You must run this script in the same directory as
ECHO adb.exe and ffmpeg.exe. Press any key to exit
PAUSE >nul
EXIT
:ERRNE
CLS
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG -loglevel debug -f rawvideo -vcodec rawvideo %pixfmt% -s 1088x1920 -i frmbfr -vf crop=1080:1920:0:0 -y %TS%
ECHO ____________________________________________________________________________________________________________
ECHO There was a problem converting the framebuffer to a png file.
ECHO[
ECHO To capture the screen of the cmd window, hold down the alt key and press PrtSc on your keyboard. This
ECHO will save an image of the current window in memory on your clipboard. Then open paint or photoshop or
ECHO whatever program you use and hit ctrl+N to open a new file, then ctrl+V to paste an image. Save it and
ECHO please message me it or post in the XDA forum thread.
ECHO[
ECHO[
ECHO If you got to this screen and are not using a Nexus 5, congratulations for successfully pulling the
ECHO framebuffer. To figure out the resolution to use, try adding 4,8, or 16 to your native width to make it
ECHO evenly divisible by 32. Example resolution is 1080x1920..1080^/32^=33.75 ^< not right, so try 1088^/32^=34 ^< good
ECHO Only worry about width (left to right), height is stored orderly in memory.
ECHO[
ECHO To see a list of all of the pix_fmts supported by ffmpeg, run ffmpeg -pix_fmts
ECHO[
ECHO Press 1 or 2
ECHO 1 - Show available pixel formats
ECHO 2 - Exit
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 (cls
MODE CON:COLS=52 LINES=200
ffmpeg -hide_banner -pix_fmts
pause
GOTO FINISH)
IF %K%==2 GOTO FINISH
:FINISH
ADB kill-server -d
EXIT
I have more screenshots at my 2013 Nexus 7 thread.
Batch script v1.1
Code:
@ECHO OFF
CLS
TITLE Recovery Screenshot v1.1
MODE CON:COLS=54 LINES=40
COLOR 0B
SET TS=0
SET "ffshowb=-hide_banner"
SET "ffdebug=-loglevel fatal"
IF "%~1"=="-d" (
REM @ECHO ON
SET "ffdebug=-loglevel debug"
SET "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO __________________________________________________________________
ECHO DEBUG INFO
ECHO __________________________________________________________________
)
:START
ECHO[
ECHO ______________________________________________________
ECHO This will pull a screenshot from your Nexus 5 and
ECHO save it to the directory that you ran this bat
ECHO file in. Connect USB ^& reboot into your recovery.
ECHO ______________________________________________________
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO ______________________________________________________
IF NOT EXIST ffmpeg.exe GOTO NOFILES
IF NOT EXIST adb.exe GOTO NOFILES
ADB kill-server -d >nul 2>&1
IF %TS%=="NOGOOD" GOTO SKIPPEDthatPause
ECHO Press 1 or 2
ECHO 1 - Save a screenshot using multirom twrp recovery
ECHO 2 - Save a screenshot using other recoveries
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 SET "pixfmt=-pix_fmt rgb565"
IF %K%==2 SET "pixfmt=-pix_fmt rgb0"
:SKIPPEDthatPause
ECHO[
ECHO Pulling framebuffer from /dev/graphics/fb0
adb pull /dev/graphics/fb0 frmbfr >nul
IF ERRORLEVEL 1 (cls
SET TS="NOGOOD"
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your N5 from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO START
)
SET TS=%DATE:/=%_%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo %pixfmt% -s 1088x1920 -i frmbfr -vf crop=1080:1920:0:0 -y %TS%
IF NOT EXIST %TS% GOTO ERRNE
DEL frmbfr >nul
ECHO ______________________________________________________
ECHO Screenshot saved as %TS%
ECHO ______________________________________________________
ECHO Press 1 or 2
ECHO 1 - Save another screenshot
ECHO 2 - Exit
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SKIPPEDthatPause
IF %K%==2 GOTO FINISH
:NOFILES
CLS
ECHO The directory that you are running this script in is:
ECHO %~dp0
ECHO[
ECHO You must run this script in the same directory as
ECHO adb.exe and ffmpeg.exe. Press any key to exit
PAUSE >nul
EXIT
:ERRNE
CLS
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG -loglevel debug -f rawvideo -vcodec rawvideo %pixfmt% -s 1088x1920 -i frmbfr -vf crop=1080:1920:0:0 -y %TS%
ECHO ____________________________________________________________________________________________________________
ECHO There was a problem converting the framebuffer to a png file.
ECHO[
ECHO To capture the screen of the cmd window, hold down the alt key and press PrtSc on your keyboard. This
ECHO will save an image of the current window in memory on your clipboard. Then open paint or photoshop or
ECHO whatever program you use and hit ctrl+N to open a new file, then ctrl+V to paste an image. Save it and
ECHO please message me it or post in the XDA forum thread.
ECHO[
ECHO[
ECHO If you got to this screen and are not using a Nexus 5, congratulations for successfully pulling the
ECHO framebuffer. To figure out the resolution to use, try adding 4,8, or 16 to your native width to make it
ECHO evenly divisible by 32. Example resolution is 1080x1920..1080^/32^=33.75 ^< not right, so try 1088^/32^=34 ^< good
ECHO Only worry about width (left to right), height is stored orderly in memory.
ECHO[
ECHO To see a list of all of the pix_fmts supported by ffmpeg, run ffmpeg -pix_fmts
ECHO[
ECHO Press 1 or 2
ECHO 1 - Show available pixel formats
ECHO 2 - Exit
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 (cls
MODE CON:COLS=52 LINES=200
ffmpeg -hide_banner -pix_fmts
pause
GOTO FINISH)
IF %K%==2 GOTO FINISH
:FINISH
ADB kill-server -d
EXIT
Batch script v1
Code:
@ECHO OFF
CLS
TITLE Recovery Screenshot
MODE CON:COLS=54 LINES=40
COLOR 0B
SET TS=0
SET "ffshowb=-hide_banner"
SET "ffdebug=-loglevel fatal"
IF "%~1"=="-d" (
REM @ECHO ON
SET "ffdebug=-loglevel debug"
SET "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO __________________________________________________________________
ECHO DEBUG INFO
ECHO __________________________________________________________________
)
:START
ECHO[
ECHO ______________________________________________________
ECHO This will pull a screenshot from your Nexus 5 and
ECHO save it to the directory that you ran this bat
ECHO file in. Connect USB ^& reboot into your recovery.
ECHO ______________________________________________________
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO ______________________________________________________
IF NOT EXIST ffmpeg.exe GOTO NOFILES
IF NOT EXIST adb.exe GOTO NOFILES
ADB kill-server -d >nul 2>&1
IF %TS%=="NOGOOD" GOTO SKIPPEDthatPause
ECHO Press any key when you are ready.
PAUSE >nul
:SKIPPEDthatPause
ECHO[
ECHO Pulling framebuffer from /dev/graphics/fb0
adb pull /dev/graphics/fb0 frmbfr >nul
IF ERRORLEVEL 1 (cls
SET TS="NOGOOD"
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your N5 from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO START
)
SET TS=%DATE:/=%_%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo -pix_fmt rgb0 -s 1088x1920 -i frmbfr -vf crop=1080:1920:0:0 -y %TS%
IF NOT EXIST %TS% GOTO ERRNE
DEL frmbfr >nul
ECHO ______________________________________________________
ECHO Screenshot saved as %TS%
ECHO ______________________________________________________
ECHO Press 1 or 2
ECHO 1 - Save another screenshot
ECHO 2 - Exit
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SKIPPEDthatPause
IF %K%==2 GOTO FINISH
:NOFILES
CLS
ECHO The directory that you are running this script in is:
ECHO %~dp0
ECHO[
ECHO You must run this script in the same directory as
ECHO adb.exe and ffmpeg.exe. Press any key to exit
PAUSE >nul
EXIT
:ERRNE
CLS
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG -loglevel debug -f rawvideo -vcodec rawvideo -pix_fmt rgb0 -s 1088x1920 -i frmbfr -vf crop=1080:1920:0:0 -y %TS%
ECHO ____________________________________________________________________________________________________________
ECHO There was a problem converting the framebuffer to a png file.
ECHO[
ECHO To capture the screen of the cmd window, hold down the alt key and press PrtSc on your keyboard. This
ECHO will save an image of the current window in memory on your clipboard. Then open paint or photoshop or
ECHO whatever program you use and hit ctrl+N to open a new file, then ctrl+V to paste an image. Save it and
ECHO please message me it or post in the XDA forum thread.
ECHO[
ECHO[
ECHO If you got to this screen and are not using a Nexus 5, congratulations for successfully pulling the
ECHO framebuffer. To figure out the resolution to use, try adding 4,8,16, or 32 to your native width to make
ECHO room for the extra data, ioctrls?, at the end of each pixel row. Experiment with different pixel formats
ECHO also.
ECHO[
ECHO To see a list of all of the pix_fmts supported by ffmpeg, run ffmpeg -pix_fmts
ECHO[
ECHO Press 1 or 2
ECHO 1 - Show available pixel formats
ECHO 2 - Exit
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 (cls
MODE CON:COLS=52 LINES=200
ffmpeg -hide_banner -pix_fmts
pause
GOTO FINISH)
IF %K%==2 GOTO FINISH
:FINISH
ADB kill-server -d
EXIT
Great! It worked!
I've just test it on my Nexus5.
Thanks!
Thanks! but seems like the color isn't correct and it content 4 screenshot in a single png file.
weihan1102 said:
Thanks! but seems like the color isn't correct and it content 4 screenshot in a single png file.
Click to expand...
Click to collapse
It looks like the multirom twrp uses a different kernel.
Can you do me a favor and substitute '-pix_fmt rgb0' with '-pix_fmt rgba' in the batch file?
To edit the batch file just right click it and choose edit. Find the lines, there's two of them, that start with ffmpeg..... and replace the part above. Save it and try again.
makers_mark said:
It looks like the multirom twrp uses a different kernel.
Can you do me a favor and substitute '-pix_fmt rgb0' with '-pix_fmt rgba' in the batch file?
To edit the batch file just right click it and choose edit. Find the lines, there's two of them, that start with ffmpeg..... and replace the part above. Save it and try again.
Click to expand...
Click to collapse
No, the color change but still not the correct color
weihan1102 said:
No, the color change but still not the correct color
Click to expand...
Click to collapse
Can you change the pix_fmt to bgra? I could figure it out later if you could upload your framebuffer file later, I won't be able to be around a computer for about 11 or 12 hours from now.
To save the framebuffer to your computer : shift + right click on the folder adb and other files are in, and select run cmd here. In the command window type 'adb pull /dev/graphics/fb0 rawfb0.raw'. The file rawfb0.raw will be in that same folder now.
makers_mark said:
Can you change the pix_fmt to bgra? I could figure it out later if you could upload your framebuffer file later, I won't be able to be around a computer for about 11 or 12 hours from now.
To save the framebuffer to your computer : shift + right click on the folder adb and other files are in, and select run cmd here. In the command window type 'adb pull /dev/graphics/fb0 rawfb0.raw'. The file rawfb0.raw will be in that same folder now.
Click to expand...
Click to collapse
bgra didn't work.
and the rawfb0.raw, here you are
https://drive.google.com/file/d/0B5FN-6JxBhASempFLTFUSDlkX3c/edit?usp=sharing
weihan1102 said:
bgra didn't work.
and the rawfb0.raw, here you are
https://drive.google.com/file/d/0B5FN-6JxBhASempFLTFUSDlkX3c/edit?usp=sharing
Click to expand...
Click to collapse
Thank you so much! I will fix it when I get home.

[Script] Lighthouse led script

Since this section is almost becoming a true fossil, buried somewhere in the Sahara dessert, I decide to share just another shell script I made which is for Android.
I call it the "lighthouse" script
Flashbang eye hurt script
, because basically what it does is looping the brightness value of your camera LED, up and down continuously. and it looks kinda like the effect that you get from a lighthouse.
It pulses the led on and off on chosen speed (defined by intervalValue and pauseValue).
IT can be used for example for using it as a way to signal people in an emergency or so
it is probably the best to use it to annoy your friends with it or check out the awesome effect of Tapetum lucidum, make sure to keep a fair distance
Be warned, it may really hurt your eyes and causes temporary blind spots in your vision very rapidly (on long term this will damage your eyes without question)
I am not responsible for any punches or bite marks that you received, nor the eye hurt you caused with this script
Instructions:
1. Copy script to PC and adjust values if needed
2. Push script to phone in an ext4 partition, for example "adb push lighthouse /system/bin/"
3. Set chmod 755 "adb shell chmod 755 /system/bin/lighthouse"
4. Open terminal emulator and type "lighthouse" to run the script
4. Open terminal emulator and type "lighthouse", don't press enter yet
5. Find a suitable target, human or animal with Tapetum lucidum eyes for example. Use script at night for full performance
6. Now run the script and profit (be sure to dodge the counter attack caused by target)
Script
Code:
#!/system/bin/sh
# Lighthouse script
# by broodplank
export max=`cat /sys/class/leds/torch-sec1/max_brightness`;
export intervalValue="0.03"
export pauseValue="0.5"
while [ 1 ]
trap '{ echo "Interrupted, resetting led"; echo 0 > /sys/class/leds/torch-sec1/brightness ; exit 1; }' INT
do
for i in `seq 0 $max`;
do
echo $i > /sys/class/leds/torch-sec1/brightness
sleep $intervalValue
done
sleep $pauseValue
for o in `seq $max -1 0`;
do
echo $o > /sys/class/leds/torch-sec1/brightness
sleep $intervalValue
done
sleep $pauseValue
done
Oh and believe me, you will regret you tested it on your self if you are in a dark room. true story
Use this script responsibly (if possible) :silly:
not sure if troll or real.. it is a script for developers, just has a nasty outcome
broodplank1337 said:
Since this section is almost becoming a true fossil, buried somewhere in the Sahara dessert, I decide to share just another shell script I made which is for Android.
I call it the "lighthouse" script
Flashbang eye hurt script
, because basically what it does is looping the brightness value of your camera LED, up and down continuously. and it looks kinda like the effect that you get from a lighthouse.
It pulses the led on and off on chosen speed (defined by intervalValue and pauseValue).
IT can be used for example for using it as a way to signal people in an emergency or so
it is probably the best to use it to annoy your friends with it or check out the awesome effect of Tapetum lucidum, make sure to keep a fair distance
Be warned, it may really hurt your eyes and causes temporary blind spots in your vision very rapidly (on long term this will damage your eyes without question)
I am not responsible for any punches or bite marks that you received, nor the eye hurt you caused with this script
Instructions:
1. Copy script to PC and adjust values if needed
2. Push script to phone in an ext4 partition, for example "adb push lighthouse /system/bin/"
3. Set chmod 755 "adb shell chmod 755 /system/bin/lighthouse"
4. Open terminal emulator and type "lighthouse" to run the script
4. Open terminal emulator and type "lighthouse", don't press enter yet
5. Find a suitable target, human or animal with Tapetum lucidum eyes for example. Use script at night for full performance
6. Now run the script and profit (be sure to dodge the counter attack caused by target)
Script
Code:
#!/system/bin/sh
# Lighthouse script
# by broodplank
export max=`cat /sys/class/leds/torch-sec1/max_brightness`;
export intervalValue="0.03"
export pauseValue="0.5"
while [ 1 ]
trap '{ echo "Interrupted, resetting led"; echo 0 > /sys/class/leds/torch-sec1/brightness ; exit 1; }' INT
do
for i in `seq 0 $max`;
do
echo $i > /sys/class/leds/torch-sec1/brightness
sleep $intervalValue
done
sleep $pauseValue
for o in `seq $max -1 0`;
do
echo $o > /sys/class/leds/torch-sec1/brightness
sleep $intervalValue
done
sleep $pauseValue
done
Oh and believe me, you will regret you tested it on your self if you are in a dark room. true story
Use this script responsibly (if possible) :silly:
not sure if troll or real.. it is a script for developers, just has a nasty outcome
Click to expand...
Click to collapse
I used this, and a ship landed in my front yard
elesbb said:
I used this, and a ship landed in my front yard
Click to expand...
Click to collapse
hahaha well I must say the script actually does provide a good signal light, which is also great to blind your mates with
i dont know what i am missing, but how do i push it to my phone,
edit, never mind i think i got it.

Sparrow_AW2.0 enabling all cores + GPU boost

Hello, I decided to publish some guide + scripts I already use for a while, which allows you to use all CPU cores and boost GPU performance.
Battery consumption using this configuration surprisingly does not change much or even did not change at all, with default as well with new config my watch stays alive for ~32h with daily usage.
Some theory:
Sparrow is sold with Qualcomm Snapdragon 400 1.2GHz, which is 4 core CPU. ASUS AW2.0 official kernel though supports only 600MHz and 787MHz, as Asus probably thinks this is good balance between battery life and performance.
GPU is Adreno 302/305, which is capable running up to 450MHz, which is also supported by ASUS AW2.0 kernel.
Where is the catch?
During boot there are all four CPU cores enabled, however there is post-init script, disabling two of those and setting frequency as fixed 738MHz with performance governor (no frequency scaling). GPU is set to fix 200MHz:
/system/bin/init.asus.post_boot.sh
Code:
#!/system/bin/sh
PATH=/system/bin
cd /sys
echo 4 > module/lpm_levels/enable_low_power/l2
echo 1 > module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu0/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/idle_enabled
#Put all other cores offline
echo 0 > devices/system/cpu/cpu2/online
echo 0 > devices/system/cpu/cpu3/online
governor="performance"
scaling_min_freq="787200"
if [[ `grep "oem_perf_change" /proc/cmdline` ]];then
if [[ `grep "oem_perf_on" /proc/cmdline` ]];then
oem_perf_stats="1"
else
oem_perf_stats="0"
fi
echo -n $oem_perf_stats > /factory/oem_perf_stats
fi
echo $governor > devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu1/cpufreq/scaling_governor
#below ondemand parameters can be tuned
echo 50000 > devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 90 > devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 2 > devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential
echo 70 > devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 787200 > devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 300000 > devices/system/cpu/cpufreq/ondemand/sync_freq
echo 80 > devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo $scaling_min_freq > devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 787200 > devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu1/cpufreq/scaling_max_freq
#Below entries are to set the GPU frequency and DCVS governor
echo 200000000 > class/kgsl/kgsl-3d0/devfreq/max_freq
echo 200000000 > class/kgsl/kgsl-3d0/devfreq/min_freq
echo performance > class/kgsl/kgsl-3d0/devfreq/governor
chown -h system devices/system/cpu/cpu[0-1]/cpufreq/scaling_max_freq
chown -h system devices/system/cpu/cpu[0-1]/cpufreq/scaling_min_freq
chown -h root.system devices/system/cpu/cpu[1-3]/online
chmod 664 devices/system/cpu/cpu[1-3]/online
It is indeed required just to alter this script and you can enable all 4 cores with "ondemand" governor, scaling 600-738MHz and GPU scaling 200-450MHz using "msm-adreno-tz" governor:
(and this requires root of course)
Code:
#!/system/bin/sh
PATH=/system/bin
cd /sys
echo 4 > module/lpm_levels/enable_low_power/l2
echo 1 > module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu0/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu2/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu3/power_collapse/idle_enabled
governor="ondemand"
scaling_min_freq="600000"
if [[ `grep "oem_perf_change" /proc/cmdline` ]];then
if [[ `grep "oem_perf_on" /proc/cmdline` ]];then
oem_perf_stats="1"
else
oem_perf_stats="0"
fi
echo -n $oem_perf_stats > /factory/oem_perf_stats
fi
echo $governor > devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu3/cpufreq/scaling_governor
#below ondemand parameters can be tuned
echo 50000 > devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 90 > devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 2 > devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential
echo 70 > devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 787200 > devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 300000 > devices/system/cpu/cpufreq/ondemand/sync_freq
echo 80 > devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo $scaling_min_freq > devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo 787200 > devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu3/cpufreq/scaling_max_freq
#Below entries are to set the GPU frequency and DCVS governor
echo 450000000 > class/kgsl/kgsl-3d0/devfreq/max_freq
echo 200000000 > class/kgsl/kgsl-3d0/devfreq/min_freq
echo msm-adreno-tz > class/kgsl/kgsl-3d0/devfreq/governor
chown -h system devices/system/cpu/cpu[0-3]/cpufreq/scaling_max_freq
chown -h system devices/system/cpu/cpu[0-3]/cpufreq/scaling_min_freq
chown -h root.system devices/system/cpu/cpu[0-3]/online
chmod 664 devices/system/cpu/cpu[0-3]/online
(both files also attached to this post)
To exchange files in your watch, you can easily use following bash script in linux:
First push desired file into sdcard and go to ADB shell:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
In ADB shell remount system to RW, replace the file and fix privileges, than remount system back to RO:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
Update 2018/09/05:
In case you want to experiment, I'm also sending "full_power" script, setting all cores to max frequency and performance governor. There should be no issues, except probably less battery life. Just test yourself, how battery life is affected if it is affected at all. Just unpack the zip file, rename the sh script from init.asus.post_boot_full_power.sh to init.asus.post_boot.sh. Rest of the procedure is still the same.
Without kernel sources, this is probably the maximum performance you can get from the watch. Obtaining kernel sources we might get up still twice of current maximum, as the HW is there, but locked on kernel level.
I just swapped the files and I'll give this a try over the next few days. It would be awesome to destroy lag without needing a kernel tweak app to make it happen. You are the man!
Update: I followed your directions, then I wiped cache and dalvik in TWRP. I have only used the watch for a few minutes with this tweak and it is noticeably faster/smoother already. Text messages display lightning fast after being received on the phone. I'm currently on WiFi in my office. The times I notice most lag on my watch is when I'm on 4G, have music playing, and get a call. The phone may ring for 5-10 seconds before the watch displays. I'm excited to see how helpful this tweak is under those conditions. I'll know later today and keep you posted.
I have not experienced any Bluetooth lag since enabling this. This is a must have mod. Thanks for this!
Glad to hear that @CVertigo1. This is just simple SW enablement of things already present in kernel, so even no cache cleans are required. You can play with it on the go even without watch restart.
Amazing will be getting some kernel with much more CPU freq. steps, like 300-768 or even to 1.2GHz (yes, our chip is capable doing so, it is just not enabled in kernel). With proper governor battery will be still ok, resting CPU most of the time in low clocks. It is pity we have great HW, but it is taken out from us with stock kernel.
It would be nice if Asus would upload the kernel source for AW2.0.
CVertigo1 said:
It would be nice if Asus would upload the kernel source for AW2.0.
Click to expand...
Click to collapse
Well we do have latest kernel source
https://www.asus.com/us/ZenWatch/ASUS_ZenWatch_2_WI501Q/HelpDesk_Download/
Or directly here:
http://dlcdnet.asus.com/pub/ASUS/Wearable/ASUS_WI501Q/ASUS_WI501Q-5.2003.1603.10-kernel-src.zip
We just need some handy guy able to compile it and add more governors and frequencies. That is something what overlapping my skills.
That is the latest kernel source for 1.5. They have not released their source for 2.0, nor any firmware for 2.0. I have contacted Asus about it multiple times and none of their reps have any idea what I'm talking about.
CVertigo1 said:
That is the latest kernel source for 1.5. They have not released their source for 2.0, nor any firmware for 2.0. I have contacted Asus about it multiple times and none of their reps have any idea what I'm talking about.
Click to expand...
Click to collapse
Ah, I see I thought 2017/05/12 stated as a release day was after AW20 concluding this had to be the new one. Pity.
Maybe they'll release it eventually...at an Asus speed, like next year.
please help me(rom Sparrow_7.1.1_Debloat ROM ):
adb shell
sparrow:/ $ su
Permission denied
htduy11 said:
please help me(rom Sparrow_7.1.1_Debloat ROM ):
adb shell
sparrow:/ $ su
Permission denied
Click to expand...
Click to collapse
Hi there, you are missing super user in your ROM. Did you installed SuperSU and Busybox thru TWRP after flashing the ROM?
Do this in TWRP, not Android.
'the command can be used in adb in windows or are different? watch must be in recovery or bootloader? wrote a step by step for noob guide please
You must boot in the TWRP recovery. You need the ADB drivers installed on your computer and is easier to use your computer for this.
mastermoon said:
'the command can be used in adb in windows or are different? watch must be in recovery or bootloader? wrote a step by step for noob guide please
Click to expand...
Click to collapse
Actually it is quite simple, what you need:
* in case you use Windows, you need drivers for android (not needed with Linux)
* working ADB
* rooted watch
Then just connect normally booted watch and in command line (Windows) or terminal (Linux), execute:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
Second command above will enter adb shell, when you are in, just copy paste and execute following:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
LeeonLee said:
Actually it is quite simple, what you need:
* in case you use Windows, you need drivers for android (not needed with Linux)
* working ADB
* rooted watch
Then just connect normally booted watch and in command line (Windows) or terminal (Linux), execute:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
Second command above will enter adb shell, when you are in, just copy paste and execute following:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
Click to expand...
Click to collapse
yeah worked perfectly... after 9 month the zenwatch is back on my wrist....
---------- Post added at 05:31 PM ---------- Previous post was at 05:29 PM ----------
LeeonLee said:
Actually it is quite simple, what you need:
* in case you use Windows, you need drivers for android (not needed with Linux)
* working ADB
* rooted watch
Then just connect normally booted watch and in command line (Windows) or terminal (Linux), execute:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
Second command above will enter adb shell, when you are in, just copy paste and execute following:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
Click to expand...
Click to collapse
worked perfectly.... after 9 months zenwatch is back on my wrist
Hey guys,
do i need to do it every time i booted up ?
And can i messure this Overclocking anywhere ?
Greetings
Namelocked said:
Hey guys,
do i need to do it every time i booted up ?
And can i messure this Overclocking anywhere ?
Greetings
Click to expand...
Click to collapse
Hi, this is permanent solution. To revert you need to replace the file with original one.
I am also not aware of any reliable Wear benchmark, but you can see HW info using e.g. AIDA64 for Wear.
LeeonLee said:
Hi, this is permanent solution. To revert you need to replace the file with original one.
I am also not aware of any reliable Wear benchmark, but you can see HW info using e.g. AIDA64 for Wear.
Click to expand...
Click to collapse
I dont even find the AIDA64 for my smartwatch :/ ?
how can i check core, cpu speed etc... aida64 isn't compatible .. tnx..

Categories

Resources