Commit graph

104 commits

Author SHA1 Message Date
Andrew Gaul
1716d9d877 Update unit tests for fan speed auto-detection
Fixes #164.  References #114.
2018-09-13 10:29:48 -07:00
Andrew Gaul
b0cdfd4c27 Propagate exit code from unit tests
Also flag errors more clearly.  References #164.
2018-09-13 10:06:52 -07:00
Andrew Gaul
810adc671b Detect minimum and maximum fan speeds
Default to previous values if detection fails.  Configuration can
still override these values.  Fixes #114.
2018-08-29 00:07:34 +05:30
Andrew Gaul
4a3ea930ad Correctly detect legacy or modern sensors
Tighten check by looking for an actual sensor instead of a directory.
Fixes #162.  Fixes regression from
885a084f5c.
2018-08-23 19:39:02 -07:00
Andrew Gaul
e58a67f630 Avoid setting speed when already set to that speed 2018-08-21 04:08:47 +05:30
Andrew Gaul
ac099c8bd2 Report error when failing to set fan speed
References #155.
2018-08-20 15:28:34 -07:00
Andrew Gaul
8c89a671e8 Address GCC 7 warnings 2018-08-20 15:19:26 -07:00
Andrew Gaul
885a084f5c Correctly test sensor path for Linux prior to 3.15
Previously the fopen write mode caused the call to spuriously report
newer sensors.  Now we check the newer sensors path explicitly.  Also
plug file descriptor leak and more carefully check return values.
2018-08-21 03:41:42 +05:30
Andrew Gaul
ca52e9cefd Call nanosleep instead of sleep in polling loop
This avoids unnecessary rt_sigprocmask and rt_sigaction system calls.
2018-08-21 03:39:22 +05:30
Andrew Gaul
6aba92d649 Configure timer slack for 1 second
This allows the kernel scheduler to coalesce wakeups, improving
battery life.  Linux defaults to 50 ms slack.  Reference:

http://lwn.net/Articles/369549/
2018-08-21 03:37:52 +05:30
Andrew Gaul
e8850f682c Plug little leak from reused variable 2018-08-21 03:36:14 +05:30
Andrew Gaul
ce3218407f Check root privileges before running tests
References #155.
2018-08-21 03:35:27 +05:30
Daniel Graziotin
fcff5342d9 Merge branch 'warnings' of git://github.com/gaul/mbpfan into gaul-warnings 2017-10-04 08:38:42 +00:00
Daniel Graziotin
8130daa976 Merge branch 'strings' of git://github.com/gaul/mbpfan into gaul-strings 2017-10-04 08:31:12 +00:00
Daniel Graziotin
1da1639b3f Merge branch 'sigquit' of git://github.com/gaul/mbpfan into gaul-sigquit 2017-10-04 08:24:54 +00:00
Andrew Gaul
650471a273 Clean up string creation via smprintf and strdup
This fixes some bugs when using the incorrect strlen in strncat.
2017-08-16 18:27:57 -07:00
Andrew Gaul
8c2e11caae Enable -Wall and -Wextra 2017-07-21 18:21:15 -07:00
Andrew Gaul
cc970129fa Catch SIGQUIT
This resets automatic fan control.
2017-07-20 03:52:33 -07:00
Andrew Gaul
e95e19a3ea Avoid freeing static strings 2017-07-20 03:50:53 -07:00
Daniel Graziotin
b2cd98448f Merge branch 'reopen-fan' of git://github.com/andrewgaul/mbpfan into andrewgaul-reopen-fan 2017-07-20 12:06:28 +02:00
Daniel Graziotin
6c8dbec53f Merge branch 'sigstop' of git://github.com/andrewgaul/mbpfan into andrewgaul-sigstop 2017-07-20 09:34:59 +00:00
Daniel Graziotin
f3afd55720 Merge pull request #124 from andrewgaul/kernel-version
Correct kernel version message to >= 3.15.0
2017-07-20 09:29:33 +00:00
Andrew Gaul
399aad782a Do not repeatedly reopen fan and sensor devices
This avoids unnecessary system calls and saves battery.
2017-07-14 21:56:05 -07:00
Andrew Gaul
9034e1f843 Rewrite confusing conditional 2017-07-13 17:23:35 -07:00
Andrew Gaul
230f0be087 Do not attempt to catch uncatchable SIGSTOP
Eliminates a Valgrind warning:

==19239== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==19239==          the SIGSTOP signal is uncatchable
2017-07-12 20:04:38 -07:00
Andrew Gaul
12a6bb0daa Correct kernel version message to >= 3.15.0
This agrees with the other message which emits < 3.15.0.
2017-07-12 19:18:13 -07:00
Daniel Graziotin
5f2da79651 [Fix #117] eliminate redundant exec() in check_requirements 2017-06-21 11:39:16 +02:00
Daniel Graziotin
f20a2274e1 [#117] call closedir(dir) when checking requirements 2017-06-21 11:32:55 +02:00
Daniel Graziotin
4730988419 [fix #118] protect macro definitions 2017-06-21 11:26:32 +02:00
Daniel Graziotin
1ee0e1f1fa [fix #92] support for CentOS w/ Linux 3.10.0 but new sensors path 2017-04-02 16:59:50 +00:00
Daniel Graziotin
592895dc61 [Fix #105] fixed memory leak in retrieve_sensors() 2017-04-02 16:50:20 +00:00
Daniel Graziotin
565c5454c3 [Fix #104] support for clang, makefile cleaned from 'rmusial-master' 2017-04-02 16:32:09 +00:00
Daniel Graziotin
c3e1c9c2b7 Reverted to old legacy kernel detection [#92 needs investigation] 2017-04-02 16:31:39 +00:00
Robert Musial
e7dd42e125 changes to legacy kernel detection 2017-03-27 11:44:34 -04:00
Robert Musial
591b37a0e3 Update daemon.c 2017-03-26 01:53:12 -04:00
Robert Musial
b454fcef60 Update main.c 2017-03-26 01:52:45 -04:00
Robert Musial
28ca34edb2 Update mbpfan.c 2017-03-26 01:52:09 -04:00
Robert Musial
2f5c736b69 Update mbpfan.c 2017-03-24 18:03:03 -04:00
Robert Musial
b149238c29 Update main.c 2017-03-24 18:02:43 -04:00
Robert Musial
e2a62a9d21 Update daemon.c 2017-03-24 18:01:41 -04:00
Robert Musial
75002c0702 Update mbpfan.c 2017-03-22 00:33:58 -04:00
Robert Musial
13543b3b55 Update main.c 2017-03-22 00:32:04 -04:00
Robert Musial
8ed45aa5c2 Update daemon.c 2017-03-22 00:31:11 -04:00
Robert Musial
a7d3eb265d Update mbpfan.c 2017-03-20 14:16:50 -04:00
Robert Musial
b71375f6af Update main.c 2017-03-20 14:16:21 -04:00
Robert Musial
c52a624bac Update daemon.c 2017-03-20 14:15:58 -04:00
Robert Musial
a99aaad680 Changes to be committed:
modified:   AUTHORS
Updated personal info.

	modified:   Makefile
Beginning work to clean up Makefile. The original makefile appeared
to be checking if the system was Windows NT. Since this is for GNU/
Linux, that was removed. Also all of the code is C, but the
Makefile was calling the C++ compiler to hide bool issues and
missing typedefs (which C++ is ok with but C is not).

	modified:   src/daemon.c
Added structs, added stdbool.h

	modified:   src/main.c
Added stdbool.h

	modified:   src/mbpfan.c
Added stdbool.h

	modified:   src/minunit.c
Added stdbool.h
2017-03-19 13:43:55 -04:00
Aaron Riekenberg
11ec211b89 Flush standard out before sleeping in verbose mode. 2016-12-28 16:00:32 -06:00
Robert Musial
8582ed58ce Delete .minunit.c.swp
created by vim
2016-11-18 14:25:30 -05:00
Robert Musial
6e010e4116 added return 0; to line 106 to prevent core dump when compiled with clang 2016-11-18 14:16:59 -05:00