mbpfan-josie

(sort of) fixes #8

a6cc7a45b68794153ca28b546274e318be02a534
Daniel Graziotin <dgraziotin@task3.cc> · 2012-06-15T21:47 · browse files at this commit

parents: 3551dcc

diff --git a/Makefile b/Makefile
index 7d38d07..dcbbdf5 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,13 @@ clean:
 
 install:
 	cp $(EXE) /usr/sbin
+	@echo "-----------------------------------------------------------------------------"
+	@echo "An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu fur sure)"
+	@echo "Is located in the main folder of the source files. It is called mbpfan.init."
+	@echo "Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)"
+	@echo "and move it to /etc/init.d"
+	@echo "Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults"
+	@echo "-----------------------------------------------------------------------------"
 
 rebuild: clean all
 #rebuild is not entirely correct
diff --git a/README.md b/README.md
index f230a2e..82893f4 100644
--- a/README.md
+++ b/README.md
@@ -29,16 +29,29 @@ Install Instructions
 --------------------
 
 Install with
-   make install
+   sudo make install
+
+It actually copies mbpfan to /usr/sbin.
+
+An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu fur sure)
+Is located in the main folder of the source files. It is called mbpfan.init.
+Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)
+and move it to /etc/init.d
+Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults (Ubuntu example)
 
-It actually copies mbpfan to /usr/sbin,
 
 Run Instructions
 ---------------------
 
-Run with
+If not installed, run with
 sudo bin/mbpfan
 
+If installed, manually run with
+sudo mbpfan
+
+If installed and using the init file, run with (Ubuntu example)
+sudo service mbpfan start
+
 
 License
 ---------------------
diff --git a/src/daemon.c b/src/daemon.c
index a9b7fa1..c6a5a3f 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -85,7 +85,7 @@ void signal_handler(int signal)
         }
 }
 
-void go_daemon(void (*mbpfan)())
+void go_daemon(void (*fan_control)())
 {
 
         // Setup signal handling before we start
@@ -168,7 +168,7 @@ void go_daemon(void (*mbpfan)())
         }
         
 
-        mbpfan();
+        fan_control();
 
         if(daemonize){
                 syslog(LOG_INFO, "%s daemon exiting", program_name);
diff --git a/src/main.c b/src/main.c
index ba2880e..6750b18 100644
--- a/src/main.c
+++ b/src/main.c
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
         }
 
         // pointer to mbpfan() function in mbpfan.c
-        void (*mbpfan)() = mbpfan;
-        go_daemon(mbpfan);
+        void (*fan_control)() = mbpfan;
+        go_daemon(fan_control);
         exit(0);
 }
\ No newline at end of file
diff --git a/src/mbpfan.c b/src/mbpfan.c
index 91f39a9..de1ea9d 100644
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@ -52,7 +52,7 @@ int low_temp = 63;   // try ranges 55-63
 int high_temp = 66;  // try ranges 58-66
 int max_temp = 86;   // do not set it > 90
 
-int polling_interval = 5;
+int polling_interval = 7;
 
 
 struct s_sensors {