From a1f2d8c99b396887206d7a9dde50eef8c2e31c76 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 10 Sep 2024 13:56:20 +0000 Subject: 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. [modem0] 'home' settings found at configuration index 0 [modem0] 'non-partner' settings found at configuration index 1 [modem0] 'partner' settings not found [modem0] updates in the home LTE attach configuration settings: [modem0] ip type: 'unknown (0xffffffff)' -> ''ipv4v6' [modem0] updates in the partner LTE attach configuration settings: [modem0] none (skipped) [modem0] updates in the non-partner LTE attach configuration settings: [modem0] none --- src/mm-modem-helpers-mbim.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/mm-modem-helpers-mbim.c') diff --git a/src/mm-modem-helpers-mbim.c b/src/mm-modem-helpers-mbim.c index b96f6b50..49d38531 100644 --- a/src/mm-modem-helpers-mbim.c +++ b/src/mm-modem-helpers-mbim.c @@ -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 -- cgit v1.2.3-70-g09d2