broadband-modem-mbim: log hex value of IP type if unknown

The L850 seems to report 0xFFFFFFFF as MbimContextIpType value, which
is not a correct value.

Instead of printing "(none)" (the default used by glib when trying to
print a NULL pointer as a string), make it so that we end up printing
the actual numeric value in hex.

   <dbg> [modem0] 'home' settings found at configuration index 0
   <dbg> [modem0] 'non-partner' settings found at configuration index 1
   <dbg> [modem0] 'partner' settings not found
   <dbg> [modem0] updates in the home LTE attach configuration settings:
   <dbg> [modem0]   ip type: 'unknown (0xffffffff)' -> ''ipv4v6'
   <dbg> [modem0] updates in the partner LTE attach configuration settings:
   <dbg> [modem0]   none (skipped)
   <dbg> [modem0] updates in the non-partner LTE attach configuration settings:
   <dbg> [modem0]   none
This commit is contained in:
Aleksander Morgado
2024-09-11 11:01:19 +00:00
parent 4748ebf300
commit a1f2d8c99b
3 changed files with 40 additions and 4 deletions
+14 -4
View File
@@ -4443,16 +4443,26 @@ update_lte_attach_configuration (MMBroadbandModemMbim *self,
}
if (!previous_config || !new_config || (previous_config->ip_type != new_config->ip_type)) {
g_autofree gchar *previous_ip_type = NULL;
g_autofree gchar *new_ip_type = NULL;
previous_ip_type = previous_config ? mm_mbim_context_ip_type_get_printable (previous_config->ip_type) : NULL;
new_ip_type = new_config ? mm_mbim_context_ip_type_get_printable (new_config->ip_type) : NULL;
mm_obj_dbg (self, " ip type: '%s' -> '%s'",
previous_config ? mbim_context_ip_type_get_string (previous_config->ip_type) : "",
new_config ? mbim_context_ip_type_get_string (new_config->ip_type) : "");
previous_ip_type ? previous_ip_type : "",
new_ip_type ? new_ip_type : "");
n_updates++;
}
if (!previous_config || !new_config || (previous_config->auth_protocol != new_config->auth_protocol)) {
g_autofree gchar *previous_auth_protocol = NULL;
g_autofree gchar *new_auth_protocol = NULL;
previous_auth_protocol = previous_config ? mm_mbim_auth_protocol_get_printable (previous_config->auth_protocol) : NULL;
new_auth_protocol = new_config ? mm_mbim_auth_protocol_get_printable (new_config->auth_protocol) : NULL;
mm_obj_dbg (self, " auth protocol: '%s' -> '%s'",
previous_config ? mbim_auth_protocol_get_string (previous_config->auth_protocol) : "",
new_config ? mbim_auth_protocol_get_string (new_config->auth_protocol) : "");
previous_auth_protocol ? previous_auth_protocol : "",
new_auth_protocol ? new_auth_protocol : "");
n_updates++;
}
+24
View File
@@ -457,6 +457,18 @@ mm_bearer_allowed_auth_to_mbim_auth_protocol (MMBearerAllowedAuth bearer_auth,
return MBIM_AUTH_PROTOCOL_NONE;
}
gchar *
mm_mbim_auth_protocol_get_printable (MbimAuthProtocol auth_protocol)
{
const gchar *str;
str = mbim_auth_protocol_get_string (auth_protocol);
if (str)
return g_strdup (str);
return g_strdup_printf ("unknown (0x%x)", auth_protocol);
}
/*****************************************************************************/
MMBearerApnType
@@ -617,6 +629,18 @@ mm_bearer_ip_family_to_mbim_context_ip_type (MMBearerIpFamily ip_family,
return MBIM_CONTEXT_IP_TYPE_DEFAULT;
}
gchar *
mm_mbim_context_ip_type_get_printable (MbimContextIpType ip_type)
{
const gchar *str;
str = mbim_context_ip_type_get_string (ip_type);
if (str)
return g_strdup (str);
return g_strdup_printf ("unknown (0x%x)", ip_type);
}
/*****************************************************************************/
gboolean
+2
View File
@@ -60,9 +60,11 @@ MMBearerAllowedAuth mm_bearer_allowed_auth_from_mbim_auth_protocol (MbimAuthProt
MbimAuthProtocol mm_bearer_allowed_auth_to_mbim_auth_protocol (MMBearerAllowedAuth bearer_auth,
gpointer log_object,
GError **error);
gchar *mm_mbim_auth_protocol_get_printable (MbimAuthProtocol auth_protocol);
MMBearerIpFamily mm_bearer_ip_family_from_mbim_context_ip_type (MbimContextIpType ip_type);
MbimContextIpType mm_bearer_ip_family_to_mbim_context_ip_type (MMBearerIpFamily ip_family,
GError **error);
gchar *mm_mbim_context_ip_type_get_printable (MbimContextIpType ip_type);
MMBearerApnType mm_bearer_apn_type_from_mbim_context_type (MbimContextType context_type);
MbimContextType mm_bearer_apn_type_to_mbim_context_type (MMBearerApnType apn_type,
gboolean mbim_extensions_supported,