Commit graph

259 commits

Author SHA1 Message Date
Andrew Gaul
2ed1671aa7 Prefer simpler strtod over sscanf 2019-10-28 23:33:43 -07:00
Andrew Gaul
2c743b08e9 Calculate temperature using maximum
Previously mbpfan used the mean temperature of all sensors which could
throttle processors by too slowly spinning the fans.  Fixes #199.
2019-10-28 23:25:41 -07:00
Andrew Gaul
a28dd3e208 Recalibrate after unexpected polling interval
During suspend fans may reset from manual to automatic control.
Fixes #148.
2019-10-28 23:21:38 -07:00
Andrew Gaul
8984322c0a Specify C99 standard
This allows // comments and for loop declarations.  Also specify some
feature test macros to access some system calls.  References #200.
2019-10-27 17:12:50 -07:00
Andrew Gaul
4722e79e72 Increase maximum sensors
2011 iMac has at least 50.  References #148.
2019-10-24 15:44:15 -07:00
Andrew Gaul
98a349724e Make logging consistent 2019-10-16 10:03:12 -07:00
Andrew Gaul
64f6ea509a Log fan label and speed next to each other 2019-10-16 09:57:19 -07:00
Andrew Gaul
6452c64d7a Do not recommend running tests
References #190.
2019-10-07 20:04:22 -07:00
Andrew Gaul
4f3cdfca3b Label fans during logging
This is more useful on desktops than laptops.
2019-10-07 20:02:43 -07:00
Andrew Gaul
559a2f39f1 Prefer smprintf instead of unsafe sprintf
Previously checking fans >= 10 overflowed the buffer and corrupted the
heap.  Found via AddressSanitizer.  Regression from
968133eb10.
2019-10-07 19:54:44 -07:00
Andrew Gaul
272ef08924 Add missing distro to table of contents 2019-10-04 15:14:14 -07:00
Lyes Saadi
9f55c0c2f0 Adding Fedora installation instructions. 2019-10-04 15:10:53 -07:00
David Dreggors
99ab1d0d99 Adding another 'tested with' line to README 2019-08-16 12:42:54 -07:00
jolupa
50834997b7 CRUX Linux package 2019-07-09 04:50:42 -07:00
Krutonium
d63fa7c7bf Add install instructions for Solus
As the title says, this adds the command line for Solus, since this is in the repos.
2019-05-14 14:53:39 +07:00
Andrew Gaul
f87082261f Recommend using Debian and Ubuntu packages 2019-05-02 14:19:47 +09:00
Krutonium
5df44bd5c2 Add MacBook Pro 3,1
Works Perfectly, as far as I can tell. The cooling on this computer isn't great so it rarely spins down.
2019-05-02 14:15:15 +09:00
Andrew Gaul
c77f23aa1b Change minimum and maximum fan speeds
MacBook Airs allow 1200-6500 and Mac Pro allow 500-5200.  Allow mbpfan
to configure smaller and larger values.  Also fix typo in constant
names.
2019-01-24 10:40:19 -08:00
Ati
53e1c35221 Add testing of Mac Pro models to README. Ref Issue #140 and (incidentally) #167 2019-01-22 18:26:29 -08:00
Daniel Graziotin
e0b2de34eb
Added travis badge [refs 173] 2019-01-21 14:20:00 +01:00
Andrew Gaul
07f19dea5f Add Travis configuration.
References #173.
2019-01-18 11:55:30 -08:00
Andrew Gaul
dd2c305593 Change default polling_interval to 1
This allows mbpfan to react more quickly to changing workloads and
avoid CPU throttling.  Also change unit test expectations.
Fixes #159.
2019-01-18 11:34:07 -08:00
mikaelbjoern
50f3a67ab4 Add support for many processors (not just cores)
Add an outer loop in mbpfan.c:retrieve_sensors to loop over all coretemp
directories. Also increase hard-coded limits from 10 to 12 or 16 since
the temp endpoints are sometimes indexed that high.
    
For example, this is required for supporting a Mac Pro with two processors
of 16 cores, requiring
/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp{1..12}
/sys/devices/platform/coretemp.1/hwmon/hwmon1/temp{1..12}
    
Fixes #152.
2019-01-18 11:26:11 -08:00
Andrew Gaul
c8f33ec055 Plug little leak
Found via Valgrind.
2019-01-15 15:44:54 -08:00
Ati Sharma
968133eb10 Add support for many processors (not just cores)
* Add support for many processors (not just cores)

Add an outer loop in mbpfan.c:retrieve_sensors to loop over all coretemp
directories. Also increase hard-coded limits from 10 to 12 or 16 since
the temp endpoints are sometimes indexed that high.

For example, this is required for supporting a Mac Pro with two processors
of 16 cores, requiring
/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp{1..12}
/sys/devices/platform/coretemp.1/hwmon/hwmon1/temp{1..12}

This solves issue #152 "Mac pro with two processors".
2018-09-20 01:53:21 +05:30
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
codutti
8db63a40af Removed autoconfig with suggested procedure because has been integrated on mbpfan. Commented auto detect values from config file. 2018-09-11 03:09:35 +05:30
faithful
87f3fc2c16 First spec attempt 2018-09-11 03:09:35 +05:30
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
d717ffb220 Add gaul to AUTHORS 2018-08-21 02:25:59 -07:00
Andrew Gaul
084b5c3cfa Improve capitalization, spelling, and whitespace 2018-08-20 22:18:55 -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
ddc219746f Allow overriding CC with environment variable 2018-08-20 15:19:04 -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
Peter Evjan
33e936300f Removed redundant systemd instructions
There were 3 sections giving advice on how to set up systemd. Removed
2 of them.

The first one under the Ubuntu header was incomplete, it didn't start
the service immediately. The 3rd one was already mentioned in the 2nd
section.
2018-08-21 02:04:29 +05:30
Daniel Graziotin
237eae73e8 Merge branch 'sasanj-mychanges' 2017-10-04 08:47:50 +00:00
Daniel Graziotin
72e457cd50 Merge branch 'mychanges' of git://github.com/sasanj/mbpfan into sasanj-mychanges 2017-10-04 08:47:16 +00:00
Daniel Graziotin
e0df856784 Merge branch 'gaul-warnings' 2017-10-04 08:41:52 +00:00
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
d6e4307919 Merge branch 'gaul-strings' 2017-10-04 08:33:15 +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
6486820199 Merge branch 'gaul-sigquit' 2017-10-04 08:28:17 +00:00