Giter VIP home page Giter VIP logo

ats's People

Contributors

asgeirrr avatar chippey5 avatar tuxd3v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ats's Issues

Bug: fan not spinning

Have installed ats on my Rock64, running Armbian 22.05 Jammy, and am having trouble getting the fan to spin. The fan I'm using is the one that comes with this case, and it spins when I connect it to a battery. One possible issue is that I had to manually add an entry for PWM_CTL: running sudo find /sys -name pwm\*, I get:

/sys/kernel/tracing/events/pwm
/sys/kernel/tracing/events/pwm/pwm_apply
/sys/kernel/tracing/events/pwm/pwm_get
/sys/kernel/debug/tracing/events/pwm
/sys/kernel/debug/tracing/events/pwm/pwm_apply
/sys/kernel/debug/tracing/events/pwm/pwm_get
/sys/kernel/debug/pwm
/sys/class/pwm
/sys/bus/platform/drivers/pwm-clock
/sys/bus/platform/drivers/pwm-regulator
/sys/firmware/devicetree/base/pinctrl/pwm1
/sys/firmware/devicetree/base/pinctrl/pwm1/pwm1-pin
/sys/firmware/devicetree/base/pinctrl/pwmir
/sys/firmware/devicetree/base/pinctrl/pwmir/pwmir-pin
/sys/firmware/devicetree/base/pinctrl/pwm2
/sys/firmware/devicetree/base/pinctrl/pwm2/pwm2-pin
/sys/firmware/devicetree/base/pinctrl/pwm0
/sys/firmware/devicetree/base/pinctrl/pwm0/pwm0-pin
/sys/firmware/devicetree/base/__symbols__/pwm0_pin
/sys/firmware/devicetree/base/__symbols__/pwm3
/sys/firmware/devicetree/base/__symbols__/pwm1
/sys/firmware/devicetree/base/__symbols__/pwm1_pin
/sys/firmware/devicetree/base/__symbols__/pwmir_pin
/sys/firmware/devicetree/base/__symbols__/pwm2_pin
/sys/firmware/devicetree/base/__symbols__/pwm2
/sys/firmware/devicetree/base/__symbols__/pwm0
/sys/firmware/devicetree/base/pwm@ff1b0030
/sys/firmware/devicetree/base/pwm@ff1b0020
/sys/firmware/devicetree/base/pwm@ff1b0010
/sys/firmware/devicetree/base/pwm@ff1b0000

My guess was that I should use /sys/firmware/devicetree/base/pinctrl/pwm1. So, when I run ats -t, I get:

info:'SYSTEM' Table
info:    'BOARD' Table
info:        'NAME' = ROCK64
info:        'CPU'  = RK3328
info:    'THERMAL0_CTL' = /sys/class/thermal/thermal_zone0/temp
info:    'THERMAL1_CTL' = ERROR
info:    'PWM_CTL'      = /sys/firmware/devicetree/base/pinctrl/pwm1
info:    'MAX_CONTINUOUS_THERMAL_TEMP' = 45
info:    'MIN_CONTINUOUS_THERMAL_TEMP' = 20
info:    'MAX_PWM' = 255
info:    'MIN_PWM' = 40
info:    'ALWAYS_ON' = false
info:    'PROFILE_NAME' = profile0
info:    'PROFILE'      = 0
info:'Pratio' timers
info:    'Pratio[ -20 - 20 [' = 0
info:    'Pratio[ 20 ]'       = 40
...
info:    'Pratio[ 45 ]'       = 255
info:    'Pratio[ 45 - 70 ['  = 255

(the temperature range is low so that the fan would definitely run if it was working)
When I run this command, the fan doesn't spin.
For what it's worth, here's the rest of the output of ats -t:

Stopping for[ seconds ]............... 3
CPU Temperature[ max 70 °C ].......... 0
GPU Temperature[ max 70 °C ].......... 0
Fan PWM Duty Cycle value[ 0 - 255 ]... 190
--------------------
Running for[ seconds ]................ 10
CPU Temperature[ max 70 °C ].......... 39
GPU Temperature[ max 70 °C ].......... 0
Fan PWM Duty Cycle value[ 0 - 255 ]... 0
--------------------

Any idea what might be wrong?

[EDIT: rewrote results of searching for pwm with sudo, also if it helps the kernel version is 5.10.63 (not the latest, because I needed to revert to get the USB 3.0 port working]

make install fails

Building from source. I did have old fanctl code loaded but manually removed the binary and service before finding this new version

Install ATS Service File ..........: ats.service in systemd
V0.1.6 or older detected, Removing it from System..
find: ‘/{lib/systemd/system,usr/{sbin,lib/aarch64-linux-gnu/lua/5.3}}’: No such file or directory
Makefile:43: recipe for target 'install' failed

There is no directory /lua under aarch64-linux-gnu

Makefile is looking for old stuff to erase and the directory doesn't exist
find /{lib/systemd/system,usr/{sbin,lib/${TRIPLET}/lua/5.3}} -name fanctl -o -name sleep.so* -o -name fanctl.service -exec rm -v {} ; \

The if statement is uses || so it's finding some of those but not all so it drops in and then the error occurs.

Starting service failed on archlinux-arm on rockpro3399

I tried to install and run using the luarocks command. It installed and built correctly but starting the service gives an error. Here's my output:

# luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-0.2-0.rockspec

ats 0.2-0 depends on lua >= 5.3 (5.4-1 provided by VM)
Warning: variable CFLAGS was not passed in build_variables
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o debug.o src/debug.c
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o ats.o src/ats.c
gcc -shared -Wl,-soname,ats.so.0 -llua5.3  -o ats.so.0.9 debug.o ats.o
Install ATS Tool ..................: ats in /usr/local/sbin
Install ATS Config ................: ats.config in /etc
Install ATS Service File ..........: ats.service in systemd
Remove previous ATS Library .......: ats.so.* from /usr/local/lib/lua/5.3
Install new ATS Library ...........: ats.so.0.9 in /usr/local/lib/lua/5.3
Create soname symLink .............: ats.so in /usr/local/lib/lua/5.3
Starting ATS Service..
* ats.service - ATS - Active Thermal Service
     Loaded: loaded (/usr/lib/systemd/system/ats.service; enabled; vendor preset: disabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2022-03-22 21:15:17 UTC; 1s ago
    Process: 2266 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
   Main PID: 2266 (code=exited, status=1/FAILURE)
        CPU: 6ms

Mar 22 21:15:17 alarm systemd[1]: ats.service: Main process exited, code=exited, status=1/FAILURE
Mar 22 21:15:17 alarm systemd[1]: ats.service: Failed with result 'exit-code'.
make: *** [Makefile:119: install] Error 3

Error: Build error: Failed installing.

Do you support archlinux-arm?

Service installs but ats won't start.

First of all thanks for writing and sharing this project. 😃Seems like it will be very useful to have. I'm currently having a issue with my install though.

I've tried both the command with luarocks as well as using Git to clone the repo and build with make and make install.

make install fails with:

Install ATS Tool ..................: ats in /usr/local/sbin
Install ATS Service File ..........: ats.service in systemd
Remove previous ATS Library .......: ats.so.* from /usr/local/lib/lua/5.3
Install new ATS Library ...........: ats.so.0.2 in /usr/local/lib/lua/5.3
Create soname symLink .............: ats.so in /usr/local/lib/lua/5.3
Starting ATS Service..
● ats.service - ATS - Active Thermal Service
   Loaded: loaded (/lib/systemd/system/ats.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2018-11-07 23:38:04 UTC; 1s ago
  Process: 4154 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
 Main PID: 4154 (code=exited, status=1/FAILURE)
Makefile:45: recipe for target 'install' failed
make: *** [install] Error 3

And checking with sudo /usr/local/sbin/ats --test returns:

getConditions: Warning, Values { THERMAL0_CTL, THERMAL1_CTL, FAN_CTL }: /sys/class/thermal/thermal_zone0/temp, /sys/class/thermal/thermal_zone1/temp, ERROR
exit 1

Am I missing something?

Note: I'm using the RockPro64 with NAS case (including heatsink and fan).

fan not spinning ayufan new kernel release

i am running buster minimal and the fan isn't running with ats.

had no problem installing. fan turns on with manjaro arm so i know it works.

Linux rockpro64 5.6.0-1137-ayufan-ge57f05e7bf8f #ayufan SMP Wed Apr 15 10:16:02 UTC 2020 aarch64 GNU/Linux

Issue: Fan driving up every 120 s for 1 second

I'm controlling the NAS case fan with ats. When I start the service, then every 120 seconds the FAN is being started, so I can hear it spinning up. And then it stops immediately. I can see that there is no load on the system. Also the temperatures are below my configured threshold. What could be the cause of the phenomenon? How can provide more debug info?

Here my ats -t output:

info:'SYSTEM' Table 
info:    'BOARD' Table           
info:        'NAME' = ROCKPRO64   
info:        'CPU'  = RK3399      
info:    'THERMAL0_CTL' = /sys/class/thermal/thermal_zone0/temp
info:    'THERMAL1_CTL' = /sys/class/thermal/thermal_zone1/temp
info:    'PWM_CTL'      = /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1
info:    'MAX_CONTINUOUS_THERMAL_TEMP' = 60
info:    'MIN_CONTINUOUS_THERMAL_TEMP' = 45
info:    'MAX_PWM' = 255           
info:    'MIN_PWM' = 20            
info:    'ALWAYS_ON' = false       
info:    'PROFILE_NAME' = profile0 
info:    'PROFILE'      = 2        
info:'Pratio' timers               
info:    'Pratio[ -20 - 45 [' = 0  
info:    'Pratio[ 45 ]'       = 20 
info:    'Pratio[ 46 ]'       = 35 
info:    'Pratio[ 47 ]'       = 51 
info:    'Pratio[ 48 ]'       = 67      
info:    'Pratio[ 49 ]'       = 82      
info:    'Pratio[ 50 ]'       = 98      
info:    'Pratio[ 51 ]'       = 114       
info:    'Pratio[ 52 ]'       = 129
info:    'Pratio[ 53 ]'       = 145     
info:    'Pratio[ 54 ]'       = 161      
info:    'Pratio[ 55 ]'       = 176      
info:    'Pratio[ 56 ]'       = 192     
info:    'Pratio[ 57 ]'       = 208
info:    'Pratio[ 58 ]'       = 223       
info:    'Pratio[ 59 ]'       = 239      
info:    'Pratio[ 60 ]'       = 255      
info:    'Pratio[ 60 - 70 ['  = 255

Thanks for looking into this!

Release 0.2.0 fails to parse arch

I have a rockpro64, running the latest Armbian bionic ubuntu build.
Link to website
Link to download
For some reason when i try to build the latest version gcc complains theres no argument for -march=
Perhaps Armbian has a bad aarch output compared to the ayufan builds you've been using.
I was eventually able to compile the latest version by statically stating "armv8-a+crc" within the make file gcc commands rather then having it use $(Arch)
Heres the output from console using luarocks building process

root@rockpro64:~# luarocks build https://raw.githubusercontent.com/tuxd3v/ats/ma                                                                                                                                                             ster/ats-master-0.rockspec
Cloning into 'ats'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 24 (delta 1), reused 8 (delta 0), pack-reused 0
Receiving objects: 100% (24/24), 106.18 KiB | 1.66 MiB/s, done.
Resolving deltas: 100% (1/1), done.
Warning: variable CFLAGS was not passed in build_variables
** PLATFORM = linux  **
** OS       = 64Bits **
/usr/bin/env: 'lua': No such file or directory
** ARCH     =  **
/usr/bin/env: 'lua': No such file or directory
gcc -c -march= -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o debug.o src/                                                                                                                                                             debug.c
gcc: error: missing argument to '-march='
Makefile:191: recipe for target 'debug.o' failed
make: *** [debug.o] Error 1

Error: Build error: Failed building.

Doesn't play well with Manjaro and lua 5.4

[jay@rockpro64 ~]$ sudo luarocks build  https://raw.githubusercontent.com/tuxd3v/ats/master/ats-master-0.rockspec
Cloning into 'ats'...
remote: Enumerating objects: 2159, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 2159 (delta 30), reused 57 (delta 21), pack-reused 2082
Receiving objects: 100% (2159/2159), 740.61 KiB | 4.38 MiB/s, done.
Resolving deltas: 100% (1293/1293), done.

ats master-0 depends on lua >= 5.3 (5.4-1 provided by VM)
Warning: variable CFLAGS was not passed in build_variables
egrep: warning: egrep is obsolescent; using grep -E
** PLATFORM = linux  **
** OS       = 64Bits **
** ARCH     = Lua 5.4 Please install Lua >=5.3 **
** TUNE     = Lua 5.4 Please install Lua >=5.3 **
gcc -c -march=Lua 5.4 Please install Lua >=5.3 -mtune=Lua 5.4 Please install Lua >=5.3 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o debug.o src/debug.c
cc1: error: unknown value ‘lua’ for ‘-march’
cc1: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8.7-a armv8.8-a armv8-r armv9-a native
cc1: error: unknown value ‘lua’ for ‘-mtune’
cc1: note: valid arguments are: cortex-a34 cortex-a35 cortex-a53 cortex-a57 cortex-a72 cortex-a73 thunderx thunderxt88p1 thunderxt88 octeontx octeontx81 octeontx83 thunderxt81 thunderxt83 ampere1 emag xgene1 falkor qdf24xx exynos-m1 phecda thunderx2t99p1 vulcan thunderx2t99 cortex-a55 cortex-a75 cortex-a76 cortex-a76ae cortex-a77 cortex-a78 cortex-a78ae cortex-a78c cortex-a65 cortex-a65ae cortex-x1 ares neoverse-n1 neoverse-e1 octeontx2 octeontx2t98 octeontx2t96 octeontx2t93 octeontx2f95 octeontx2f95n octeontx2f95mm a64fx tsv110 thunderx3t110 zeus neoverse-v1 neoverse-512tvb saphira cortex-a57.cortex-a53 cortex-a72.cortex-a53 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a75.cortex-a55 cortex-a76.cortex-a55 cortex-r82 cortex-a510 cortex-a710 cortex-x2 neoverse-n2 demeter generic
make: *** [Makefile:191: debug.o] Error 1

Error: Build error: Failed building.
[jay@rockpro64 ~]$ ls /usr/include/lua*
-rw-r--r-- 1 root  21K Dec 27 10:41 /usr/include/luaconf.h
-rw-r--r-- 1 root  16K Dec 27 10:41 /usr/include/lua.h
-rw-r--r-- 1 root  191 Dec 27 10:41 /usr/include/lua.hpp
-rw-r--r-- 1 root 1.1K Dec 27 10:41 /usr/include/lualib.h

/usr/include/lua5.3:
total 100K
drwxr-xr-x   2 root 4.0K Jan 19 18:54 .
drwxr-xr-x 315 root  32K Jan 19 19:32 ..
-rw-r--r--   1 root 8.5K Sep 30  2020 lauxlib.h
-rw-r--r--   1 root  22K Sep 30  2020 luaconf.h
-rw-r--r--   1 root  15K Sep 30  2020 lua.h
-rw-r--r--   1 root  191 Sep 30  2020 lua.hpp
-rw-r--r--   1 root 1.3K Sep 30  2020 lualib.h

/usr/include/luajit-2.1:
total 84K
drwxr-xr-x   2 root 4.0K Jan 13 07:07 .
drwxr-xr-x 315 root  32K Jan 19 19:32 ..
-rw-r--r--   1 root 5.9K Dec 17 02:25 lauxlib.h
-rw-r--r--   1 root 4.5K Dec 17 02:25 luaconf.h
-rw-r--r--   1 root  13K Dec 17 02:25 lua.h
-rw-r--r--   1 root  135 Dec 17 02:25 lua.hpp
-rw-r--r--   1 root 3.0K Dec 17 02:25 luajit.h
-rw-r--r--   1 root 1.2K Dec 17 02:25 lualib.h

I do have lua53 installed from the AUR, and both lua5.3 and 5.4 are installed.

[jay@rockpro64 ~]$ lua5.4 -v
Lua 5.4.4  Copyright (C) 1994-2022 Lua.org, PUC-Rio
[jay@rockpro64 ~]$ lua5.3 -v
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio

Porting ATS to SOPine Baseboard

Hi tuxd3v

First of all, congratulations for the code. Very useful!

I am thinking to use that at a SOPine Baseboard (https://www.pine64.org/baseboard/), as follows:

CPU0 Temperature:
/sys/class/thermal/thermal_zone0/temp
GPU0 Temperature:
/sys/class/thermal/thermal_zone1/temp
GPU1 Temperature:
/sys/class/thermal/thermal_zone2/temp

PWM Control:
SOPine Baseboard PWM pin ---> Pi2 Header Pin 7 (A64 signal: S_PWM, pin: PL10) ---> gpio362

I have tried:

$ sudo vi /etc/ats.conf --->

---cut here---
--- Fan Cycling ON/OFF [ boolean ]
        ALWAYS_ON                       = false,

---  Assigning SysFs Locations for control..
        --
        -- CPU Thermal Zone[ String ]
        THERMAL0_CTL    = "/sys/class/thermal/thermal_zone0/temp",
        -- GPU Thermal Zone[ String ]
        THERMAL1_CTL    = "/sys/class/thermal/thermal_zone1/temp",
        -- FAN Control[ String ]
        --PWM_CTL         = "/sys/class/hwmon/hwmon0/pwm1",
        PWM_CTL= "/sys/class/gpio/gpio362/value",
---cut here---

and the service activates:

$ sudo systemctl status ats

  • ats.service - ATS - Active Thermal Service
    Loaded: loaded (/lib/systemd/system/ats.service; enabled; vendor preset: enabled)
    Active: active (running) since Wed 2019-10-16 22:43:34 UTC; 1min 5s ago
    Main PID: 1445 (lua)
    Tasks: 1 (limit: 2314)
    CGroup: /system.slice/ats.service
    `-1445 lua /usr/local/sbin/ats

but the behavior seems like ON-OFF and not driven by temperature...

Have I missed something?... :-/

Thanks in advance for any help.

PS: Fan can controlled to ON and OFF by CLI commands:
$ sudo cd /sys/class/gpio; echo 1 > gpio362/value
$ sudo cd /sys/class/gpio; echo 0 > gpio362/value

After a Reboot of the system the Fan keeps spinning with ats

Hi tuxd3v,

having a problem with 'ats'in combination with 'DietPi'

Have a look here at the DietPi forum:
https://dietpi.com/phpbb/viewtopic.php?p=41260#p41260

I start ats with

[code]
systemctl restart ats
[/code]

After this the Fan stops as expected.
But after a Reboot of the system the Fan keeps spinning.

Only after a restart of ats the Fan stops spinning

[code]
systemctl restart ats
[/code]

So what is causing the problem that after a Reboot and starting ats the Fan keeps running?
After a Restart of ats the Fan is OFF

Signed integers are used for array indexing

Pretty sure this function will crash if the temperature is negative, right?

static void setTriggers( ats_t *self ){
	fprintf( fstdout, "info:'Pratio' timers\n" );
	signed char i;
	/* to get pwm float char*/
	char number[11];
	/* Temperature limits */
	const signed char max		= self->ABSOLUTE_MAX_THERMAL_TEMP;
	const signed char min		= self->ABSOLUTE_MIN_THERMAL_TEMP;

	const signed char max_plus	= ( max + 10 );
	const signed char min_plus	= ( min - 10 );

	const signed char max_continuous_thermal_temp	= self->profile.MAX_CONTINUOUS_THERMAL_TEMP;
	const signed char min_continuous_thermal_temp	= self->profile.MIN_CONTINUOUS_THERMAL_TEMP;
	
	fprintf( fstdout, "info:    'Pratio[ %d - %d [' = %d\n", min, min_continuous_thermal_temp, self->ABSOLUTE_MIN_PWM );
	for ( i = min_plus; i <= max_plus; ++i ){

		if( i < min_continuous_thermal_temp ){

			Pratio[ i ] = self->ABSOLUTE_MIN_PWM;
			//Bellow -10°C, heat up the CPU[ -20°C, +80°C ]
			if( i <= -10 ){
				Qtimer[ i ]	= 360;
				Rtimer[ i ]	= 0;
...

Shutdown at ABSOLUTE_MAX_THERMAL_TEMP should not be mandatory

Thermal shutdown of a processor is not usually the job of something running in user-space. This is handled either in hardware or by the kernel.

This seems to be defined in the device-tree here, so the chip should shut down at 110 degrees centigrade. The absolute maximum temperature of the chip is 120 degrees, and the maximum ambient operating temperature is 80 degrees.

Thermal throttling on the Rockpro64 also occurs at 80 degrees. Switching off at 70 degrees seems very premature, especially since it isn't even given a chance to throttle before that happens! I don't want my home server to shut itself down whilst I'm away, since I wouldn't be able to restart it without pressing the physical button.

I think the thermal shutdown feature in ats should be configurable to allow it to be disabled. I also think that the ABSOLUTE_MAX_THERMAL_TEMP should be configurable, so I can set my MAX_CONTINUOUS_THERMAL_TEMP to be higher than 69.

ATS service not starting on nextcloudpi image

I'm running nextcloud on the rockpro64 based on the nextcloudpi image.

uname -r
5.4.5-rockchip64

I installed ats yesterday (using installation method A.1) and everything seemed to work properly which is great. On restarting the machine today to fan starting blowing on full power and didn't stop.

systemctl status ats confirms that the ats service fails:

● ats.service - ATS - Active Thermal Service
   Loaded: loaded (/lib/systemd/system/ats.service; bad; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2020-01-19 14:42:37 UTC; 4s ago
  Process: 3184 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
 Main PID: 3184 (code=exited, status=1/FAILURE)

I then tried to reinstall ats using the different options provided in the readme unfortunately without success. I was also not able to remove ats using the methods described.

user@nextcloudpi:~$ sudo luarocks remove ats
Error: Could not find rock 'ats' in /usr/local


user@nextcloudpi:~/ats$ make remove
/bin/sh: 1: [: -eq: unexpected operator

At this point I suspected I may have enabled the service although ats never had compiled succesfully. After stopping ats using systemctl stop ats I tried:

user@nextcloudpi:~$ sudo ats -t
getConditions: Warning, Values { THERMAL0_CTL, THERMAL1_CTL, FAN_CTL }: /sys/class/thermal/thermal_zone0/temp, /sys/class/thermal/thermal_zone1/temp, ERROR
exit 1

Both files mentioned in the error message contain 30000.

Doesn't work with Debian Bookworm, install spath changed

Doesn't work with Debian Bookworm, path changed

echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig

`Receiving objects: 100% (2159/2159), 740.61 KiB | 6.86 MiB/s, done.
Resolving deltas: 100% (1293/1293), done.

ats master-0 depends on lua >= 5.3 (5.3-1 provided by VM)
Warning: variable CFLAGS was not passed in build_variables
** PLATFORM = linux **
** OS = 64Bits **
** ARCH = armv8-a+crc **
** TUNE = cortex-a72.cortex-a53 **
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3 -o debug.o src/debug.c
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3 -o ats.o src/ats.c
gcc -shared -Wl,-soname,ats.so.0 -llua5.3 -o ats.so.0.9 debug.o ats.o
Install Method: LuaRocks ..
Makefile:106: *** ATS Binary Folder: /usr/local/lib/luarocks/rocks/ats/master-0, NOT Detected, ABORTING... Stop.

Error: Build error: Failed installing.
root@DietPi:~#`

ATS Binary Folder: /usr/local/lib/luarocks/rocks/ats/master-0, **NOT Detected**

the path changed in Debian Bookworm

root@DietPi:~# mkdir /usr/local/lib/luarocks/rocks/ats/master-0 mkdir: cannot create directory ‘/usr/local/lib/luarocks/rocks/ats/master-0’: No such file or directory root@DietPi:~# cd / root@DietPi:/# ls usr bin games include lib libexec local sbin share src root@DietPi:/# cd .. root@DietPi:/# ls bin boot dev etc home lib lost+found media mnt opt proc root run sbin srv sys tmp usr var root@DietPi:/# mkdir /usr/local/lib/luarocks/rocks/ats/master-0 mkdir: cannot create directory ‘/usr/local/lib/luarocks/rocks/ats/master-0’: No such file or directory root@DietPi:/# cd usr root@DietPi:/usr# cd local root@DietPi:/usr/local# cd lib root@DietPi:/usr/local/lib# ls luarocks python3.11 root@DietPi:/usr/local/lib# cd luarocks/ root@DietPi:/usr/local/lib/luarocks# ls rocks-5.3

it differs from

/usr/local/lib/luarocks/rocks/ats/master-0

/usr/local/lib/luarocks/rocks-5.3/
from here there are no more directories

Install issu Buster - Kernel 5.3

Hi tuxd3v,
while installing ats on Debian Buster (armbian kernel 5.3.11-rockchip64)

Install ATS Service File ..........: ats.service in '/usr/local/lib/luarocks/rocks/ats/master-0'
Install ATS Config ................: ats.config in '/usr/local/lib/luarocks/rocks/ats/master-0'
Install ATS Tool ..................: ats in '/usr/local/lib/luarocks/rocks/ats/master-0'
Install new ATS Library ...........: ats.so.0.9 in '/usr/local/lib/luarocks/rocks/ats/master-0'
Creating soname symLink ........: ats.so in '/usr/local/lib/luarocks/rocks/ats/master-0'
Creating Service symLink .......: ats.service in '/lib/systemd/system'
Creating Binary symLink ........: ats in '/usr/local/sbin/ats'
Creating Config symLink ........: ats.conf in '/etc/ats.conf'
Creating SharedObject symLink ..: ats.so.0.9 in '/usr/local/lib/lua/5.3'
Starting ATS Service..
● ats.service - ATS - Active Thermal Service
   Loaded: loaded (/usr/local/lib/luarocks/rocks/ats/master-0/ats.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2019-11-20 20:37:26 UTC; 6ms ago
  Process: 18116 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
 Main PID: 18116 (code=exited, status=1/FAILURE)

Nov 20 20:37:26 rockpro64 systemd[1]: ats.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 20:37:26 rockpro64 systemd[1]: ats.service: Failed with result 'exit-code'.
make: *** [Makefile:236: install] Error 3

Error: Build error: Failed installing.

Thanks for any help:)

`make remove` fails

root@rockpro64:/tmp/ats# make remove
/bin/sh: 1: [: -eq: unexpected operator
/bin/sh: 1: [: -eq: unexpected operator

Config gets overwritten on re-installation

I chose to go back to 0.2.0 from master, and followed the steps to install 0.2.0.

The installation was successfull, but /etc/ats.conf was overwritten by the defaults.

IMHO, config files should not be overwritten without confirmation.

Building on Fedora 32 aarch64 - rockpro64

I recently installed Fedora 32 on my RockPro64 and wanted ats.

There are few issues getting this to work.

  1. packages
    dnf install lua lua-devel lua-libs lua-luv lua-luv-devel -y
  2. include file location
  • Either symlink to the system folder, or modify the Makefile
    • ln -s /usr/include/lua-5.3 /usr/include/lua5.3
    • IDIR := /usr/include/lua-5.3
  1. Makefile
  • DEPS is just lua on F32 not lua5.3
  1. includes in the .c files ats.c debug.c
-#include <lua5.3/lauxlib.h>
-#include <lua5.3/lualib.h>
+#include <lua.h>
+#include <lauxlib.h>
+#include <lualib.h>
  1. Installation location of ats.so
  • modify LDIR in Makefile
    • LDIR := /usr/lib64/lua/5.3/
  1. PWM_CTL path is different than on debian/other systems.
  • /sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1

Install Issue

rock64@rockpro64:~$ sudo luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-0.2-0.rockspec
Warning: variable CFLAGS was not passed in build_variables
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3 -o debug.o src/debug.c
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3 -o ats.o src/ats.c
gcc -shared -Wl,-soname,ats.so.0 -llua5.3 -o ats.so.0.9 debug.o ats.o
Install ATS Tool ..................: ats in /usr/local/sbin
Install ATS Config ................: ats.config in /etc
Install ATS Service File ..........: ats.service in systemd
Remove previous ATS Library .......: ats.so.* from /usr/local/lib/lua/5.3
Install new ATS Library ...........: ats.so.0.9 in /usr/local/lib/lua/5.3
Create soname symLink .............: ats.so in /usr/local/lib/lua/5.3
Failed to enable unit: Unit file ats.service does not exist.
Makefile:103: recipe for target 'install' failed
make: *** [install] Error 1

Error: Build error: Failed installing.
rock64@rockpro64:~$ systemctl status ats
Warning: The unit file, source configuration file or drop-ins of ats.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● ats.service - ATS - Active Thermal Service
Loaded: loaded (/usr/local/lib/luarocks/rocks/ats/master-0/ats.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2019-06-24 02:47:14 UTC; 1s ago
Process: 17057 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
Main PID: 17057 (code=exited, status=1/FAILURE)

Jun 24 02:47:14 rockpro64 systemd[1]: ats.service: Failed with result 'exit-code'.
rock64@rockpro64:~$ sudo /usr/local/sbin/ats --test
getConditions: Warning, Values { THERMAL0_CTL, THERMAL1_CTL, FAN_CTL }: /sys/class/thermal/thermal_zone0/temp, /sys/class/thermal/thermal_zone1/temp, ERROR
exit 1

cannot disable service

root@rockpro64:/tmp/ats# systemctl disable ats
Failed to disable unit: No such file or directory

Fan is powered on, but stops frequently even with high temparature

The installation process and activation on my RockPro64 board is super-easy. The systemd unit is active immediately and I can test the program.

When running stress -c 6 to heat up the machine, the fan comes on above 40°C, but it stops again after a short while. It comes on & stops again, repeatedly, without the temperature going down below 44°C.

To demonstrate I made a quick screencast that shows the two thermal zones and the pwm1 fan control file (the middle pane): https://vimeo.com/manage/334078233/general

No changes were made in the configuration. I don't think anything else interferes with the control, as when I just echo 255 > /sys/class/hwmon/hwmon0/pwm1 the fan stays at full speed indefinitely.

PWM1 File keeps resetting to 0

Hey, it is still me,
i am running ATS on ubuntu Bionic with Kernel 5.3. Whenever i write something to the pwm1 file (/sys/class/hwmon/hwmon0/pwm1), and for that extend whenever the ats service writes to the file, it keeps resetting to 0 after some seconds.
I stopped every service possibly accessing the pwm file without any changes. When i try to see what happens with inotifywait, there is nothing happening....
Here is what is happening:
https://www.icloud.com/iclouddrive/06Wsxaxx7aLoIiWQSt9x6V0Ug#Screen_Recording_2019-12-06_at_08.46
thanks again for your help!

temp/pwm maybe too simple - cycles constantly - try a PID?

Finally got my NAS box buttoned up and noticed that the fan comes on for about 30 second and then off for a minute endlessly.

I think your algorithm is a bit too simple. You need more like a PID controller (at least a PI).
https://en.wikipedia.org/wiki/PID_controller. Right now you just have the P part. Without at least integral control you get the kind of behavior I am experiencing at the low end.

It might be too that the fan should stay on just a tad continuously at 39 to avoid this cycling on and off. Or possibly the initial on temp (>39) should be set higher the the off temp (39)

To this end I suggest you make it easier to change the algorithm outside the code (separate function in it's own file). That way it's easier for others to write/modify their own algorithm.

I see there are some basic PID codes out there even for LUA. Anyway you should check into this as a simple proportional controller rarely works well in the real world.

I get error on make install

● ats.service - ATS - Active Thermal Service
Loaded: loaded (/lib/systemd/system/ats.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2018-12-27 18:03:45 UTC; 1s ago
Process: 23494 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
Main PID: 23494 (code=exited, status=1/FAILURE)

Dec 27 18:03:45 rockpro64 systemd[1]: ats.service: Main process exited, code=exited, status=1/FAILURE
Dec 27 18:03:45 rockpro64 systemd[1]: ats.service: Failed with result 'exit-code'.
Makefile:102: recipe for target 'install' failed
make: *** [install] Error 3

Support for I²C PWM controller used on SOQuartz Model A Baseboard

I recently started setting up a SOQuartz Model A baseboard and attached a Waveshare CM4 heatsink with PWM controlled fan to the SOQuartz module. There is a GP7101 PWM controller sitting at address 0x58 on I²C bus 1, and one controls the fan by writing 8-bit values to data address 3, or 16-bit values to data address 2. I only ever tried the 8-bit mode. Writing 0x00:

i2cset -y 1 0x58 3 0x00

will turn the fan on permanently (this is the default status).

i2cset -y 1 0x58 3 0xff

turns the fan off permanently. Intermediate values result in the fan turning on and off at regular intervals, though this is not that noticeable below 0xd0 (1 second off, 2 seconds on)

I could try to add code to support this method of controlling the PWM fan since I don't think that there is a formal way to access the PWM controller via sysfs at this time.

Fans always run at full speed

I have purchased this https://pine64.com/product/rockpro64-metal-desktop-nas-casing and connected the fan on +FAN-.
Because the fan was always running at full speed, I've installed ats (with the command luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-master-0.rockspec) on my rockpro64 (Linux rockpro64 5.9.14-rockchip64 #20.11.4 SMP PREEMPT Tue Dec 15 08:52:20 CET 2020 aarch64 aarch64 aarch64 GNU/Linux) but, even if the current CPU temp is 35°C, the fan still run at full speed. I believe the fan should have stopped. I did not change the ats default configuration.
ats service is active (running).
Any idea on with it is not working as expected?

Bug: fan spinning on max pwm even when temperature is low enough

I notice sometimes that the temperature is around 34 degrees but the fan is stuck spinning at 255 pwm.
If I restart the ATS service, the pwm goes down to 0 because of the low temperature.

Hardware:
RockPro64 dietpi with ats master

Please let me know if you need any more information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.