Related
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)??
Can anyone tell me how to add lines in one file by another bash file?
I make a script to change governors and frequency but I need to make the setting set on boot (But I dun want use 3rd party app like SetCPU).
So I need to add these lines to init.d folder's file :
Code:
#!/system/bin/bash (and i add line but this is by default?)
echo "interactiveX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor (if the next time i chg setting , will this line be deleted or there will be another line with new setting?)
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "245670" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
so what command should i use to add these line ?
Code:
#!/system/bin/sh
an0nym0us_ said:
Code:
#!/system/bin/sh
Click to expand...
Click to collapse
thanks for your reply but i dont really understand...
those '800000' , '245670' and 'interactiveX' are just some example
i mean i want to write this:
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
in init.d folder's file by other file
this file is in /system/bin
so i can access and chg my cpu setting by typing 'cpuclock'
there for i need a command to add line to init.d in order to set on boot
Code:
echo " Change CPU Governor Profile "
echo ""
echo ""
echo " Current Governor: "
echo "$CUR_GOV"
echo ""
$sleep
echo " Available Governors: "
echo "$AVAIL_GOV"
echo ""
$sleep
echo " Insert your desired governor: "
echo -n " Your Governor: ";read GOV
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
[COLOR="Red"][so now i change my current governor,but the governor will be reset to default(ondemand) after next reboot]
[all i want is , while echoing current governor , i need to add one line to init.d there too , but i don know how :(][/COLOR]
echo " Complete "
echo ""
$sleep
echo -e " Current Governor: "
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0;;
asd
how can i make a .sh file with more than 1 command in it?
for example:
echo "90" > /sys/devices/system/cpu/cpufreq/lulzactive/inc_cpu_load
echo "1" > /sys/devices/system/cpu/cpufreq/lulzactive/pump_up_step
echo "2" > /sys/devices/system/cpu/cpufreq/lulzactive/pump_down_step
echo "50000" > /sys/devices/system/cpu/cpufreq/lulzactive/up_sample_time
echo "40000" > /sys/devices/system/cpu/cpufreq/lulzactive/down_sample_time
echo "5" > /sys/devices/system/cpu/cpufreq/lulzactive/screen_off_min_step
can i make a single .sh file and don't have to split it in 6 different file???
(this file should be executed with scriptmanager)
hope i have made myself clear.
Of course you can, simply copy all the lines you need into a file, and add before them #!/system/bin/sh, and that's it. Save and run your file.
thanks it worked...very strange, i made the exact same thing before posting this question, but each time it doesn't worked...
hahaha... yeah, it happens :silly:
DOS Script for creating SYMLINK code for updater-script
After searching and searching I found an usefull script for auto symlink text generation. One can use it with kitchen....
I modified it and put together in a single batch file.
It grabs APK list in directory you want (lets say C:\cygwin\home\user\kitchen\WORKING_030413_160037\preload\symlink\system\app)
and creates code and saves it to symlinks.txt
You can just copy-paste it in updater-script:
(rename sym_create.txt into sym_create.cmd)
Syntax is simple:
sym_create.cmd path_of_the_kitchen_working_directory_with_app_list
you get....
symlink("/preload/symlink/system/app/aplication_name.apk","/system/app/aplication_name.apk")
in symlinks.txt
Script:
Code:
@echo Listing APKs]
@echo .
@echo Choosen path = %1
for /r %1 %%g in (*.apk) do echo %%~nxg >> list.txt
@echo .
@echo [Preparing links]
echo .
for /f "tokens=*" %%A in (list.txt) do (echo.symlink("/preload/symlink/system/app/%%~nA.apk","/system/app/%%~nA.apk"^); >> symlinks.txt
)
I hope it saves you some time!
Sweet!
klemenSLO said:
DOS Script for creating SYMLINK code for updater-script
After searching and searching I found an usefull script for auto symlink text generation. One can use it with kitchen....
I modified it and put together in a single batch file.
It grabs APK list in directory you want (lets say C:\cygwin\home\user\kitchen\WORKING_030413_160037\preload\symlink\system\app)
and creates code and saves it to symlinks.txt
You can just copy-paste it in updater-script:
(rename sym_create.txt into sym_create.cmd)
Syntax is simple:
sym_create.cmd path_of_the_kitchen_working_directory_with_app_list
you get....
symlink("/preload/symlink/system/app/aplication_name.apk","/system/app/aplication_name.apk")
in symlinks.txt
Script:
Code:
@echo Listing APKs]
@echo .
@echo Choosen path = %1
for /r %1 %%g in (*.apk) do echo %%~nxg >> list.txt
@echo .
@echo [Preparing links]
echo .
for /f "tokens=*" %%A in (list.txt) do (echo.symlink("/preload/symlink/system/app/%%~nA.apk","/system/app/%%~nA.apk"^); >> symlinks.txt
)
I hope it saves you some time!
Click to expand...
Click to collapse
THANKS!!!!
Doing that by hand was REALLY getting old!!!
Mega Thanks
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.