Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hss_led/LedController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ static std::string dispatch(State& state, const std::string& message, uid_t uid,
bool valid = false;
if (v[1] == "status" && v.size() == 2) {
return "OK owner=" + std::string(state.overrideActive ? "override" : state.automatic ? "auto" : "system") +
" backend=" + backend.name + " pending=" + std::to_string(dirty) + " pattern=" + state.effective().wire();
" backend=" + backend.name + " pending=" + std::to_string(dirty) +
" disabled=" + std::to_string(exists(disabled)) + " pattern=" + state.effective().wire();
}
if ((uid == administrator || uid == reporter) && v[1] == "report" && v.size() == 6) {
valid = parsePattern(v, 2, changed.report);
Expand Down Expand Up @@ -598,6 +599,7 @@ static const char usage[] =
" Maximum: 86400000 ms. Alternate/blink require positive durations.\n"
" COLOR 0 selects a steady color; unequal phase durations are allowed.\n\n"
"Commands return after acceptance; status shows pending hardware updates.\n"
" disabled=1: /etc/config/disableLED forces the radio LED off.\n"
"Control changes require root. The hss_led daemon must be running.\n\n"
"Examples:\n"
" hss_ledctl --led rpi-rf-mod alternate blue red slow\n"
Expand Down
5 changes: 4 additions & 1 deletion src/hss_led/tests/LedControllerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ int main() {
check(state.effective().a == 3);
check(command("1 system 3 3 0 0") == "OK accepted" && !state.overrideActive && !state.automatic);
check(command("1 report 4 4 0 0", 1234) == "OK accepted" && state.effective().a == 3);
put(disabled, ""); check(state.effective().a == 0); unlink(disabled.c_str());
check(command("1 status").find(" disabled=0 ") != std::string::npos);
put(disabled, ""); check(state.effective().a == 0);
check(command("1 status").find(" disabled=1 pattern=0 0 0 0") != std::string::npos);
unlink(disabled.c_str());
std::string before = state.wire();
for (const auto& msg : {"1 override 9 0 10 10", "1 report 1 2 0 0", "1 auto extra", "2 release", "1 system 1 2 0 1"})
check(command(msg).compare(0, 3, "ERR") == 0 && state.wire() == before);
Expand Down