mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 22:44:27 -05:00 
			
		
		
		
	tools: add tmon package
Add the 'tmon' packages. This is as a tool to help visualize, tune, and test the complex thermal subsystem. We get a compile warning for the tool that the printf format does not fit. This commit contains a patch that fixes this warning. This patch has also been sent upstream to the Linux kernel [1]. Links: [1] https://lore.kernel.org/all/20231204141335.2798194-1-fe@dev.tdt.de/ Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
		
							parent
							
								
									5fec4d6cd5
								
							
						
					
					
						commit
						fd9d1e90b4
					
				
							
								
								
									
										53
									
								
								package/devel/tmon/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								package/devel/tmon/Makefile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
include $(INCLUDE_DIR)/kernel.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=tmon
 | 
			
		||||
PKG_VERSION:=$(LINUX_VERSION)
 | 
			
		||||
PKG_RELEASE:=1
 | 
			
		||||
 | 
			
		||||
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
 | 
			
		||||
PKG_LICENSE:=GPL-2.0-only
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
 | 
			
		||||
define Package/tmon
 | 
			
		||||
  SECTION:=devel
 | 
			
		||||
  CATEGORY:=Development
 | 
			
		||||
  TITLE:=Thermal monitoring and testing tool
 | 
			
		||||
  VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
 | 
			
		||||
  URL:=http://www.kernel.org
 | 
			
		||||
  DEPENDS:=+libncursesw
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/tmon/description
 | 
			
		||||
  As hardware vendors cope with the thermal constraints on their products,
 | 
			
		||||
  more and more sensors are added, new cooling capabilities are introduced.
 | 
			
		||||
  To expose such relationship to the userspace, Linux generic thermal layer
 | 
			
		||||
  introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
 | 
			
		||||
  links, trip point bindings, and device instances. To traverse such
 | 
			
		||||
  matrix by hand is not a trivial task.
 | 
			
		||||
  'TMON' is conceived as a tool to help visualize, tune, and test the
 | 
			
		||||
  complex thermal subsystem.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
MAKE_FLAGS = \
 | 
			
		||||
	ARCH="$(LINUX_KARCH)" \
 | 
			
		||||
	CROSS_COMPILE="$(TARGET_CROSS)" \
 | 
			
		||||
	CC="$(TARGET_CC)" \
 | 
			
		||||
	CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
 | 
			
		||||
	LDFLAGS="$(TARGET_LDFLAGS)"
 | 
			
		||||
 | 
			
		||||
define Build/Compile
 | 
			
		||||
	-$(MAKE) clean \
 | 
			
		||||
		-C $(LINUX_DIR)/tools/thermal/tmon
 | 
			
		||||
	+$(MAKE_FLAGS) $(MAKE) \
 | 
			
		||||
		-C $(LINUX_DIR)/tools/thermal/tmon
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/tmon/install
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/bin
 | 
			
		||||
	$(INSTALL_BIN) $(LINUX_DIR)/tools/thermal/tmon/tmon \
 | 
			
		||||
		$(1)/usr/bin/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call BuildPackage,tmon))
 | 
			
		||||
@ -0,0 +1,51 @@
 | 
			
		||||
From a7a94ca21ac0f347f683d33c72b4aab57ce5eec3 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Florian Eckert <fe@dev.tdt.de>
 | 
			
		||||
Date: Mon, 20 Nov 2023 11:13:20 +0100
 | 
			
		||||
Subject: [PATCH] tools/thermal/tmon: Fix compilation warning for wrong format
 | 
			
		||||
 | 
			
		||||
The following warnings are shown during compilation:
 | 
			
		||||
 | 
			
		||||
tui.c: In function 'show_cooling_device':
 | 
			
		||||
 tui.c:216:40: warning: format '%d' expects argument of type 'int', but
 | 
			
		||||
argument 7 has type 'long unsigned int' [-Wformat=]
 | 
			
		||||
   216 |                         "%02d %12.12s%6d %6d",
 | 
			
		||||
       |                                      ~~^
 | 
			
		||||
       |                                        |
 | 
			
		||||
       |                                        int
 | 
			
		||||
       |                                      %6ld
 | 
			
		||||
 ......
 | 
			
		||||
   219 |                         ptdata.cdi[j].cur_state,
 | 
			
		||||
       |                         ~~~~~~~~~~~~~~~~~~~~~~~
 | 
			
		||||
       |                                      |
 | 
			
		||||
       |                                      long unsigned int
 | 
			
		||||
 tui.c:216:44: warning: format '%d' expects argument of type 'int', but
 | 
			
		||||
argument 8 has type 'long unsigned int' [-Wformat=]
 | 
			
		||||
   216 |                         "%02d %12.12s%6d %6d",
 | 
			
		||||
       |                                          ~~^
 | 
			
		||||
       |                                            |
 | 
			
		||||
       |                                            int
 | 
			
		||||
       |                                          %6ld
 | 
			
		||||
 ......
 | 
			
		||||
   220 |                         ptdata.cdi[j].max_state);
 | 
			
		||||
       |                         ~~~~~~~~~~~~~~~~~~~~~~~
 | 
			
		||||
       |                                      |
 | 
			
		||||
       |                                      long unsigned int
 | 
			
		||||
 | 
			
		||||
To fix this, the correct string format must be used for printing.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
 | 
			
		||||
---
 | 
			
		||||
 tools/thermal/tmon/tui.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/tools/thermal/tmon/tui.c
 | 
			
		||||
+++ b/tools/thermal/tmon/tui.c
 | 
			
		||||
@@ -213,7 +213,7 @@ void show_cooling_device(void)
 | 
			
		||||
 		 * cooling device instances. skip unused idr.
 | 
			
		||||
 		 */
 | 
			
		||||
 		mvwprintw(cooling_device_window, j + 2, 1,
 | 
			
		||||
-			"%02d %12.12s%6d %6d",
 | 
			
		||||
+			"%02d %12.12s%6lu %6lu",
 | 
			
		||||
 			ptdata.cdi[j].instance,
 | 
			
		||||
 			ptdata.cdi[j].type,
 | 
			
		||||
 			ptdata.cdi[j].cur_state,
 | 
			
		||||
@ -0,0 +1,51 @@
 | 
			
		||||
From a7a94ca21ac0f347f683d33c72b4aab57ce5eec3 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Florian Eckert <fe@dev.tdt.de>
 | 
			
		||||
Date: Mon, 20 Nov 2023 11:13:20 +0100
 | 
			
		||||
Subject: [PATCH] tools/thermal/tmon: Fix compilation warning for wrong format
 | 
			
		||||
 | 
			
		||||
The following warnings are shown during compilation:
 | 
			
		||||
 | 
			
		||||
tui.c: In function 'show_cooling_device':
 | 
			
		||||
 tui.c:216:40: warning: format '%d' expects argument of type 'int', but
 | 
			
		||||
argument 7 has type 'long unsigned int' [-Wformat=]
 | 
			
		||||
   216 |                         "%02d %12.12s%6d %6d",
 | 
			
		||||
       |                                      ~~^
 | 
			
		||||
       |                                        |
 | 
			
		||||
       |                                        int
 | 
			
		||||
       |                                      %6ld
 | 
			
		||||
 ......
 | 
			
		||||
   219 |                         ptdata.cdi[j].cur_state,
 | 
			
		||||
       |                         ~~~~~~~~~~~~~~~~~~~~~~~
 | 
			
		||||
       |                                      |
 | 
			
		||||
       |                                      long unsigned int
 | 
			
		||||
 tui.c:216:44: warning: format '%d' expects argument of type 'int', but
 | 
			
		||||
argument 8 has type 'long unsigned int' [-Wformat=]
 | 
			
		||||
   216 |                         "%02d %12.12s%6d %6d",
 | 
			
		||||
       |                                          ~~^
 | 
			
		||||
       |                                            |
 | 
			
		||||
       |                                            int
 | 
			
		||||
       |                                          %6ld
 | 
			
		||||
 ......
 | 
			
		||||
   220 |                         ptdata.cdi[j].max_state);
 | 
			
		||||
       |                         ~~~~~~~~~~~~~~~~~~~~~~~
 | 
			
		||||
       |                                      |
 | 
			
		||||
       |                                      long unsigned int
 | 
			
		||||
 | 
			
		||||
To fix this, the correct string format must be used for printing.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
 | 
			
		||||
---
 | 
			
		||||
 tools/thermal/tmon/tui.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/tools/thermal/tmon/tui.c
 | 
			
		||||
+++ b/tools/thermal/tmon/tui.c
 | 
			
		||||
@@ -213,7 +213,7 @@ void show_cooling_device(void)
 | 
			
		||||
 		 * cooling device instances. skip unused idr.
 | 
			
		||||
 		 */
 | 
			
		||||
 		mvwprintw(cooling_device_window, j + 2, 1,
 | 
			
		||||
-			"%02d %12.12s%6d %6d",
 | 
			
		||||
+			"%02d %12.12s%6lu %6lu",
 | 
			
		||||
 			ptdata.cdi[j].instance,
 | 
			
		||||
 			ptdata.cdi[j].type,
 | 
			
		||||
 			ptdata.cdi[j].cur_state,
 | 
			
		||||
@ -89,6 +89,7 @@ USERSPACE_UTILS_FILES := \
 | 
			
		||||
	tools/power/cpupower \
 | 
			
		||||
	tools/scripts \
 | 
			
		||||
	tools/spi \
 | 
			
		||||
	tools/thermal/tmon \
 | 
			
		||||
	tools/usb/usbip
 | 
			
		||||
 | 
			
		||||
USERSPACE_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(USERSPACE_UTILS_FILES))))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user