diff options
Diffstat (limited to 'src/qmicli/qmicli-dms.c')
-rw-r--r-- | src/qmicli/qmicli-dms.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c index 13b6a39..6f259f9 100644 --- a/src/qmicli/qmicli-dms.c +++ b/src/qmicli/qmicli-dms.c @@ -2996,7 +2996,7 @@ get_supported_messages_ready (QmiClientDms *client, QmiMessageDmsGetSupportedMessagesOutput *output; GError *error = NULL; GArray *bytearray = NULL; - GString *str = NULL; + gchar *str; output = qmi_client_dms_get_supported_messages_finish (client, res, &error); if (!output) { @@ -3017,30 +3017,11 @@ get_supported_messages_ready (QmiClientDms *client, g_print ("[%s] Successfully got supported DMS messages:\n", qmi_device_get_path_display (ctx->device)); - if (qmi_message_dms_get_supported_messages_output_get_list (output, &bytearray, NULL)) { - - guint bytearray_i; - - for (bytearray_i = 0; bytearray_i < bytearray->len; bytearray_i++) { - guint bit_i; - guint8 bytevalue; - - bytevalue = g_array_index (bytearray, guint8, bytearray_i); - for (bit_i = 0; bit_i < 8; bit_i++) { - if (bytevalue & (1 << bit_i)) { - if (!str) - str = g_string_new (""); - g_string_append_printf (str, "\t0x%04X\n", (bit_i + (8 * bytearray_i))); - } - } - } - } - - if (str) { - g_print ("%s", str->str); - g_string_free (str, TRUE); - } else - g_print ("\tnone\n"); + qmi_message_dms_get_supported_messages_output_get_list (output, &bytearray, NULL); + str = qmicli_get_supported_messages_list (bytearray ? (const guint8 *)bytearray->data : NULL, + bytearray ? bytearray->len : 0); + g_print ("%s", str); + g_free (str); qmi_message_dms_get_supported_messages_output_unref (output); shutdown (TRUE); |