[android][camera][thermal]thermal对camera启动的影响

客户定制功能,当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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值