客户定制功能,当cpu温度过高时限制camera的启动
系统已经设置了一个设备节点:sys/kernel/camera_thermal/camera_disable
当cpu温度过高时,这个设备节点会被设置成1 否则状态为0
所以只需要在hal opencamera的时候获取设备节点的值,进行判断,确定是否会opencamera
+ FILE *fp;
+ int camera_disable = 0;
+ fp = fopen("/sys/kernel/camera_thermal/camera_disable", "rb");
+ if (fp != NULL) {
+ char thermal_level[2] = { 0, 0 };
+ char *pNext = 0;
+ size_t read_cnt = 0;
+
+ read_cnt = fread(thermal_level, sizeof(char), 1, fp);
+ LOGI("Q%s: camera_disabled : %ld", __func__, strtol(thermal_level, &pNext, 10));
+ if ((read_cnt == 1) && ('1' == thermal_level[0])) {
+ LOGE("test thermal Q%s: thermal level, return 1", __func__);
+ camera_disable = 1;
+ }
+ fclose(fp);
+ } else {
+ LOGE("Q%s: camera_disabled file cannot open", __func__);
+ }
+ if(camera_disable != 0) {
+ mCameraHandle->ops->close_camera(mCameraHandle->camera_handle);
+ mCameraHandle = NULL;
+ return UNKNOWN_ERROR;
+ }
vendor/qcom/proprietary/thermal-engine/thermal-engine-xxx.conf文件中则配置着cpu过载的温度界限
[restriction]
algo_type monitor
sensor msm_therm
sampling 5000
thresholds 115000 //115度
thresholds_clr 110000 //110度
actions camera+bcr
action_info 1+1