[PATCH] Fix signal strength when built with --with-newest-qmi-commands

Aleksander Morgado aleksander at aleksander.es
Thu Sep 11 02:38:56 PDT 2014


On 11/09/14 03:55, David McCullough wrote:
> 
> This patch fixes the signal strength values when using ModemManager built
> with --with-newest-qmi-commands.
> 
> It was never getting a valid signal strength because the default (0) is
> always greater than a valid signal strength, and the rssi_max handling
> was completely wrong.
> 
> Signed-off-by: David McCullough <david.mccullough at accelecon.com>
> 

Pushed to git master, thanks.

> 
> diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
> index d0d672a..045b370 100644
> --- a/src/mm-broadband-modem-qmi.c
> +++ b/src/mm-broadband-modem-qmi.c
> @@ -2237,7 +2237,7 @@ signal_info_get_quality (MMBroadbandModemQmi *self,
>                           QmiMessageNasGetSignalInfoOutput *output,
>                           gint8 *out_quality)
>  {
> -    gint8 rssi_max = 0;
> +    gint8 rssi_max = -125;
>      gint8 rssi;
>  
>      g_assert (out_quality != NULL);
> @@ -2248,31 +2248,31 @@ signal_info_get_quality (MMBroadbandModemQmi *self,
>      if (qmi_message_nas_get_signal_info_output_get_cdma_signal_strength (output, &rssi, NULL, NULL)) {
>          mm_dbg ("RSSI (CDMA): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_CDMA_1X))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_message_nas_get_signal_info_output_get_hdr_signal_strength (output, &rssi, NULL, NULL, NULL, NULL)) {
>          mm_dbg ("RSSI (HDR): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_CDMA_1XEVDO))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_message_nas_get_signal_info_output_get_gsm_signal_strength (output, &rssi, NULL)) {
>          mm_dbg ("RSSI (GSM): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_GSM))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_message_nas_get_signal_info_output_get_wcdma_signal_strength (output, &rssi, NULL, NULL)) {
>          mm_dbg ("RSSI (WCDMA): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_UMTS))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_message_nas_get_signal_info_output_get_lte_signal_strength (output, &rssi, NULL, NULL, NULL, NULL)) {
>          mm_dbg ("RSSI (LTE): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_LTE))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      /* This RSSI comes as negative dBms */
> @@ -2280,7 +2280,7 @@ signal_info_get_quality (MMBroadbandModemQmi *self,
>  
>      mm_dbg ("RSSI: %d dBm --> %u%%", rssi_max, *out_quality);
>  
> -    return (rssi_max < 0);
> +    return (rssi_max > -125);
>  }
>  
>  static void
> @@ -6348,7 +6348,7 @@ signal_info_indication_cb (QmiClientNas *client,
>                             QmiIndicationNasSignalInfoOutput *output,
>                             MMBroadbandModemQmi *self)
>  {
> -    gint8 rssi_max = 0;
> +    gint8 rssi_max = -125;
>      gint8 rssi;
>      guint8 quality;
>  
> @@ -6361,31 +6361,31 @@ signal_info_indication_cb (QmiClientNas *client,
>      if (qmi_indication_nas_signal_info_output_get_cdma_signal_strength (output, &rssi, NULL, NULL)) {
>          mm_dbg ("RSSI (CDMA): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_CDMA_1X))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_indication_nas_signal_info_output_get_hdr_signal_strength (output, &rssi, NULL, NULL, NULL, NULL)) {
>          mm_dbg ("RSSI (HDR): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_CDMA_1XEVDO))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_indication_nas_signal_info_output_get_gsm_signal_strength (output, &rssi, NULL)) {
>          mm_dbg ("RSSI (GSM): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_GSM))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_indication_nas_signal_info_output_get_wcdma_signal_strength (output, &rssi, NULL, NULL)) {
>          mm_dbg ("RSSI (WCDMA): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_UMTS))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (qmi_indication_nas_signal_info_output_get_lte_signal_strength (output, &rssi, NULL, NULL, NULL, NULL)) {
>          mm_dbg ("RSSI (LTE): %d dBm", rssi);
>          if (qmi_dbm_valid (rssi, QMI_NAS_RADIO_INTERFACE_LTE))
> -            rssi = MAX (rssi, rssi_max);
> +            rssi_max = MAX (rssi, rssi_max);
>      }
>  
>      if (rssi_max < 0) {
> 
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list