Skip to content

Commit

Permalink
drivers/usbhid-ups.c: clarify suggested settings fpr LB+RB log flood [#…
Browse files Browse the repository at this point in the history
…2437]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Aug 11, 2024
1 parent af181be commit 117eaa9
Showing 1 changed file with 46 additions and 6 deletions.
52 changes: 46 additions & 6 deletions drivers/usbhid-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ void upsdrv_initups(void)
lbrb_log_delay_sec = ipv;
}
} else {
/* Activate APC BXnnnnMI tweaks, for details see
/* Activate APC BXnnnMI/BXnnnnMI tweaks, for details see
* https://github.com/networkupstools/nut/issues/2347
*/
size_t productLen = hd->Product ? strlen(hd->Product) : 0;
Expand All @@ -1438,15 +1438,55 @@ void upsdrv_initups(void)
&& (strstr(hd->Product, " BX") || strstr(hd->Product, "BX") == hd->Product)
&& (hd->Product[productLen - 2] == 'M' && hd->Product[productLen - 1] == 'I')
) {
int got_lbrb_log_delay_without_calibrating = testvar("lbrb_log_delay_without_calibrating"),
got_onlinedischarge_calibration = testvar("onlinedischarge_calibration"),
got_onlinedischarge_log_throttle_sec = testvar("onlinedischarge_log_throttle_sec");

lbrb_log_delay_sec = 3;

upslogx(LOG_INFO, "Defaulting lbrb_log_delay_sec=%d "
"for %s model %s%s",
"for %s model %s%s%s%s%s%s%s%s%s%s",
lbrb_log_delay_sec,
hd->Vendor, hd->Product,
testvar("lbrb_log_delay_without_calibrating")
? "" : "; consider also setting the "
"lbrb_log_delay_without_calibrating "
"flag in your configuration");

!got_lbrb_log_delay_without_calibrating
|| !got_onlinedischarge_calibration
|| !got_onlinedischarge_log_throttle_sec
? "; consider also setting the " : "",

!got_lbrb_log_delay_without_calibrating
? "lbrb_log_delay_without_calibrating " : "",

!got_lbrb_log_delay_without_calibrating
&& (!got_onlinedischarge_calibration
|| !got_onlinedischarge_log_throttle_sec)
? "and/or " : "",

!got_onlinedischarge_calibration
? "onlinedischarge_calibration " : "",

(!got_lbrb_log_delay_without_calibrating
|| !got_onlinedischarge_calibration )
&& !got_onlinedischarge_log_throttle_sec
? "and/or " : "",

!got_onlinedischarge_log_throttle_sec
? "onlinedischarge_log_throttle_sec " : "",

!got_lbrb_log_delay_without_calibrating
|| !got_onlinedischarge_calibration
|| !got_onlinedischarge_log_throttle_sec
? "flag" : "",

2 > ( got_lbrb_log_delay_without_calibrating
+ got_onlinedischarge_calibration
+ got_onlinedischarge_log_throttle_sec)
? "(s)" : "",

!got_lbrb_log_delay_without_calibrating
|| !got_onlinedischarge_calibration
|| !got_onlinedischarge_log_throttle_sec
? " in your configuration" : "");
}
}

Expand Down

0 comments on commit 117eaa9

Please sign in to comment.