当前位置:   article > 正文

ADB 命令实用+详解 —— 调试_adb随机延时1-10分

adb随机延时1-10分

目录

Screen brightness

Log

注释和打印

查看当前系统版本状态

烧录img文件

keyevent常用操作

延时和循环

Reflash Firmware


  • Screen brightness

adb shell "settings put system screen_brightness_mode 1"   //打开设备亮度自动调节

adb shell "settings put system screen_brightness_mode 0"   //关闭设备亮度自动调节

adb shell "settings put system screen_brightness 255"          //先关闭亮度自动调节,才能设置当前屏幕亮度,从低到高亮度值1~255 ) 

adb shell "settings get system screen_brightness_mode"      // 获取亮度是否为自动调节,输出:0(不是), 1(是)

adb shell "settings get system screen_brightness"                 // 获取当前屏幕亮度值(一般是4-225)

  • Log

  1. 先清空log:

λ adb remount                                                    //获取权限
λ adb shell "setenforce 0"

λ adb shell "rm -rf /data/log/android_logs"  //删除/data/log/android_logs及其子目录的内容,删除已存的logs

  1. 手机端操作需要log的动作
  2. Pull log

λ adb pull /data/log/android_logs/kmsgcat-log .\     //pull最近几秒内kmsgcat-log,保存在.bat文件所在的目录下,用cmd命令行执行时保存在C:\Users\xxx的目录下,执行完出现类似“/data/log/android_logs/: 47 files pulled, 0 skipped. 25.1 MB/s (23052996 bytes in 0.877s)”结果,表示pull成功。

λ adb pull /data/log/android_logs/kmsgcat-log  <本地指定目录>   //pull最近几秒内kmsgcat-log,本地指定的目录下,例如C:\Users\xxx

λ adb pull /data/log/android_logs  //pull最近几天内的所有log,文件尾椎是以手机的时间为准命名的,有kmsgcat-log.I002.20220602-080947.gzapplogcat-log.I008.20220602-080955.gz等几大类压缩包

  • 注释和打印

rem:: 效果一样,都是注释的意思,区别是rem会打印出注释内容,::不会打印注释内容

echo Wait for USB connection...                //打印echo后面的内容      

  • 查看当前系统版本状态

λ adb shell tpd version

please exe 'adb shell setenforce 0' in cmd to disable selinux

λ adb shell setenforce 0

λ adb shell tpd version                 //查看当前系统版本状态

suggest you to excute cmd during work state.

sys:->xxx-000 x.x.x.xxx(xxxxx)

dae:->normal/x.x.x

afe:->x.x

tsa:->xxx/xxx/xxx

asa:->not support/not support/not support

aft:->null

log:->normal/x.x.x

api:->x.x.xx

  • 烧录img文件

在保存有待烧录的xxx.img文件的目录下,运行cmd命令行,前提是已经装好了adb.exe和fastboot.exe:

λ adb reboot bootloader

λ fastboot flash dtbo xxx.img

< waiting for any device >

Sending 'xxx' (24576 KB)                          OKAY [  0.572s]

Writing 'xxx'                                     OKAY [  0.046s]

Finished. Total time: 0.678s

λ fastboot reboot

Rebooting                                          OKAY [  0.000s]

Finished. Total time: 0.016s

Press any key to continue . . .

  • keyevent常用操作

返回:adb shell input keyevent 4

灭屏亮屏:adb shell input keyevent 26

解锁屏幕:adb shell input keyevent 82

还有好多不同功能的,适用于没有触屏和机械按键操作的情况下调试手机主板。

  • 延时和循环

for /l %%i in (1,1,50) do (             // 进行50次循环

adb shell "input keyevent 26"

%temp%\Delayms.vbs 1000       //delay 1s

echo wait for 1s                          //打印延时1s

echo %%i cycles                        //打印第几次循环

)

  • Reflash Firmware

  1. 获取权限:(组合命令)

adb root           //获取root权限

adb remount     //将 '/system' 部分置于可写入的模式,默认情况下 '/system' 部分是只读模式的,这个命令只适用于已被 root 的设备

adb reboot        //重启

adb root

adb remount

        2. Reflash firmware

adb push fw /vendor/firmware //将image file传到手机固定目录下

adb shell  "echo 1 > sys/bus/platform/devices/xxxx"   /*检测并决定是否更新fw。若push的fw与IC中的fw相同,则不更新,反之则更新*/

adb shell  "echo 2 > sys/bus/platform/devices/xxxx"   /*强制更新fw*/

(echo 1和echo 2中执行一个就行)

        3.查看烧录结果

adb shell  //进入Android Shell命令环境中

cd sys/bus/platform/devices/xxx  //去手机里保存的目录

cat info   //cat 命令用于连接并显示指定的一个和多个文件的有关信息

cat info_appfw

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/1000649
推荐阅读
相关标签
  

闽ICP备14008679号