1# Fan Control tool
2
3A tool that enables a user to view the status of a system in regard to fan
4control including the ability to manually set the fans to a desired RPM (or
5PWM if supported by the system). This tool has been tested against systems
6utilizing the phosphor-fan-presence repository set of fan applications (i.e.
7romulus, witherspoon, etc...) and is not warranted to work on systems using
8some other set of BMC fan applications.
9
10## Intention
11
12The intention of this tool is to temporarily stop the automatic fan control
13algorithm and allow the user to manually set the fans within the system chassis
14to a given target. Once a user no longer has a need to manually control the
15fans, the resume operation re-enables and restarts the phosphor-fan-control
16service. The status command provides a simple way to get the status of the fans
17along with the the main system states and fan control systemd service, while the
18reload command is available to commit JSON changes made to config files
19(YAML-based configurations are not reloadable).
20
21Note: In the case where a system does not have an active fan control algorithm
22enabled yet, an intended safe fan target should be set prior to resuming.
23
24## Usage
25
26```
27NAME
28  fanctl - Manually control, get fan tachs, view status, reload config,
29  and resume automatic control of all fans within a chassis.
30
31SYNOPSIS
32  fanctl [OPTION]
33
34OPTIONS
35set <TARGET> [TARGET SENSOR LIST]
36    <TARGET>
37        - RPM/PWM target to set the fans
38    [TARGET SENSOR LIST]
39        - space-delimited list of target sensors to set
40get
41    - Get the current fan target and feedback speeds for all rotors
42status
43    - Get the full system status in regard to fans
44reload
45    - Reload phosphor-fan configuration JSON files (YAML configuration not
46      supported)
47resume
48    - Resume automatic fan control
49    * Note: In the case where a system does not have an active fan control
50      algorithm enabled yet, an intended safe fan target should be set
51      prior to resuming
52dump
53    - Tell fan control to dump its caches and flight recorder.
54query_dump
55    - Provides arguments to search the dump file.
56help
57    - Display this help and exit
58```
59
60## Examples:
61
62- Set all fans to a target value (The tool determines whether the machine is
63    using RPM or PWM fan speeds, and sets them to the value provided):
64    > fanctl set 10500
65
66- Set only fan_0, fan1_0, fan2_0 to target 8500:
67    > fanctl set 8500 fan0_0 fan1_0 fan2_0
68
69- Resume automatic fan control:
70    > fanctl resume
71
72- Get the current fan target and feedback speeds for all rotors:
73    > fanctl get
74
75    ```
76    > fanctl get
77    TARGET SENSOR    TARGET(RPM)   FEEDBACK SENSOR    FEEDBACK(RPM)
78    ===============================================================
79    fan0_0             10000            fan0_0            7020
80                                        fan0_1           10000
81    fan1_0              2300            fan1_0            2192
82                                        fan1_1            2300
83    fan2_0              2300            fan2_0            2192
84                                        fan2_1            2300
85    fan3_0              3333            fan3_0            2839
86                                        fan3_1            3333
87    fan4_0              3333            fan4_0            2839
88                                        fan4_1            3333
89    fan5_0             10000            fan5_0            7020
90                                        fan5_1           10000
91    ```
92
93- Get the full system status in regard to fans:
94    > fanctl status
95
96    ```
97    Fan Control Service State   : loaded, inactive(dead)
98
99    CurrentBMCState     : xyz.openbmc_project.State.BMC.BMCState.Ready
100    CurrentPowerState   : xyz.openbmc_project.State.Chassis.PowerState.Off
101    CurrentHostState    : xyz.openbmc_project.State.Host.HostState.Off
102
103     FAN        TARGET(RPM)   FEEDBACK(RPM)  PRESENT     FUNCTIONAL
104    ===============================================================
105     fan0         10000        7020/10000      true         true
106     fan1         10000        7020/10000      true         true
107     fan2         10000        7020/10000      true         true
108     fan3         10000        7020/10000      true         true
109     fan4         10000        7020/10000      true         true
110     fan5         10000        7020/10000      true         true
111
112    ```
113
114- Reload all json config files in the order each is found: override location,
115    given `Compatible` interface location, default location.
116
117    > fanctl reload
118
119- Tell the fan control daemon to dump debug data to /tmp/fan\_control\_dump.json
120    > fanctl dump
121
122- Print all temperatures in the fan control cache after running 'fanctl dump':
123    > fanctl query_dump -s objects -n sensors/temperature -p Value
124
125- Print every interface and property in the Ambient temp sensor's cache entry:
126    > fanctl query_dump -s objects -n Ambient
127
128- Print the flight recorder after running 'fanctl dump':
129    > fanctl query_dump -s flight_recorder
130