static gboolean
get_nw_modem_snapshot (MMBaseModem *self,
                       GSimpleAsyncResult *simple,
                       MMModemAccessTechnology generic_act,
                       guint mask)
{
    SnapshotContext *ctx;
    GByteArray *nwsnap;
    MMPortSerialQcdm *port;

    port = mm_base_modem_peek_port_qcdm (self);
    if (!port)
        return FALSE;

    /* Setup context */
    ctx = g_new0 (SnapshotContext, 1);
    ctx->self = g_object_ref (self);
    ctx->port = g_object_ref (port);
    ctx->simple = simple;
    ctx->generic_act = generic_act;
    ctx->mask = mask;

    /* Try MSM6800 first since newer cards use that */
    nwsnap = g_byte_array_sized_new (25);
    nwsnap->len = qcdm_cmd_nw_subsys_modem_snapshot_cdma_new ((char *) nwsnap->data, 25, QCDM_NW_CHIPSET_6800);
    g_assert (nwsnap->len);
    mm_port_serial_qcdm_command (port,
                                 nwsnap,
                                 3,
                                 NULL,
                                 (GAsyncReadyCallback)nw_snapshot_new_cb,
                                 ctx);
    g_byte_array_unref (nwsnap);
    return TRUE;
}
Пример #2
0
static void
query_registration_state (MMGenericCdma *cdma,
                          MMModemCdmaRegistrationState cur_cdma_state,
                          MMModemCdmaRegistrationState cur_evdo_state,
                          MMModemCdmaRegistrationStateFn callback,
                          gpointer user_data)
{
    MMCallbackInfo *info;
    MMQcdmSerialPort *port;
    GByteArray *nwsnap;

    info = mm_generic_cdma_query_reg_state_callback_info_new (cdma, cur_cdma_state, cur_evdo_state, callback, user_data);

    port = mm_generic_cdma_get_best_qcdm_port (cdma, &info->error);
    if (!port) {
        mm_callback_info_schedule (info);
        return;
    }

    /* Try MSM6800 first since newer cards use that */
    nwsnap = g_byte_array_sized_new (25);
    nwsnap->len = qcdm_cmd_nw_subsys_modem_snapshot_cdma_new ((char *) nwsnap->data, 25, QCDM_NW_CHIPSET_6800);
    g_assert (nwsnap->len);
    mm_qcdm_serial_port_queue_command (port, nwsnap, 3, reg_nwsnap_6800_cb, info);
}
Пример #3
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_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);
}