mbpfan-josie

changes to legacy kernel detection

e7dd42e1255ad9e10134ca0f107c0a4f1b3eb7eb
Robert Musial <rmusial@fastmail.com> · 2017-03-27T11:44 · browse files at this commit

parents: 591b37a

diff --git a/AUTHORS b/AUTHORS
index 5c87ba3..ae03d37 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,7 +12,7 @@ Olivier Tilmans
 Yamakaky                <yamakaky AT gmail DOT com>
 Yi Yang                 <ahyangyi AT gmail DOT com>
 Herminio Hernandez Jr   <herminio.hernandezjr AT gmail DOT com>
-Robert Musial           <rmmm AT member DOT fsf DOT org>
+Robert Musial           <rmusial AT fastmail DOT com>
 
 
 ORIGINARY AUTHORS
diff --git a/README.md b/README.md
index 85a62e1..ed113bc 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,8 @@ Supported distributions:
 - RedHat
 - CentOS
 - Gentoo
-
+- Alpine
+- Trisquel
 
 Tested Macbook Models
 ---------------------
diff --git a/src/daemon.c b/src/daemon.c
index 611eef8..0ec8ead 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -2,7 +2,7 @@
  *  Copyright (C) 2012  Peter Lombardo <http://peterlombardo.wikidot.com/linux-daemon-in-c>
  *  Modifications (2012) by Ismail Khatib <ikhatib@gmail.com>
  *  Modifications (2012-present) by Daniel Graziotin <daniel@ineed.coffee>
- *  Modifications (2017-present) by Robert Musial <rmmm@member.fsf.org>
+ *  Modifications (2017-present) by Robert Musial <rmusial@fastmail.com>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
diff --git a/src/main.c b/src/main.c
index 7e67a5f..df5389a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
 /**
  *  Copyright (C) (2012-present) Daniel Graziotin <daniel@ineed.coffee>
- *  Modifications (2017-present) by Robert Musial <rmmm@member.fsf.org>
+ *  Modifications (2017-present) by Robert Musial <rmusial@fastmail.com>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
diff --git a/src/mbpfan.c b/src/mbpfan.c
index e3d1736..b122845 100644
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@ -4,7 +4,7 @@
  *  Modifications by Rafael Vega <rvega@elsoftwarehamuerto.org>
  *  Modifications (2012) by Ismail Khatib <ikhatib@gmail.com>
  *  Modifications (2012-present) by Daniel Graziotin <daniel@ineed.coffee> [CURRENT MAINTAINER]
- *  Modifications (2017-present) by Robert Musial <rmmm@member.fsf.org>
+ *  Modifications (2017-present) by Robert Musial <rmusial@fastmail.com>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -75,20 +75,30 @@ bool is_legacy_kernel()
         exit(EXIT_FAILURE);
     }
 
-    str_kernel_version = strtok(NULL, ".");
-    int kernel_version = atoi(str_kernel_version);
+    
+    // thanks http://stackoverflow.com/questions/18192998/plain-c-opening-a-directory-with-fopen
+    fopen("/sys/devices/platform/coretemp.0/hwmon", "wb");
 
-    if(verbose) {
-        printf("Detected kernel version: %s\n", kernel.release);
-        printf("Detected kernel minor revision: %s\n", str_kernel_version);
-
-        if(daemonize) {
-            syslog(LOG_INFO, "Kernel version: %s", kernel.release);
-            syslog(LOG_INFO, "Detected kernel minor revision: %s", str_kernel_version);
-        }
+    if (errno == EISDIR) {
+        return 0;
+    } else {
+        return 1;
     }
 
-    return (atoi(kernel.release) == 3 && kernel_version < 15);
+    // str_kernel_version = strtok(NULL, ".");
+    // int kernel_version = atoi(str_kernel_version);
+
+    // if(verbose) {
+    //     printf("Detected kernel version: %s\n", kernel.release);
+    //     printf("Detected kernel minor revision: %s\n", str_kernel_version);
+
+    //     if(daemonize) {
+    //         syslog(LOG_INFO, "Kernel version: %s", kernel.release);
+    //         syslog(LOG_INFO, "Detected kernel minor revision: %s", str_kernel_version);
+    //     }
+    // }
+
+    // return (atoi(kernel.release) == 3 && kernel_version < 15);
 }