Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
- Added ability to enable/disable on a per-fan basis
Browse files Browse the repository at this point in the history
- Added CLI args
- Fixed test all bug where only some devices were tested
- Fixed issue where fan recoveries were potentially tried without waiting between attempts
- Restore driver control of device once disabled
- Updated README

Signed-off-by: Hayden Briese <[email protected]>
  • Loading branch information
hbriese committed Jul 25, 2020
1 parent 8bbe4de commit 0517d18
Show file tree
Hide file tree
Showing 18 changed files with 536 additions and 436 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ set(SOURCE_FILES ${SRC}/main.cpp ${SRC}/main.hpp
${SRC}/Args.hpp ${SRC}/Args.cpp
${SRC}/Client.cpp ${SRC}/Client.hpp
${SRC}/Controller.cpp ${SRC}/Controller.hpp
${SRC}/FanThread.cpp ${SRC}/FanThread.hpp
${SRC}/Devices.cpp ${SRC}/Devices.hpp
${SRC}/FanInterface.cpp ${SRC}/FanInterface.hpp
${SRC}/SensorInterface.cpp ${SRC}/SensorInterface.hpp
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,20 @@ devices {
```text
fancon arg [value] ...
h help Show this help
s status Status of the controller
enable Enable controller (default: true)
disable Disable controller
reload Reload config
t test Test ALL (untested) fans
t test [fan] Test the given fan
s status Status of all fans
e enable Enable control of all fans
e enable [fan] Enable control of the fan
d disable Disable control of all fans
d disable [fan] Disable control of the fans
t test Test all (untested) fans
t test [fan] Test the fan if untested
f force Test even already tested fans (default: false)
c config [file] Config path (default: /etc/fancon.conf)
r reload Reload config
c config [file] Config path (default: /etc/fancon.conf)
service Start as service
d daemon Daemonize the process (default: false)
daemon Daemonize the process (default: false)
stop-service Stop the service
i sysinfo [file] Save system info to file (default: fancon_sysinfo.txt)
i sysinfo [file] Save system info to file (default: sysinfo.txt)
nv-init Init nvidia devices
v verbose Debug logging level
a trace Trace logging level
Expand Down
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fancon (0.21.2) UNRELEASED; urgency=low
fancon (0.22.0) UNRELEASED; urgency=low

* Initial release. Closes: #00000

Expand Down
31 changes: 18 additions & 13 deletions proto/DevicesSpec.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ message Fan {
uint32 id = 20;
}

message FanLabel {
string label = 1;
}

message Sensor {
DevType type = 1;
string label = 2;
Expand All @@ -72,31 +76,32 @@ message TestResponse {
int32 status = 1;
}

message ControllerState {
enum State {
message FanStatus {
enum Status {
ENABLED = 0;
DISABLED = 1;
RELOAD = 2;
TESTING = 2;
}
State state = 1;
Status status = 1;
}

message Empty {}

service DService {
rpc StopService(Empty) returns (Empty) {}
rpc Enable(Empty) returns (Empty) {}
rpc Disable(Empty) returns (Empty) {}
rpc Reload(Empty) returns (Empty) {}
rpc NvInit(Empty) returns (Empty) {}
rpc ControllerStatus(Empty) returns (ControllerState) {}

rpc GetDevices(Empty) returns (Devices) {}
rpc SetDevices(Devices) returns (Empty) {}
rpc SubscribeDevices(Empty) returns (stream Devices) {}
rpc GetEnumeratedDevices(Empty) returns (Devices) {}
rpc Test(TestRequest) returns (stream TestResponse) {}

rpc GetControllerConfig(Empty) returns (ControllerConfig) {}
rpc SetControllerConfig(ControllerConfig) returns (Empty) {}


rpc Status(FanLabel) returns (FanStatus) {}
rpc Enable(FanLabel) returns (Empty) {}
rpc EnableAll(Empty) returns (Empty) {}
rpc Disable(FanLabel) returns (Empty) {}
rpc DisableAll(Empty) returns (Empty) {}
rpc Test(TestRequest) returns (stream TestResponse) {}
rpc Reload(Empty) returns (Empty) {}
rpc NvInit(Empty) returns (Empty) {}
}
12 changes: 7 additions & 5 deletions src/Args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using fc::Util::is_root;

namespace fc {
static const char *DEFAULT_CONF_PATH(FANCON_SYSCONFDIR "/fancon.conf"),
*DEFAULT_SYSINFO_PATH = "fancon_sysinfo.txt";
*DEFAULT_SYSINFO_PATH = "sysinfo.txt";

class Arg {
public:
Expand All @@ -27,11 +27,13 @@ class Arg {

class Args {
public:
Arg help = {"help", "h"}, status = {"status", "s"}, enable = {"enable"},
disable = {"disable"}, reload = {"reload"},
Arg help = {"help", "h"}, status = {"status", "s"},
enable = {"enable", "e", true, false},
disable = {"disable", "d", true, false},
test = {"test", "t", true, false}, force = {"force", "f"},
reload = {"reload", "r"},
config = {"config", "c", true, true, DEFAULT_CONF_PATH, true},
service = {"service"}, daemon = {"daemon", "d"},
service = {"service"}, daemon = {"daemon"},
stop_service = {"stop-service"},
sysinfo = {"sysinfo", "i", true, true, DEFAULT_SYSINFO_PATH},
nv_init = {"nv-init"}, verbose = {"verbose", "v"}, trace = {"trace", "a"};
Expand All @@ -40,9 +42,9 @@ class Args {
{status.key, status},
{enable.key, enable},
{disable.key, disable},
{reload.key, reload},
{test.key, test},
{force.key, force},
{reload.key, reload},
{config.key, config},
{service.key, service},
{daemon.key, daemon},
Expand Down
Loading

0 comments on commit 0517d18

Please sign in to comment.