10 static int mmc_write_sectors_per_uah;
11 static int mmc_read_sectors_per_uah;
13 static int get_number_sectors(uint64_t *_read, uint64_t *_written)
15 const char *path = "/sys/block/mmcblk0/stat";
19 fp = fopen(path, "r");
22 _E("fopen failed: %s", strerror(errno));
25 if (fscanf(fp, "%*s %*s %lld %*s %*s %*s %lld", _read, _written) < 2) {
26 _E("Can't read number of sectors from %s", path);
33 _E("fclose failed: %s", strerror(errno));
42 mmc_write_sectors_per_uah =
43 config_get_int("mmc_write_sectors_per_uah", 2820, NULL);
44 mmc_read_sectors_per_uah =
45 config_get_int("mmc_read_sectors_per_uah", 4708, NULL);
50 float mmc_power_cons()
52 uint64_t _read, _written;
54 if (get_number_sectors(&_read, &_written) < 0) {
55 _E("get_number_sectors failed");
59 return _read / mmc_read_sectors_per_uah + _written / mmc_write_sectors_per_uah;