ADB,即 Android Debug Bridge。利用ADB指令可以对安卓设备进行命令行操作。
下面总结一些常用的ADB指令方便设备的开发与调试。
(一)推库不用重启的方法:
可以节省大量时间,需要重启启动程序,和第二条搭配使用
另外还可以方便的查看开camera初始化时的一些打印
注意:需要有APK,部分IPC上不能使用
660/8998平台:
adb shell stop cameraserver adb shell start cameraserver adb shell sync
|
老平台:
adb shell stop media adb shell start media adb shell stop qcamerasvr adb shell start qcamerasvr adb shell sync
|
(二)adb启动和关闭程序的方法
先找到当前窗口的程序名,拿骁龙相机举例
输入:adb shell dumpsys window windows | findstr Current
输出:mCurrentFocus=Window{59a08b7 u0 org.codeaurora.snapcam/com.android.camera.CameraLauncher}
后面一长串的字母就是程序名
先找到当前窗口的程序名,拿骁龙相机举例启动程序,adb shell am start –n + 程序名
adb shell am start -n org.codeaurora.snapcam/com.android.camera.CameraLauncher
先找到当前窗口的程序名,拿骁龙相机举例关闭程序
adb shell pkill snapcam(缩写就够了)
(三)拍照:用模拟抓拍键的方式抓拍
adb shell input keyevent 27
如果写成脚本,速度较快,有的时候图片不能立即pull出来,建议加个延时,具体延时长度自己试验
延时:ping /n 2 127.1>nul
此处的2代表延时2秒
(四)抓raw图的方法:不一定要骁龙相机,方便拍raw图以及平时的分析(660平台)
先找到当前窗口的程序名,拿骁龙相机举例先修改文件夹权限
adb shell chmod 777 /data/misc/camera
先找到当前窗口的程序名,拿骁龙相机举例抓取一帧RAW
可以在QCamera2HWICallbacks.cpp的dumpFrameToFile函数查看具体实现过程。可能会出现抓拍到不止1张raw图的情况。
adb shell setprop persist.camera.raw_yuv 1 adb shell setprop persist.camera.preview_raw 1 adb shell setprop persist.camera.dumpimg 0 adb shell setprop persist.camera.dumpimg 131088
|
先找到当前窗口的程序名,拿骁龙相机举例导入chromatix时,用骁龙相机抓出来的raw图是MIPI格式
而这里格式要改成packed,图片的名称中有图片的大小
注意:第一次抓取raw图,设置好要重启camera
由于persist.camera.raw_yuv只有在给channel添加通道的时候才会读取,因此设置之后需要重启camera,可以重启设备或者重启应用程序。
(五)抓YUV图的方法(660平台):
VFE输出
和上面一个类似,先改权限
adb shell setprop persist.camera.isp.dump_cnt 10 adb shell setprop persist.camera.isp.dump 0 adb shell setprop persist.camera.isp.dump 2
|
实现函数:iface_util.c中的 iface_util_dump_frame
如果想要再次dump 10帧,需要把isp.dump值设置成0,再设置一次2
CPP输出(方法和抓raw图差不多)
adb shell setprop persist.camera.dumpimg 0 adb shell setprop persist.camera.dumpimg 131073
|
补充:
persist.camera.isp.dump 0到12位的意义:
CAM_STREAM_TYPE_PREVIEW – 0x2
CAM_STREAM_TYPE_SNAPSHOT – 0x8
CAM_STREAM_TYPE_VIDEO – 0x10
persist.camera.dumpimg
16到23位表示dump多少帧,但如果是0,就是10帧
8-15位表示跳过多少帧,默认不跳过.
0到7位:
QCAMERA_DUMP_FRM_PREVIEW –0x1
QCAMERA_DUMP_FRM_VIDEO –0x2
QCAMERA_DUMP_FRM_SNAPSHOT –0x4
QCAMERA_DUMP_FRM_THUMBNAIL –0x8
QCAMERA_DUMP_FRM_RAW –0x10
QCAMERA_DUMP_FRM_JPEG –0x20
(六)查看HAL层和客户端设置的参数值
adb shell dumpsys media.camera
(七)log打印
logcat|grep xxx –搜索包含xxx的log
logcat|grep xxx > /data/log.log –将包含xxx的log存到/data/log.log中
setprop persist.camera.stats.aec.debug 5 –stats中的AEC模块等级小于等于5的都打印出来
关键词:
查看曝光信:target_luma
查看灰点信息:simple-grey-world
查看决策点:final_awb_decision
查看HAL层帧率:PROFILE_PREVIEW_FRAMES_PER_SECOND
查看camera层模块帧率:fps
typedef enum { Q3A_AWB_AGW_D65 = 0, Q3A_AWB_AGW_D75, Q3A_AWB_AGW_A, Q3A_AWB_AGW_WARM_FLO, Q3A_AWB_AGW_COLD_FLO, Q3A_AWB_AGW_HORIZON, Q3A_AWB_AGW_D50, Q3A_AWB_AGW_CUSTOM_FLO, Q3A_AWB_AGW_NOON, Q3A_AWB_AGW_CUSTOM_DAYLIGHT, Q3A_AWB_AGW_CUSTOM_A, Q3A_AWB_AGW_U30, Q3A_AWB_AGW_CUSTOM_DAYLIGHT1, Q3A_AWB_AGW_CUSTOM_DAYLIGHT2, Q3A_AWB_AGW_CUSTOM_FLO1, Q3A_AWB_AGW_CUSTOM_FLO2, Q3A_AWB_AGW_MAX_LIGHT, Q3A_AWB_AGW_INVALID_LIGHT = Q3A_AWB_AGW_MAX_LIGHT, Q3A_AWB_DAY_LINE_1 = Q3A_AWB_AGW_MAX_LIGHT, Q3A_AWB_DAY_LINE_2, Q3A_AWB_FLINE, Q3A_AWB_A_LINE_1, Q3A_AWB_A_LINE_2, Q3A_AWB_AGW_HYBRID, Q3A_AWB_AGW_MAX_ALL_LIGHT = Q3A_AWB_AGW_HYBRID, Q3A_AWB_AGW_INVALID_ALL_LIGHT = Q3A_AWB_AGW_MAX_ALL_LIGHT } chromatix_awb_all_light_adapter;
|
推库技巧:
如果一次生成的so文件比较多,可以放在一个文件夹内,把文件夹的内容推入设备。
adb push C:\ROM. System/vendor/lib 注意.不能少
(八)参考脚本:
push.bat(推动态库)
REM 在推库之前关闭应用程序,不然可能会卡死在应用程序的界面 REM IPC上建议不要关掉程序,重启会很慢,直接推库会卡一会儿,然后就可以正常使用 adb shell pkill ptt REM HAL层动态库 adb push adb push Z:\liqinxing\sdm660\sdm660_ipw300\out\target\product\u2p\obj_arm\lib\camera.sdm660.so system/lib/hw REM camera层动态库 adb push Z:\liqinxing\sdm660\sdm660_ipw300\out\target\product\u2p\obj_arm\lib\libchromatix_imx290_default_preview_3a.so system/vendor/lib adb push Z:\liqinxing\sdm660\sdm660_ipw300\out\target\product\u2p\obj_arm\lib\libchromatix_imx290_cpp_preview.so system/vendor/lib adb push Z:\liqinxing\sdm660\sdm660_ipw300\out\target\product\u2p\obj_arm\lib\libchromatix_imx290_preview.so system/vendor/lib adb push Z:\liqinxing\sdm660\sdm660_ipw300\out\target\product\u2p\obj_arm\lib\libchromatix_imx290_common.so system/vendor/lib REM 重启cameraserver(8998/sdm660平台) adb shell stop cameraserver adb shell start cameraserver adb shell sync REM 启动应用程序 adb shell am start -n com.kedacom.ptt/com.kedacom.kdmipw300.activity.IPW300MainActivity ping /n 3 127.1>nul REM 确认是否打开 adb shell dumpsys window windows | findstr Current
|
capture.bat(拍照)
REM 先清空原来的图片 adb shell rm -r /sdcard/DCIM/Camera/* adb shell rm -r /storage/extdisk/ipw300/image/chn0_0/* REM 拍照 adb shell input keyevent 27 ping /n 3 127.1>nul REM 导出照片 adb pull /storage/extdisk/ipw300/image/chn0_0 Z:\liqinxing\test_photo\sixth_tunning adb pull /sdcard/DCIM/Camera Z:\liqinxing\test_photo\sixth_tunning
|
sdm660_root.bat
adb root adb shell setprop service.user.test 1 ping -n 5 127.1 > nul adb shell setenforce 0 ping -n 1 127.1 > nul adb remount
|
captureraw.bat
adb shell chmod 777 /data/misc/camera adb shell rm /data/misc/camera/* adb shell setprop persist.camera.raw_yuv 1 adb shell setprop persist.camera.preview_raw 1 adb shell setprop persist.camera.dumpimg 0 adb shell setprop persist.camera.dumpimg 131088 adb pull /data/misc/camera Z:\liqinxing\test_photo\raw
|
captureyuv.bat
adb shell chmod 777 /data/misc/camera adb shell rm /data/misc/camera/* adb shell setprop persist.camera.isp.dump_cnt 1 adb shell setprop persist.camera.isp.dump 0 adb shell setprop persist.camera.isp.dump 2 adb pull /data/misc/camera Z:\liqinxing\test_photo\raw
|