Skip to content
Open
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
1 change: 1 addition & 0 deletions config/kfmon.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ db_timeout = 500 ; Maximum amount of time to wait (in ms) before deeming that th
; Good news: you shouldn't have to worry too much about this on FW >= 4.6 ;).
use_syslog = 0 ; Log to syslog instead of a file? Might be useful to save a few flash writes...
with_notifications = 1 ; Show on screen notifications for informational messages (i.e., successful startup of an action)
with_storage_notifications = 1 ; Show on screen notifications for storage discconected messages. (Useful to turn off for cleaner artwork when powered off)
22 changes: 15 additions & 7 deletions kfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static void
close(mfd);
// NOTE: We have to hide this behind a slightly crappy check, because this runs during load_config,
// at which point FBInk is not yet initialized...
if (fbinkConfig.row != 0) {
if (fbinkConfig.row != 0 && daemonConfig.with_storage_notifications) {
FB_PRINT("[KFMon] Internal storage unavailable, bye!");
}
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -410,6 +410,11 @@ static int
LOG(LOG_CRIT, "Passed an invalid value for with_notifications!");
return 0;
}
} else if (MATCH("daemon", "with_storage_notifications")) {
if (strtobool(value, &pconfig->with_storage_notifications) < 0) {
LOG(LOG_CRIT, "Passed an invalid value for with_storage_notifications!");
return 0;
}
} else {
return 0; // unknown section/name, error
}
Expand Down Expand Up @@ -819,11 +824,12 @@ static int
rval = -1;
} else {
LOG(LOG_NOTICE,
"Daemon config loaded from '%s': db_timeout=%hu, use_syslog=%s, with_notifications=%s",
"Daemon config loaded from '%s': db_timeout=%hu, use_syslog=%s, with_notifications=%s, with_storage_notifications=%s",
p->fts_name,
daemonConfig.db_timeout,
BOOL2STR(daemonConfig.use_syslog),
BOOL2STR(daemonConfig.with_notifications));
BOOL2STR(daemonConfig.with_notifications),
BOOL2STR(daemonConfig.with_storage_notifications));
}
} else if (strcasecmp(p->fts_name, "kfmon.user.ini") == 0) {
// NOTE: Skip the user config for now,
Expand Down Expand Up @@ -903,20 +909,22 @@ static int
rval = -1;
} else {
LOG(LOG_NOTICE,
"Daemon config loaded from '%s': db_timeout=%hu, use_syslog=%s, with_notifications=%s",
"Daemon config loaded from '%s': db_timeout=%hu, use_syslog=%s, with_notifications=%s, with_storage_notifications=%s",
"kfmon.user.ini",
daemonConfig.db_timeout,
BOOL2STR(daemonConfig.use_syslog),
BOOL2STR(daemonConfig.with_notifications));
BOOL2STR(daemonConfig.with_notifications),
BOOL2STR(daemonConfig.with_storage_notifications));
}
}

#ifdef DEBUG
// Let's recap (including failures)...
DBGLOG("Daemon config recap: db_timeout=%hu, use_syslog=%s, with_notifications=%s",
DBGLOG("Daemon config recap: db_timeout=%hu, use_syslog=%s, with_notifications=%s, with_storage_notifications=%s",
daemonConfig.db_timeout,
BOOL2STR(daemonConfig.use_syslog),
BOOL2STR(daemonConfig.with_notifications));
BOOL2STR(daemonConfig.with_notifications),
BOOL2STR(daemonConfig.with_storage_notifications));
for (uint8_t watch_idx = 0U; watch_idx < WATCH_MAX; watch_idx++) {
DBGLOG(
"Watch config @ index %hhu recap: active=%s, filename=%s, action=%s, label=%s, hidden=%s, block_spawns=%s, skip_db_checks=%s, do_db_update=%s, db_title=%s, db_author=%s, db_comment=%s",
Expand Down
1 change: 1 addition & 0 deletions kfmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ typedef struct
unsigned short int db_timeout;
bool use_syslog;
bool with_notifications;
bool with_storage_notifications;
} DaemonConfig;

// What a watch config should look like
Expand Down