diff --cc src/daemon.c
index 18b01fa,215558f..6f5073f
mode 100644,100755..100755
--- a/src/daemon.c
+++ b/src/daemon.c
diff --cc src/mbpfan.c
index c75c5db,0650113..b71a61c
mode 100644,100755..100755
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@@ -36,8 -36,7 +36,12 @@@
#include <string.h>
#include <math.h>
#include <syslog.h>
++<<<<<<< HEAD
+#include <sys/utsname.h>
+#include <sys/errno.h>
++=======
+ #include <linux/version.h>
++>>>>>>> 6bfe9325c37fb5f1f84437af0eeb592202bd5264
#include "mbpfan.h"
#include "global.h"
#include "settings.h"
@@@ -93,61 -68,34 +97,92 @@@ t_sensors *retrieve_sensors(
t_sensors *s = NULL;
char *path = NULL;
++<<<<<<< HEAD
+ char *path_begin = NULL;
+
+ if (is_legacy_kernel()) {
+ if(verbose) {
+ printf("Using legacy sensor path for kernel < 3.15.0\n");
+
+ if(daemonize) {
+ syslog(LOG_INFO, "Using legacy path for kernel < 3.15.0");
+ }
+ }
+
+ path_begin = (char *) "/sys/devices/platform/coretemp.0/temp";
+
+ } else {
+
+ if(verbose) {
+ printf("Using new sensor path for kernel >= 3.0.15\n");
+
+ if(daemonize) {
+ syslog(LOG_INFO, "Using new sensor path for kernel >= 3.0.15");
+ }
+ }
+
+ path_begin = (char *) "/sys/devices/platform/coretemp.0/hwmon/hwmon";
+
+ int counter;
+ for (counter = 0; counter < 10; counter++) {
+
+ char hwmon_path[strlen(path_begin)+1];
+
+ sprintf(hwmon_path, "%s%d", path_begin, counter);
+
+ // thanks http://stackoverflow.com/questions/18192998/plain-c-opening-a-directory-with-fopen
+ fopen(hwmon_path, "wb");
+
+ if (errno == EISDIR) {
+
+ path_begin = (char*) malloc(sizeof( char ) * (strlen(hwmon_path) + strlen("/temp") + 1));
+ strcpy(path_begin, hwmon_path);
+ strcat(path_begin, "/temp");
+
+ if(verbose) {
+ printf("Found hwmon path at %s\n", path_begin);
+
+ if(daemonize) {
+ syslog(LOG_INFO, "Found hwmon path at %s\n", path_begin);
+ }
+
+ }
+
+ break;
+ }
+ }
+ }
+
++=======
+
+
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
+
+ if(verbose) {
+ printf("Using legacy sensor path for kernel < 3.15.0\n");
+
+ if(daemonize) {
+ syslog(LOG_INFO, "Using legacy path for kernel < 3.15.0");
+ }
+ }
+
+ const char *path_begin = "/sys/devices/platform/coretemp.0/temp";
+
+ #else
+
+ if(verbose) {
+ printf("Using new sensor path for kernel >= 3.0.15\n");
+
+ if(daemonize) {
+ syslog(LOG_INFO, "Using new sensor path for kernel >= 3.0.15");
+ }
+ }
+
+ const char *path_begin = "/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp";
+
+ #endif
+
++>>>>>>> 6bfe9325c37fb5f1f84437af0eeb592202bd5264
const char *path_end = "_input";
int path_size = strlen(path_begin) + strlen(path_end) + 2;
Fixed conflict
2b1606025e4fb894c15982ee521d45b9cb554460
Daniel Graziotin <daniel@ineed.coffee> · 2014-06-22T17:13 ·
browse files at this commit