static int qmi_network_up(struct qmi_ctxt *ctxt, char *apn) { unsigned char data[96 + QMUX_OVERHEAD]; struct qmi_msg msg; char *auth_type; char *user; char *pass; for (user = apn; *user; user++) { if (*user == ' ') { *user++ = 0; break; } } for (pass = user; *pass; pass++) { if (*pass == ' ') { *pass++ = 0; break; } } for (auth_type = pass; *auth_type; auth_type++) { if (*auth_type == ' ') { *auth_type++ = 0; break; } } msg.service = QMI_WDS; msg.client_id = ctxt->wds_client_id; msg.txn_id = ctxt->wds_txn_id; msg.type = 0x0020; msg.size = 0; msg.tlv = data + QMUX_HEADER; ctxt->wds_txn_id += 2; qmi_add_tlv(&msg, 0x14, strlen(apn), apn); if (*auth_type) qmi_add_tlv(&msg, 0x16, strlen(auth_type), auth_type); if (*user) { if (!*auth_type) { unsigned char x; x = 3; qmi_add_tlv(&msg, 0x16, 1, &x); } qmi_add_tlv(&msg, 0x17, strlen(user), user); if (*pass) qmi_add_tlv(&msg, 0x18, strlen(pass), pass); } return qmi_send(ctxt, &msg); }
static int qmi_network_down(struct qmi_ctxt *ctxt) { unsigned char data[16 + QMUX_OVERHEAD]; struct qmi_msg msg; msg.service = QMI_WDS; msg.client_id = ctxt->wds_client_id; msg.txn_id = ctxt->wds_txn_id; msg.type = 0x0021; msg.size = 0; msg.tlv = data + QMUX_HEADER; ctxt->wds_txn_id += 2; qmi_add_tlv(&msg, 0x01, sizeof(ctxt->wds_handle), &ctxt->wds_handle); return qmi_send(ctxt, &msg); }
static int qmi_request_ans1(struct qmi_ctxt *ctxt) { unsigned char data[64 + QMUX_OVERHEAD]; struct qmi_msg msg; unsigned char n; msg.service = 0x03; msg.client_id = 1;//qmi_ctl_client_id; msg.txn_id = 1; msg.type = 0x0001; msg.size = 0; msg.tlv = data + QMUX_HEADER; n = 0x00; qmi_add_tlv(&msg, 0x01, 0x01, &n); return qmi_send(ctxt, &msg); }
static int qmi_request_wds_cid(struct qmi_ctxt *ctxt) { unsigned char data[64 + QMUX_OVERHEAD]; struct qmi_msg msg; unsigned char n; msg.service = QMI_CTL; msg.client_id = qmi_ctl_client_id; msg.txn_id = ctxt->ctl_txn_id; msg.type = 0x0022; msg.size = 0; msg.tlv = data + QMUX_HEADER; ctxt->ctl_txn_id += 2; n = QMI_WDS; qmi_add_tlv(&msg, 0x01, 0x01, &n); return qmi_send(ctxt, &msg); }