cli: don't print signal quality unless modem is enabled
We don't have a clear way to report "unknown" signal quality, so for now just skip printing it altogether in the mmcli human output if the modem is not yet enabled.
This commit is contained in:
@@ -383,7 +383,7 @@ print_modem_info (void)
|
||||
mmcli_output_state (mm_modem_get_state (ctx->modem), mm_modem_get_state_failed_reason (ctx->modem));
|
||||
mmcli_output_string (MMC_F_STATUS_POWER_STATE, mm_modem_power_state_get_string (mm_modem_get_power_state (ctx->modem)));
|
||||
mmcli_output_string_list (MMC_F_STATUS_ACCESS_TECH, access_technologies_string);
|
||||
mmcli_output_signal_quality (signal_quality, signal_quality_recent);
|
||||
mmcli_output_signal_quality (mm_modem_get_state (ctx->modem), signal_quality, signal_quality_recent);
|
||||
|
||||
mmcli_output_string_multiline (MMC_F_MODES_SUPPORTED, supported_modes_string);
|
||||
mmcli_output_string_take (MMC_F_MODES_CURRENT, g_strdup_printf ("allowed: %s; preferred: %s",
|
||||
|
@@ -594,13 +594,17 @@ mmcli_output_listitem (MmcF field,
|
||||
/* (Custom) Signal quality output */
|
||||
|
||||
void
|
||||
mmcli_output_signal_quality (guint value,
|
||||
mmcli_output_signal_quality (MMModemState state,
|
||||
guint value,
|
||||
gboolean recent)
|
||||
{
|
||||
/* Merge value and recent flag in a single item in human output */
|
||||
if (selected_type == MMC_OUTPUT_TYPE_HUMAN) {
|
||||
if (state >= MM_MODEM_STATE_ENABLED)
|
||||
output_item_new_take_single (MMC_F_STATUS_SIGNAL_QUALITY_VALUE,
|
||||
g_strdup_printf ("%u%% (%s)", value, recent ? "recent" : "cached"));
|
||||
else
|
||||
output_item_new_take_single (MMC_F_STATUS_SIGNAL_QUALITY_VALUE, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -381,7 +381,8 @@ void mmcli_output_listitem (MmcF field,
|
||||
/******************************************************************************/
|
||||
/* Custom output management */
|
||||
|
||||
void mmcli_output_signal_quality (guint value,
|
||||
void mmcli_output_signal_quality (MMModemState state,
|
||||
guint value,
|
||||
gboolean recent);
|
||||
void mmcli_output_start_date (guint64 value);
|
||||
void mmcli_output_state (MMModemState state,
|
||||
|
Reference in New Issue
Block a user