diff --git a/config/kfmon.ini b/config/kfmon.ini index f436235..1c7cb97 100644 --- a/config/kfmon.ini +++ b/config/kfmon.ini @@ -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) \ No newline at end of file diff --git a/kfmon.c b/kfmon.c index 940bbe8..05053c2 100644 --- a/kfmon.c +++ b/kfmon.c @@ -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); @@ -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 } @@ -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, @@ -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", diff --git a/kfmon.h b/kfmon.h index afe0a1b..e520774 100644 --- a/kfmon.h +++ b/kfmon.h @@ -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