control: command line tool to retrieve fan status (reload function)

This creates a fan control command line utility to report service status,
show target/actual RPM/PWM info, report present/functional status as
retrieved from D-Bus (or "Unknown" if not supported), and set target
RPM/PWM speeds for one or more fans. A "reload" command restarts the fan
control service to allow reload of configuration files. Note: reload
is only available for JSON-enabled configuration, YAML-based systems
emit an error when reload is run.

sample output:

root@p10bmc:~# fanctl status
Fan Control Service State   : loaded, inactive(dead)
CurrentBMCState     : xyz.openbmc_project.State.BMC.BMCState.Ready
CurrentPowerState   : xyz.openbmc_project.State.Chassis.PowerState.Off
CurrentHostState    : xyz.openbmc_project.State.Host.HostState.Off

 FAN        TARGET(RPM)  FEEDBACKS(RPMS)   PRESENT     FUNCTIONAL
===============================================================
 fan0              9777       9777/13267      true         true
 fan1              9777       9777/13267      true         true
 fan2              9777       9777/13267      true         true
 fan3              9777       9777/13267      true         true
 fan4              9777       9777/13267      true         true
 fan5              9777       9777/13267      true         true
root@p10bmc:~# fanctl set 8000 fan0 fan1
root@p10bmc:~# fanctl get
TARGET SENSOR    TARGET(RPM)   FEEDBACK SENSOR   FEEDBACK(RPM)
===============================================================
fan0_0                  8000            fan0_0             8000
                                        fan0_1            10691
fan1_0                  8000            fan1_0             8000
                                        fan1_1            10691
fan2_0                  9777            fan2_0             9777
                                        fan2_1            13267
fan3_0                  9777            fan3_0             9777
                                        fan3_1            13267
fan4_0                  9777            fan4_0             9777
                                        fan4_1            13267
fan5_0                  9777            fan5_0             9777
                                        fan5_1            13267
root@p10bmc:~# fanctl reload
root@p10bmc:~#

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: I19f25a2c47ffb84b1771fda4ea6ad17a9c78b8ec
1 file changed