diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-01-16 13:49:50 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-01-16 13:49:50 +0100 |
commit | 19224b4b9b6767dedabfbcbcf41b9eab94b852f9 (patch) | |
tree | e939f9843a818a48abf37de0ae55914594fe06a9 /src/osmo-bts-sysmo/misc/sysmobts_misc.c | |
parent | 3e110ae14101e60edc00803131165f11d4212db1 (diff) |
sysmobts-mgr: Make it possible to not write to the EEPROM
For testing/trial it is better to not write to the EEPROM
but it is still good to see how the logic is working.
Diffstat (limited to 'src/osmo-bts-sysmo/misc/sysmobts_misc.c')
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_misc.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_misc.c b/src/osmo-bts-sysmo/misc/sysmobts_misc.c index c4f308a1..74414d08 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_misc.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_misc.c @@ -106,7 +106,7 @@ static const struct { } }; -void sysmobts_check_temp(void) +void sysmobts_check_temp(int no_eeprom_write) { int temp_old[ARRAY_SIZE(temp_data)]; int temp_hi[ARRAY_SIZE(temp_data)]; @@ -135,12 +135,15 @@ void sysmobts_check_temp(void) LOGP(DTEMP, LOGL_NOTICE, "New maximum %s " "temperature: %d.%d C\n", temp_data[i].name, temp_hi[i]/1000, temp_hi[i]%1000); - rc = sysmobts_par_set_int(SYSMOBTS_PAR_TEMP_DIG_MAX, + + if (!no_eeprom_write) { + rc = sysmobts_par_set_int(SYSMOBTS_PAR_TEMP_DIG_MAX, temp_hi[0]/1000); - if (rc < 0) - LOGP(DTEMP, LOGL_ERROR, "error writing new %s " - "max temp %d (%s)\n", temp_data[i].name, - rc, strerror(errno)); + if (rc < 0) + LOGP(DTEMP, LOGL_ERROR, "error writing new %s " + "max temp %d (%s)\n", temp_data[i].name, + rc, strerror(errno)); + } } } } @@ -150,7 +153,7 @@ void sysmobts_check_temp(void) *********************************************************************/ static time_t last_update; -int sysmobts_update_hours(void) +int sysmobts_update_hours(int no_eeprom_write) { time_t now = time(NULL); int rc, op_hrs; @@ -188,9 +191,11 @@ int sysmobts_update_hours(void) LOGP(DTEMP, LOGL_INFO, "Total hours of Operation: %u\n", op_hrs); - rc = sysmobts_par_set_int(SYSMOBTS_PAR_HOURS, op_hrs); - if (rc < 0) - return rc; + if (!no_eeprom_write) { + rc = sysmobts_par_set_int(SYSMOBTS_PAR_HOURS, op_hrs); + if (rc < 0) + return rc; + } last_update = now; } |