Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mbpfan for openSUSE:Factory checked in at 2023-04-17 17:41:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mbpfan (Old) and /work/SRC/openSUSE:Factory/.mbpfan.new.2023 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mbpfan" Mon Apr 17 17:41:35 2023 rev:5 rq:1079883 version:2.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/mbpfan/mbpfan.changes 2022-12-05 18:02:35.409035411 +0100 +++ /work/SRC/openSUSE:Factory/.mbpfan.new.2023/mbpfan.changes 2023-04-17 17:41:47.150392150 +0200 @@ -1,0 +2,9 @@ +Wed Apr 12 15:42:16 UTC 2023 - Andrea Manzini <andrea.manz...@suse.com> + +- update to 2.4.0: + * Add support for alternate SMC path used with newer MacBooks, #236 + * Improved systemd integration, #250, #252, 253 + * Removed developer tests which confused users +- Added 0001-fix-pidfile-path.patch to align PID path to systemd service file + +------------------------------------------------------------------- Old: ---- mbpfan-2.3.0.tar.gz New: ---- 0001-fix-pidfile-path.patch mbpfan-2.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mbpfan.spec ++++++ --- /var/tmp/diff_new_pack.RbysaC/_old 2023-04-17 17:41:47.810396007 +0200 +++ /var/tmp/diff_new_pack.RbysaC/_new 2023-04-17 17:41:47.814396030 +0200 @@ -1,7 +1,7 @@ # # spec file for package mbpfan # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,15 @@ Name: mbpfan -Version: 2.3.0 +Version: 2.4.0 Release: 0 Summary: A simple daemon to control fan speed on all MacBook/MacBook Pros License: GPL-3.0-only URL: https://github.com/linux-on-mac/mbpfan Source0: https://github.com/linux-on-mac/mbpfan/archive/v%{version}/%{name}-%{version}.tar.gz Patch0: harden_mbpfan.service.patch +# PATCH-FIX-UPSTREAM fix-pidfile-path.patch +Patch1: 0001-fix-pidfile-path.patch BuildRequires: gcc BuildRequires: make BuildRequires: systemd-rpm-macros @@ -44,8 +46,7 @@ * Users can configure it using the file %{_sysconfdir}/mbpfan.conf %prep -%setup -q -%patch0 -p1 +%autosetup -p1 %build %if 0%{?suse_version} && 0%{?suse_version} < 1550 ++++++ 0001-fix-pidfile-path.patch ++++++ >From 98d68c15dd0e7ca8e410cebb3a55f872c1a189c9 Mon Sep 17 00:00:00 2001 From: Andrea Manzini <ilma...@gmail.com> Date: Fri, 14 Apr 2023 08:27:20 +0200 Subject: [PATCH] Update global.h to reflect `PIDFile=/run/mbpfan.pid` in the service file --- src/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global.h b/src/global.h index 1552511..363d0c9 100644 --- a/src/global.h +++ b/src/global.h @@ -3,7 +3,7 @@ #define PROGRAM_NAME "mbpfan" #define PROGRAM_VERSION "2.4.0" -#define PROGRAM_PID "/var/run/mbpfan.pid" +#define PROGRAM_PID "/run/mbpfan.pid" extern int daemonize; extern int verbose; ++++++ mbpfan-2.3.0.tar.gz -> mbpfan-2.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/Makefile new/mbpfan-2.4.0/Makefile --- old/mbpfan-2.3.0/Makefile 2022-02-26 06:20:38.000000000 +0100 +++ new/mbpfan-2.4.0/Makefile 2023-04-02 10:04:13.000000000 +0200 @@ -8,6 +8,7 @@ TESTS_BIN = bin/mbpfan-tests BIN = bin/mbpfan CONF = mbpfan.conf +DEPEND_MODULE = mbpfan.depend.conf DOC = README.md MAN = mbpfan.8.gz @@ -52,6 +53,7 @@ uninstall: rm /usr/sbin/mbpfan rm /etc/mbpfan.conf + rm /lib/modules-load.d/mbpfan.depend.conf rm /lib/systemd/system/mbpfan.service rm /usr/share/man/man8/mbpfan.8.gz rm -rf /usr/share/doc/mbpfan @@ -61,8 +63,10 @@ install -d $(DESTDIR)/etc install -d $(DESTDIR)/lib/systemd/system install -d $(DESTDIR)/usr/share/doc/mbpfan + install -d $(DESTDIR)/lib/modules-load.d install $(BIN) $(DESTDIR)/usr/sbin install -m644 $(CONF) $(DESTDIR)/etc + install -m644 $(DEPEND_MODULE) $(DESTDIR)/lib/modules-load.d install -m644 $(DOC) $(DESTDIR)/usr/share/doc/mbpfan install -d $(DESTDIR)/usr/share/man/man8 install -m644 $(MAN) $(DESTDIR)/usr/share/man/man8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/README.md new/mbpfan-2.4.0/README.md --- old/mbpfan-2.3.0/README.md 2022-02-26 06:20:38.000000000 +0100 +++ new/mbpfan-2.4.0/README.md 2023-04-02 10:04:13.000000000 +0200 @@ -223,6 +223,13 @@ sudo systemctl daemon-reload sudo systemctl start mbpfan.service +**dinit** +A [dinit](https://github.com/davmac314/dinit) service definition is also included. To use it, execute the following: + + sudo cp mbpfan.dinit /etc/dinit.d/mbpfan + sudo dinitctl enable mbpfan + sudo dinitctl start mbpfan + ## Usage Usage: ./mbpfan OPTION(S) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/mbpfan.depend.conf new/mbpfan-2.4.0/mbpfan.depend.conf --- old/mbpfan-2.3.0/mbpfan.depend.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/mbpfan-2.4.0/mbpfan.depend.conf 2023-04-02 10:04:13.000000000 +0200 @@ -0,0 +1 @@ +coretemp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/mbpfan.dinit new/mbpfan-2.4.0/mbpfan.dinit --- old/mbpfan-2.3.0/mbpfan.dinit 1970-01-01 01:00:00.000000000 +0100 +++ new/mbpfan-2.4.0/mbpfan.dinit 2023-04-02 10:04:13.000000000 +0200 @@ -0,0 +1,7 @@ +type = bgprocess +command = /usr/bin/mbpfan +restart = true +logfile = /var/log/dinit/mbpfan.log +waits-for = loginready +pid-file = /var/run/mbpfan.pid + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/mbpfan.service new/mbpfan-2.4.0/mbpfan.service --- old/mbpfan-2.3.0/mbpfan.service 2022-02-26 06:20:38.000000000 +0100 +++ new/mbpfan-2.4.0/mbpfan.service 2023-04-02 10:04:13.000000000 +0200 @@ -7,8 +7,9 @@ Type=simple ExecStart=/usr/sbin/mbpfan -f ExecReload=/usr/bin/kill -HUP $MAINPID -PIDFile=/var/run/mbpfan.pid +PIDFile=/run/mbpfan.pid Restart=always +RestartSec=1 [Install] WantedBy=sysinit.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/src/global.h new/mbpfan-2.4.0/src/global.h --- old/mbpfan-2.3.0/src/global.h 2022-02-26 06:20:38.000000000 +0100 +++ new/mbpfan-2.4.0/src/global.h 2023-04-02 10:04:13.000000000 +0200 @@ -2,7 +2,7 @@ #define _GLOBAL_H_ #define PROGRAM_NAME "mbpfan" -#define PROGRAM_VERSION "2.3.0" +#define PROGRAM_VERSION "2.4.0" #define PROGRAM_PID "/var/run/mbpfan.pid" extern int daemonize; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mbpfan-2.3.0/src/mbpfan.c new/mbpfan-2.4.0/src/mbpfan.c --- old/mbpfan-2.3.0/src/mbpfan.c 2022-02-26 06:20:38.000000000 +0100 +++ new/mbpfan-2.4.0/src/mbpfan.c 2023-04-02 10:04:13.000000000 +0200 @@ -31,6 +31,7 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <limits.h> #include <unistd.h> #include <string.h> #include <time.h> @@ -52,6 +53,7 @@ #define CORETEMP_PATH "/sys/devices/platform/coretemp.0" #define APPLESMC_PATH "/sys/devices/platform/applesmc.768" +#define ALT_APPLESMC_PATH "/sys/bus/acpi/drivers/applesmc" /* temperature thresholds * low_temp - temperature below which fan speed will be at minimum @@ -74,6 +76,9 @@ t_sensors *sensors = NULL; t_fans *fans = NULL; +char applesmc_path[PATH_MAX]; +char applesmc_fan_path[PATH_MAX]; + char *smprintf(const char *fmt, ...) { @@ -273,7 +278,7 @@ char *path_fan_max = NULL; char *path_fan_min = NULL; - const char *path_begin = "/sys/devices/platform/applesmc.768/fan"; + const char *path_begin = (const char *) &applesmc_fan_path; const char *path_output_end = "_output"; const char *path_label_end = "_label"; const char *path_man_end = "_manual"; @@ -553,15 +558,41 @@ } closedir(dir); + memset(&applesmc_path, 0, PATH_MAX); + memset(&applesmc_fan_path, 0, PATH_MAX); dir = opendir(APPLESMC_PATH); - if (ENOENT == errno) { - mbp_log(LOG_ERR, "%s needs applesmc support. Please either load it or build it into the kernel. Exiting.", program_path); - exit(EXIT_FAILURE); + if (ENOENT != errno) { + strncpy((char *) &applesmc_path, APPLESMC_PATH, PATH_MAX); + } else { + /** + * Check for alternate ACPI device path for newer macbooks + */ + closedir(dir); + dir = opendir(ALT_APPLESMC_PATH); + if (ENOENT != errno) { + struct dirent *ent; + while ((ent = readdir(dir)) != NULL) { + if (strncmp("APP", (const char *) &ent->d_name, 3) == 0) { + snprintf((char *) &applesmc_path, PATH_MAX, "%s/%s", ALT_APPLESMC_PATH, (char *) &ent->d_name); + break; + } + } + } } closedir(dir); + + if (strlen(applesmc_path) != 0) { + strncpy((char *) &applesmc_fan_path, (char *) &applesmc_path, PATH_MAX); + strcat((char *) &applesmc_fan_path, "/fan"); + if (verbose) mbp_log(LOG_INFO, "applesmc device path: %s", (char *) &applesmc_path); + + } else { + mbp_log(LOG_ERR, "%s needs applesmc support. Please either load it or build it into the kernel. Exiting.", program_path); + exit(EXIT_FAILURE); + } } int get_max_mhz(void)