aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 43a9e229..873a1059 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -5905,15 +5905,25 @@ modem_3gpp_ussd_encode (MMIfaceModem3gppUssd *_self,
}
static gchar *
-modem_3gpp_ussd_decode (MMIfaceModem3gppUssd *self,
- const gchar *reply,
- GError **error)
+modem_3gpp_ussd_decode (MMIfaceModem3gppUssd *self,
+ const gchar *reply,
+ GError **error)
{
- MMBroadbandModem *broadband = MM_BROADBAND_MODEM (self);
+ MMBroadbandModem *broadband = MM_BROADBAND_MODEM (self);
+ guint8 *bin = NULL;
+ gsize bin_len = 0;
+ g_autoptr(GByteArray) barray = NULL;
+
+ bin = (guint8 *) mm_utils_hexstr2bin (reply, -1, &bin_len, error);
+ if (!bin) {
+ g_prefix_error (error, "Couldn't convert HEX string to binary: ");
+ return NULL;
+ }
+ barray = g_byte_array_new_take (bin, bin_len);
/* Decode from current charset (as per AT+CSCS, which is what most modems
* (except for Huawei it seems) will ask for. */
- return mm_modem_charset_hex_to_utf8 (reply, broadband->priv->modem_current_charset);
+ return mm_modem_charset_bytearray_to_utf8 (barray, broadband->priv->modem_current_charset, FALSE, error);
}
/*****************************************************************************/