예제 #1
0
static void
reg_nwsnap_6800_cb (MMQcdmSerialPort *port,
                    GByteArray *response,
                    GError *error,
                    gpointer user_data)
{
    MMCallbackInfo *info = user_data;
    QcdmResult *result;
    GByteArray *nwsnap;

    if (error)
        goto done;

    /* Parse the response */
    result = qcdm_cmd_nw_subsys_modem_snapshot_cdma_result ((const char *) response->data, response->len, NULL);
    if (!result) {
        /* Try for MSM6500 */
        nwsnap = g_byte_array_sized_new (25);
        nwsnap->len = qcdm_cmd_nw_subsys_modem_snapshot_cdma_new ((char *) nwsnap->data, 25, QCDM_NW_CHIPSET_6500);
        g_assert (nwsnap->len);
        mm_qcdm_serial_port_queue_command (port, nwsnap, 3, reg_nwsnap_6500_cb, info);
        return;
    }

    parse_modem_snapshot (info, result);
    qcdm_result_unref (result);

done:
    mm_callback_info_schedule (info);
}
static void
nw_snapshot_old_cb (MMPortSerialQcdm *port,
                    GAsyncResult *res,
                    SnapshotContext *ctx)
{
    QcdmResult *result;
    guint8 hdr_revision = QCDM_HDR_REV_UNKNOWN;
    GError *error = NULL;
    GByteArray *response;

    response = mm_port_serial_qcdm_command_finish (port, res, &error);
    if (error) {
        /* Just ignore the error and complete with the input info */
        mm_dbg ("Couldn't run QCDM Novatel Modem MSM6500 snapshot: '%s'", error->message);
        g_error_free (error);
        snapshot_context_complete_and_free (ctx, QCDM_HDR_REV_UNKNOWN);
        return;
    }

    /* Parse the response */
    result = qcdm_cmd_nw_subsys_modem_snapshot_cdma_result ((const gchar *) response->data, response->len, NULL);
    g_byte_array_unref (response);
    if (result) {
        qcdm_result_get_u8 (result, QCDM_CMD_NW_SUBSYS_MODEM_SNAPSHOT_CDMA_ITEM_HDR_REV, &hdr_revision);
        qcdm_result_unref (result);
    } else
        mm_dbg ("Failed to get QCDM Novatel Modem MSM6500 snapshot.");

    snapshot_context_complete_and_free (ctx, hdr_revision);
}
예제 #3
0
static void
reg_nwsnap_6500_cb (MMQcdmSerialPort *port,
                    GByteArray *response,
                    GError *error,
                    gpointer user_data)
{
    MMCallbackInfo *info = user_data;
    QcdmResult *result;

    if (!error) {
        result = qcdm_cmd_nw_subsys_modem_snapshot_cdma_result ((const char *) response->data, response->len, NULL);
        if (result) {
            parse_modem_snapshot (info, result);
            qcdm_result_unref (result);
        }
    }
    mm_callback_info_schedule (info);
}
static void
nw_snapshot_new_cb (MMPortSerialQcdm *port,
                    GAsyncResult *res,
                    SnapshotContext *ctx)
{
    QcdmResult *result;
    GByteArray *nwsnap;
    guint8 hdr_revision = QCDM_HDR_REV_UNKNOWN;
    GError *error = NULL;
    GByteArray *response;

    response = mm_port_serial_qcdm_command_finish (port, res, &error);
    if (error) {
        mm_dbg ("Couldn't run QCDM Novatel Modem MSM6800 snapshot: '%s'", error->message);
        g_error_free (error);
        snapshot_context_complete_and_free (ctx, QCDM_HDR_REV_UNKNOWN);
        return;
    }

    /* Parse the response */
    result = qcdm_cmd_nw_subsys_modem_snapshot_cdma_result ((const gchar *) response->data, response->len, NULL);
    g_byte_array_unref (response);
    if (result) {
        qcdm_result_get_u8 (result, QCDM_CMD_NW_SUBSYS_MODEM_SNAPSHOT_CDMA_ITEM_HDR_REV, &hdr_revision);
        qcdm_result_unref (result);
        snapshot_context_complete_and_free (ctx, hdr_revision);
        return;
    }

    mm_dbg ("Failed to get QCDM Novatel Modem MSM6800 snapshot.");

    /* Try for MSM6500 */
    nwsnap = g_byte_array_sized_new (25);
    nwsnap->len = qcdm_cmd_nw_subsys_modem_snapshot_cdma_new ((char *) nwsnap->data, 25, QCDM_NW_CHIPSET_6500);
    g_assert (nwsnap->len);
    mm_port_serial_qcdm_command (port,
                                 nwsnap,
                                 3,
                                 NULL,
                                 (GAsyncReadyCallback)nw_snapshot_old_cb,
                                 ctx);
    g_byte_array_unref (nwsnap);
}