modules/batt_health/nvm.c
static bool nvm_file_ver_0_read(int fd, bhd_state_t *state)
{
	bool is_success = false;
	nvm_file_data_ver_0_t data;
	ssize_t r;

	r = read(fd, &data, sizeof(data));
	if (r != sizeof(data))
		ALOGE("NVM Read - Failed to read data, r = %lu, errno = %d (%s)",
			r, errno, strerror(errno));
	else {
		state->bms.real_fcc_batt_temp = data.real_fcc_batt_temp;
		state->bms.real_fcc_mah = data.real_fcc_mah;
		state->bms.soc = data.soc;
		state->bms.ocv_uv = data.ocv_uv;
		state->bms.rbatt = data.rbatt;
		state->bms.charge_increase = data.charge_increase;
		state->bms.chargecycles = data.chargecycles;
		state->aged_capacity = data.aged_capacity;

		/* begin-of-charge and end-of-charge variables just stored for debugging */
		state->eoc.aged_timestamp = data.aged_timestamp;
		state->eoc.boc_percent = data.boc_percent;
		state->eoc.boc_ocv_uv = data.boc_ocv_uv;
		state->eoc.boc_cc_uah = data.boc_cc_uah;
		state->eoc.eoc_percent = data.eoc_percent;
		state->eoc.eoc_ocv_uv = data.eoc_ocv_uv;
		state->eoc.eoc_cc_uah = data.eoc_cc_uah;
		is_success = true;
	}

	return (is_success);
}
/* Read files using format version 0 */
Read files using format version 0
Read files using format version 0
static bool nvm_file_ver_0_read(int fd, bhd_state_t *state)
{
	bool is_success = false;
	nvm_file_data_ver_0_t data;
	ssize_t r;
	r = read(fd, &data, sizeof(data));
	if (r != sizeof(data))
		ALOGE("NVM Read - Failed to read data, r = %lu, errno = %d (%s)",
			r, errno, strerror(errno));
	else {
		state->bms.real_fcc_batt_temp = data.real_fcc_batt_temp;
		state->bms.real_fcc_mah = data.real_fcc_mah;
		state->bms.soc = data.soc;
		state->bms.ocv_uv = data.ocv_uv;
		state->bms.rbatt = data.rbatt;
		state->bms.charge_increase = data.charge_increase;
		state->bms.chargecycles = data.chargecycles;
		state->aged_capacity = data.aged_capacity;
		state->eoc.aged_timestamp = data.aged_timestamp;
		state->eoc.boc_percent = data.boc_percent;
		state->eoc.boc_ocv_uv = data.boc_ocv_uv;
		state->eoc.boc_cc_uah = data.boc_cc_uah;
		state->eoc.eoc_percent = data.eoc_percent;
		state->eoc.eoc_ocv_uv = data.eoc_ocv_uv;
		state->eoc.eoc_cc_uah = data.eoc_cc_uah;
		is_success = true;
	}
	return (is_success);
}
static bool nvm_file_ver_0_read ( int fd , bhd_state_t * state ) { bool is_success = false ; nvm_file_data_ver_0_t data ; ssize_t r ; r = read ( fd , & data , sizeof ( data ) ) ; if ( r != sizeof ( data ) ) ALOGE ( " " , r , errno , strerror ( errno ) ) ; else { state -> bms . real_fcc_batt_temp = data . real_fcc_batt_temp ; state -> bms . real_fcc_mah = data . real_fcc_mah ; state -> bms . soc = data . soc ; state -> bms . ocv_uv = data . ocv_uv ; state -> bms . rbatt = data . rbatt ; state -> bms . charge_increase = data . charge_increase ; state -> bms . chargecycles = data . chargecycles ; state -> aged_capacity = data . aged_capacity ; state -> eoc . aged_timestamp = data . aged_timestamp ; state -> eoc . boc_percent = data . boc_percent ; state -> eoc . boc_ocv_uv = data . boc_ocv_uv ; state -> eoc . boc_cc_uah = data . boc_cc_uah ; state -> eoc . eoc_percent = data . eoc_percent ; state -> eoc . eoc_ocv_uv = data . eoc_ocv_uv ; state -> eoc . eoc_cc_uah = data . eoc_cc_uah ; is_success = true ; } return ( is_success ) ; }
Read files using format version 0
Read files using format version 0
/* begin-of-charge and end-of-charge variables just stored for debugging */