static guint timer;
-static int thermal_get_state(struct thermal_info *info)
+static int thermal_get_info(struct thermal_info *info)
{
- int value;
FILE *fp;
char buf[32];
size_t len;
+ char *ret;
if (!info)
return -EINVAL;
}
buf[len] = '\0';
- if (!strstr(buf, "temp:")) {
- _E("Invalid temparature value (%s)", buf);
+ ret = strstr(buf, "temp:");
+ if (!ret) {
+ _E("Invalid temp value (%s)", buf);
return -EINVAL;
}
+ info->temp = atoi(ret + 5); /* 5 == strlen("temp:") */
- value = atoi(buf + 5); /* 5 == strlen("temp:") */
-
- _I("AP temparature(%d)", value);
-
- if (value < 75) {
- info->state = THERMAL_STATE_NORMAL;
- info->level = THERMAL_LEVEL_NORMAL;
- return 0;
+ ret = strstr(buf, "adc:");
+ if (!ret) {
+ _E("Invalid adc value (%s)", buf);
+ return -EINVAL;
}
+ info->adc = atoi(ret + 4); /* 4 == strlen("adc:") */
- info->state = THERMAL_STATE_HIGH;
-
- if (value < 85)
- info->level = THERMAL_LEVEL_WARNING;
- else if (value < 100)
- info->level = THERMAL_LEVEL_CRITICAL;
- else
- info->level = THERMAL_LEVEL_POWEROFF;
+ _I("AP temp(%d) adc(%d)", info->temp, info->adc);
return 0;
}
struct thermal_info info;
int ret;
- ret = thermal_get_state(&info);
+ ret = thermal_get_info(&info);
if (ret < 0) {
_E("Failed to read thermal state (%d)", ret);
return G_SOURCE_CONTINUE;
= thermal_register_changed_event;
thermal_dev->unregister_changed_event
= thermal_unregister_changed_event;
- thermal_dev->get_state
- = thermal_get_state;
+ thermal_dev->get_info
+ = thermal_get_info;
*common = (struct hw_common *)thermal_dev;
return 0;