Commit graph

287 commits

Author SHA1 Message Date
Andrea Manzini
98d68c15dd Update global.h
to reflect `PIDFile=/run/mbpfan.pid` in the service file
2023-04-14 16:02:33 +09:00
Andrew Gaul
a9c324db67 Bump version to 2.4.0 2023-04-02 17:04:13 +09:00
Robert Abram
1941f45395 Add support for alternate applesmc module device path. 2023-04-02 17:00:58 +09:00
Jack Kamm
d4473d440b Ensure lib/modules-load.d exists before installing there 2022-11-20 06:51:37 +09:00
Ethan D. Twardy
71d72cfc8b Fix PIDFile= reference, restart latency in systemd service
The run directory has been moved from /var/run to /run in systemd,
which results in the following warning at boot:

```
/usr/lib/systemd/system/mbpfan.service:10: PIDFile= references a path below legacy directory /var/run/, updating /var/run/mbpfan.pid → /run/mbpfan.pid; please update the unit file accordingly.
```

Additionally, the service occasionally fails to start if the service
is started before coretemp devices have finished probing, which results
in the following error. This patch fixes this issue.

```
systemd[1]: Started A fan manager daemon for MacBook Pro.
mbpfan[350]: /usr/sbin/mbpfan needs coretemp support. Please either load it or build it into the kernel. Exiting.
systemd[1]: mbpfan.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: mbpfan.service: Scheduled restart job, restart counter is at 1.
systemd[1]: Stopped A fan manager daemon for MacBook Pro.
systemd[1]: Started A fan manager daemon for MacBook Pro.
mbpfan[369]: /usr/sbin/mbpfan needs coretemp support. Please either load it or build it into the kernel. Exiting.
systemd[1]: mbpfan.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: mbpfan.service: Scheduled restart job, restart counter is at 2.
systemd[1]: Stopped A fan manager daemon for MacBook Pro.
mbpfan[380]: /usr/sbin/mbpfan needs coretemp support. Please either load it or build it into the kernel. Exiting.
systemd[1]: Started A fan manager daemon for MacBook Pro.
systemd[1]: mbpfan.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: mbpfan.service: Scheduled restart job, restart counter is at 3.
mbpfan[393]: /usr/sbin/mbpfan needs coretemp support. Please either load it or build it into the kernel. Exiting.
systemd[1]: Stopped A fan manager daemon for MacBook Pro.
systemd[1]: Started A fan manager daemon for MacBook Pro.
systemd[1]: mbpfan.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: mbpfan.service: Scheduled restart job, restart counter is at 4.
systemd[1]: Stopped A fan manager daemon for MacBook Pro.
systemd[1]: Started A fan manager daemon for MacBook Pro.
mbpfan[416]: /usr/sbin/mbpfan needs coretemp support. Please either load it or build it into the kernel. Exiting.
systemd[1]: mbpfan.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: mbpfan.service: Scheduled restart job, restart counter is at 5.
systemd[1]: Stopped A fan manager daemon for MacBook Pro.
systemd[1]: mbpfan.service: Start request repeated too quickly.
systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: Failed to start A fan manager daemon for MacBook Pro.
```
2022-11-06 14:19:51 -07:00
heimoshuiyu
95b6ba91b9 Add coretemp as module dependency at startup 2022-08-14 10:25:57 +09:00
Nathan Fritch
79813060f4 Create dinit service definition, update readme to include dinit instructions 2022-04-03 21:33:21 +09:00
Andrew Gaul
2dd04d5fb5 Update version to 2.3.0
Fixes #213.  References #247.
2022-02-26 14:20:38 +09:00
Andrew Gaul
623f44d0a5 Reformat source code with clang-tidy
Run with:

clang-format -i src/*

Closes #233.
2021-04-12 22:06:18 +09:00
Chow Loong Jin
16f28f900c Improve comments in the config around {low,high,max}_temp settings 2021-03-02 21:40:10 +09:00
Andrew Gaul
814af65b36 Log maximum MHz of all CPUs
Useful for monitoring intel_pstate effects.
2021-02-28 20:53:34 +09:00
localscope
52d897374d
Moved tests to separate binary (mbpfan-tests)
Removed instructions for using -t flag
Moved check_requirements function from main to mbpfan
Moved daemonize and verbose globals from main to daemon
Moved strings for program information from main to global.h
Moved strings for coretemp and applesmc paths from main to mbpfan.c
Updated Makefile
Turned on verboseness for testing
2020-05-19 23:06:27 +09:00
Andrew Gaul
10d6febeb4 Use smaller max_fan_speed in tests
This should allow iMacs to complete tests successfully.  Fixes #212.
Fixes #215.
2020-04-30 19:27:04 +09:00
Andrew Gaul
bc71232af2 Add AskUbuntu reference
Also use consistent heading.
2020-04-24 23:35:03 +09:00
Lyes Saadi
dd4ed658da Offcial Fedora Package #181 2020-01-12 21:20:12 +09:00
Andrew Gaul
49f544fd8d Only call va_start when needed 2019-11-24 16:09:31 +09:00
Andrew Gaul
7ac2eb01fc Do not resuse va_list without reinitialization
Fixes #206.
2019-11-24 13:52:38 +09:00
Andrew Gaul
0a9f03e615 Annotate mbp_log as having printf parameters 2019-11-24 13:52:38 +09:00
Andrew Gaul
b21aaa832c Reparent links into credits section 2019-11-01 12:23:34 -07:00
Andrew Gaul
29eeec18f5 Prefer HTTPS where possible
Also remove broken link.
2019-11-01 12:21:59 -07:00
Andrew Gaul
0ae57217f7 Emit version number on startup
Also configure syslog before logging.  References #163.
2019-10-30 21:04:52 -07:00
Andrew Gaul
1243d7df6c Update unit tests for fan speed auto-detection
Follows on to 716d9d877a08e0bce0b9a5cf7222ff3a4829e66.
References #190.
2019-10-30 20:59:08 -07:00
Andrew Gaul
28bc0a1bea Plug memory leaks during unit tests
Found via Valgrind.
2019-10-30 20:58:19 -07:00
Andrew Gaul
dae65c20a5 Only specify LIBS once
The $(BIN) rule already specifies this.
2019-10-30 20:24:00 -07:00
Andrew Gaul
110ccb5814 Address Valgrind warnings during unit tests 2019-10-30 16:04:33 -07:00
Andrew Gaul
abda2b8901 Add logging/printing helper
This eliminates duplicate code, fixes some log levels, and removes
unnecessary trailing newlines.  Fixes #202.
2019-10-30 15:45:59 -07:00
Andrew Gaul
0219257eff Move supported models to wiki 2019-10-28 23:41:46 -07:00
Andrew Gaul
d818571a78 Fix clang-tidy issues 2019-10-28 23:35:58 -07:00
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