diff --git a/Projects/la_mojo/build b/Projects/la_mojo/build index 59699e61..e30c9046 100755 --- a/Projects/la_mojo/build +++ b/Projects/la_mojo/build @@ -4,7 +4,7 @@ #make clean -e "CFG=Debug" #make -e "CFG=Debug" -j6 -make clean -e "CFG=Debug86" +#make clean -e "CFG=Debug86" make -e "CFG=Debug86" -j4 #make clean -e "CFG=Release86" diff --git a/lib/App/common/hardwareManager.cpp b/lib/App/common/hardwareManager.cpp index b1c0672b..a0ad3046 100644 --- a/lib/App/common/hardwareManager.cpp +++ b/lib/App/common/hardwareManager.cpp @@ -1417,9 +1417,32 @@ bool hardwareManager::updateSysInfo( DBC_SYS_LOAD_INFO *ptr ){ } else { LOG_ERROR("Error while getting Disk Info!"); }; - - //FILE *fd = popen("","r"); - ptr->temperature = 46.7; + //Temperature reading + ptr->temperature = -1; + if( fileExist( "/sys/class/thermal" ) ) { + char tB[128]; + // Check first 8 zones to find CPU one + for ( uint8_t i = 0; i < 8; i++ ) { + sprintf( tB, "/sys/class/thermal/thermal_zone%d", i ); + if ( fileExist( tB ) ) { + sprintf( tB, "/sys/class/thermal/thermal_zone%d/type", i ); + if ( fileExist( tB ) ) { + FILE *fd = fopen( tB, "r" ); + readLine( fd, tB, 128 ); + fclose(fd); + if ( strcasestr(tB,"cpu")!=NULL || strcasestr(tB,"x86_pkg")!=NULL) { + sprintf( tB, "/sys/class/thermal/thermal_zone%d/temp", i ); + FILE *fd = fopen( tB, "r" ); + readLine( fd, tB, 128 ); + fclose(fd); + ptr->temperature = ((float) atoll( tB )) / 1000.0f; + break; + }; + } else continue; + } else break; + }; + }; + return m_pDBC->updateServerUtilisation( ptr ); };