[TOOL][WIN]Take screenshots of Aroma and Recovery v1.1 - Nexus 5 Android Development
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.
Related
WARNING: Possible malicious games for ROMs with superuser
I've noticed that the latest version of two games by "Cooper Media Corp." are attempting to use su on my phone. The games are "Paradise Island" and "My country". I'm not sure what they are trying to do, the Super User logs don't seem to record the command attempted. See attached screenshot. I replaced su with: Code: #!/system/bin/sh echo "`date +%F-%T` $$ Args: [email protected]" >> /sdcard/su.log echo -n '# ' while read line; do echo `date +%F-%T` $$ Cmd: $line >> /sdcard/su.log if [ "$line" = "exit" ]; then echo `date +%F-%T` $$ Exiting >> /sdcard/su.log exit 0 fi echo -n '# ' done And it logged: 2011-08-13-11:47:46 8193 Args: 2011-08-13-11:47:46 8193 Cmd: echo "Do I have root?" >/system/sd/temporary.txt 2011-08-13-11:47:47 8193 Cmd: exit 2011-08-13-11:47:47 8193 Exiting I created that directory and file, but the game doesn't seem to use su after this point. Perhaps it's waiting for something?
It may just check if you're rooted so you can't edit/manipulate game files and stuff so you can cheat. Are the games internet based? Like FarmVille and stuff?
There's a theory. I think using su for that crosses the line a bit...
[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)??
[TOOL][MOD][WIN][SHARE] Take Screenshots in Recovery & Aroma!
[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
Found a (rogue?) script on my J6+ today... could someone tell me if it's nasty?
run.bat [filename] SET SLEEP=ping 127.0.0.1 -n echo %1 echo %2 %SLEEP% 5 > nul %2 -remove move /Y %1 %2 %2 -install exit
A script to get a random file
Dear developers, I have an issue in my script switching from Android 9 to 10 (devices from a Umidigi s3 Pro to a Umidigi F2) I have installed Bosybox App on the first and Busybox Magisk module on the latter Now the script does not work because the command list=(`busybox find "$dirs" -type f -name *.$ext`) returns an empty array This is the complete script: Bash: #!/system/bin/sh echo if test "$1" = ""; then echo "Randomfile script by Uranya <[email protected]> v1.4 01.01.2021" echo "Usage:" echo "sh randomfile.sh <sourcedir> <extension> <destdir>" exit 1 fi dirs=$1 ext=$2 dird=$3'/' dest=$dird'random' delim1="" delim2="" last='last.txt' # create filename's array IFS=$'\n' # here we have the ISSUE list=(`busybox find "$dirs" -type f -name *.$ext`) # count number of files num=${#list[@]} # initialize random generator RANDOM=$$ # generate random number in range 1-NUM let "ran=(${RANDOM} % ${num})+ 1" echo Random from $num files is $ran sour=${list[ran]} sourn=${sour#$dirs} sourn=${sourn:1:${#sourn}} date=$(date +"%Y.%m.%d %H:%M") day=$(date +"%d") hour=$(date +"%H") minute=$(date +"%M") message='---------------------------------------\n'$date' - '$num' >>> '$ran'\n'$delim1$sourn$delim2 if ([ "$day" = "01" ] && [[ "$minute" < "29" ]]) || [ ! -f $dird$last ]; then echo >$dird$last $message else sed -i '1i'$message $dird$last fi echo $delim1$sourn$delim2 # rename the old file cp $dest.$ext $dest'_back.'$ext # copy the file cat "$sour" >$dest.$ext echo File copied as $delim1$dest.$ext$delim2 Can you please help me why this happens, and how to fix it? Thank you very much for your attention!
Uranya said: [...] Click to expand... Click to collapse Having done some tests I have found this: opening a root privileged terminal and executing --- echo `find /storage/7BC3-1805/Music/MP3/Abba -type f -name *.mp3` --- it returns two strings containing the names of files inside that folder, but putting it in my script continues to return an empty array, so the issue is not in the access to the folder, but in the syntax, I guess
try putting that *.$ext into quotes...
Dear friends, CXZa, after a couple of hours debugging the script, finally, I have found the mistake! The line to be used is: list=( `find "$dirs" -type f -name "*.$ext"` ) it is a very subtle difference: the space after and before the parenthesis! (even the word busybox is useless) Oddly in the Busybox app (I have had on my S3 Pro) the spaces are not mandatory, whilst in the Busybox Magisk module those spaces ARE mandatory! I'm using that script for almost 8 years to have an every day different music for my wake up. I'm using Tasker to call it just before my alarm get off, so the same file contains every day, a different song. I have done a change also in the array index that did not began by 0... So, here it is the right script: Bash: #!/system/bin/sh echo if test "$1" = ""; then echo "Randomfile script by Uranya <@uranya7x> v1.5 26.03.2021" echo "Usage:" echo "sh randomfile.sh <sourcedir> <extension> <destdir>" exit 1 fi dirs=$1 ext=$2 dird=$3'/' dest=$dird'random' delim1="" delim2="" last='last.txt' # create filename's array IFS=$'\n' list=( `find "$dirs" -type f -name "*.$ext"` ) # count number of files num=${#list[@]} # generate random number in range 1-NUM let "ran=(${RANDOM} % ${num})+ 1" echo Random from $num files is $ran sour=${list[$ran-1]} sourn=${sour#$dirs} sourn=${sourn:1:${#sourn}} date=$(date +"%Y.%m.%d %H:%M") day=$(date +"%d") hour=$(date +"%H") minute=$(date +"%M") message='---------------------------------------\n'$date' - '$num' >>> '$ran'\n'$delim1$sourn$delim2 if ([ "$day" = "01" ] && [[ "$minute" < "29" ]]) || [ ! -f $dird$last ]; then echo >$dird$last $message else sed -i '1i'$message $dird$last fi echo $delim1$sourn$delim2 # rename the old file cp $dest.$ext $dest'_back.'$ext # copy the file cat "$sour" >$dest.$ext echo File copied as $delim1$dest.$ext I hope it will be useful to someone else that loves to be waked up by music... Peace everywhere!