This article is for camera debugging of Android 5.1, 8.1, and 9.0 versions, and makes a record of log-related configurations. If there is an error, please communicate and correct me.
Debug open kernel cam log
Used to observe the power-on sequence, match_id matching ID, CCI read and write.
Camera opens the key kernel log (taking the 8953 platform as an example)
path:
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_init.c
Code such as:
-#define CDBG(fmt, args...) pr_debug(fmt, ##args)
+#define CDBG(fmt, args...) pr_err(fmt, ##args) // Increase log printing level
View the upper cam module that can be enabled
path:
vendor\qcom\proprietary\mm-camera\mm-camera2\includes\camera_dbg.h
Code such as:
typedef enum {
CAM_NO_MODULE,
CAM_MCT_MODULE,
CAM_SENSOR_MODULE,
CAM_IFACE_MODULE,
CAM_ISP_MODULE,
CAM_PPROC_MODULE,
CAM_IMGLIB_MODULE,
CAM_CPP_MODULE,
CAM_HAL_MODULE,
CAM_JPEG_MODULE,
CAM_C2D_MODULE,
CAM_STATS_MODULE,
CAM_STATS_AF_MODULE,
CAM_STATS_AEC_MODULE,
CAM_STATS_AWB_MODULE,
CAM_STATS_ASD_MODULE,
CAM_STATS_AFD_MODULE,
CAM_STATS_Q3A_MODULE,
CAM_STATS_IS_MODULE,
CAM_STATS_HAF_MODULE,
CAM_STATS_CAF_SCAN_MODULE,
CAM_SHIM_LAYER,
CAM_LAST_MODULE
} cam_modules_t;
View the currently enabled upper layer cam log
adb指令:
adb shell getprop | grep "camera"
adb shell getprop | find "camera" // android5.1 用 find
View the level of the currently enabled upper cam log
path:
vendor\qcom\proprietary\mm-camera\mm-camera2\log_debug\android\camera_dbg.c
Code such as:
The framework defines the following 6 log levels. The INFO level is uncontrollable and will definitely be printed.
/* string representation for logging level */
static const char *cam_dbg_level_to_str[] = {
"", /* CAM_GLBL_DBG_NONE */
"<ERROR>", /* CAM_GLBL_DBG_ERR */
"< WARN>", /* CAM_GLBL_DBG_WARN */
"< HIGH>", /* CAM_GLBL_DBG_HIGH */
"< DBG>", /* CAM_GLBL_DBG_DEBUG */
"< LOW>", /* CAM_GLBL_DBG_LOW */
"< INFO>" /* CAM_GLBL_DBG_INFO */
};
/* values that persist.vendor.camera.global.debug can be set to */
/* all camera modules need to map their internal debug levels to this range */
typedef enum {
CAM_GLBL_DBG_NONE = 0,
CAM_GLBL_DBG_ERR = 1,
CAM_GLBL_DBG_WARN = 2,
CAM_GLBL_DBG_HIGH = 3,
CAM_GLBL_DBG_DEBUG = 4,
CAM_GLBL_DBG_LOW = 5,
CAM_GLBL_DBG_INFO = 6
} cam_global_debug_level_t;
Debug enable HAL cam log
In the power-on state, it will take effect after using these commands to set, and it will still be valid after restarting, and the settings will disappear after flashing
adb shell setprop persist.camera.hal.debug.mask 536870915 // Android 8.0
or
// HAL-3 Android9.0
adb shell setprop persist.vendor.camera.hal.debug 3
Debugging capture cam upper layer log
This log capture will not stop, it will keep capturing.
adb logcat –v time –b main –b system > log.log
debug setting cam module log
Global debug log level configuration
persist.camera.global.debug
value: 0-5 // [-- the smaller the number, the higher the level--]
Function: Set different values, and the log of the corresponding level will be printed.This property is the general log level switch.
Note: If the log level of the submodule is less than the value set by this property, this property shall prevail;If the log level of the submodule is greater than the value set by this property, the log level set by the submodule shall prevail.
Code such as:
adb shell setprop persist.camera.global.debug 5
or (property settings between android5/8 and android9.0 will be different by one "vendor")
adb shell setprop persist.vendor.camera.global.debug 5
Debug settings cam module log Android8.0
// android 8 opens camera logcat level
adb shell setprop persist.camera.sensor.debug 3
adb shell getprop persist.camera.sensor.debug // view current level
!!! Commonly used camera debug properties
// Reference link: https://blog.csdn.net/liaochaoyun/article/details/89671195
// The actual code may be different, please refer to the actual code setting
// Take android 8.1 as an example to refer to the following path
// QCameraParameters.cpp 8909_APP_O\hardware\qcom\camera\QCamera2\HAL
Global debug log property
1. adb shell setprop persist.vendor.camera.sensor.debug 3
2. adb shell setprop persist.vendor.camera.global.debug 3
ISP LOG
3. adb shell setprop persist.camera.ISP.debug.mask 3
View cam module log level definition
path:
camera_dbg.h vendor\qcom\proprietary\mm-camera\mm-camera2\includes
Code such as:
typedef enum {
CAM_NO_MODULE,
CAM_MCT_MODULE,
CAM_SENSOR_MODULE,
CAM_IFACE_MODULE,
CAM_ISP_MODULE,
CAM_PPROC_MODULE,
CAM_IMGLIB_MODULE,
CAM_CPP_MODULE,
CAM_HAL_MODULE,
CAM_JPEG_MODULE,
CAM_C2D_MODULE,
CAM_STATS_MODULE,
CAM_STATS_AF_MODULE,
CAM_STATS_AEC_MODULE,
CAM_STATS_AWB_MODULE,
CAM_STATS_ASD_MODULE,
CAM_STATS_AFD_MODULE,
CAM_STATS_Q3A_MODULE,
CAM_STATS_IS_MODULE,
CAM_STATS_HAF_MODULE,
CAM_STATS_CAF_SCAN_MODULE,
CAM_SHIM_LAYER,
CAM_LAST_MODULE
} cam_modules_t;
Set the LOG level of each module, the smaller the number, the higher the level
/* values that persist.vendor.camera.global.debug can be set to */
/* all camera modules need to map their internal debug levels to this range */
typedef enum {
CAM_GLBL_DBG_NONE = 0,
CAM_GLBL_DBG_ERR = 1,
CAM_GLBL_DBG_WARN = 2,
CAM_GLBL_DBG_HIGH = 3,
CAM_GLBL_DBG_DEBUG = 4,
CAM_GLBL_DBG_LOW = 5,
CAM_GLBL_DBG_INFO = 6
} cam_global_debug_level_t;
Measured
adb shell setprop persist.camera.global.debug x // set log level
adb shell getprop persist.camera.global.debug // view log level
View cam module log keywords
LOG-keyword // Keyword
1. Turn on the camera
CAM_PhotoModule: onCameraOpened
2. Obtained camera configuration information
sensor_get_resolution_info: sensor info: name:
3. Frame freeze bug
mm-camera: <MCT><ERROR> 98: mct_bus_sof_thread_run: FATAL Session 1: SOF Freeze! Sending error message
mm-camera: <MCT >< INFO> 133: mct_bus_sof_thread_run: Sending HW_ERROR from MCT on session =1
mm-camera: <MCT ><ERROR> 817: mct_controller_send_cb: FATAL: Sending HW_Error
Camera : Error 100
4. Frame freeze bug - keyword
I QCamera : <HAL><INFO> start_preview: 394: [KPI Perf]: X ret = 0