#!/bin/sh
-CONFIG='{"apn":"internet.telekom","roaming":"true"}'
+CONFIG='{"apn":"internet.telekom","roaming":"true", "username": "telekom", "password": "tm"}'
ubus call uqmid.modem.modem1 configure "$CONFIG"
struct modem_config {
bool configured;
char *apn;
+ char *username;
+ char *password;
char *pin;
bool roaming;
uint8_t pdp_type;
/* failed to get profile list/generate a new profile */
} else {
tx_wds_modify_profile(modem, wds, wds_modify_profile_cb, modem->qmi->wds.profile_id,
- modem->config.apn, modem->config.pdp_type);
+ modem->config.apn, modem->config.pdp_type, modem->config.username,
+ modem->config.password);
}
break;
case MODEM_EV_RX_MODIFIED_PROFILE:
}
int tx_wds_modify_profile(struct modem *modem, struct qmi_service *wds, request_cb cb, uint8_t profile, const char *apn,
- uint8_t pdp_type)
+ uint8_t pdp_type, const char *username, const char *password)
{
struct qmi_request *req = talloc_zero(wds, struct qmi_request);
struct qmi_msg *msg = talloc_zero_size(req, 1024);
qmi_set(&profile_req, pdp_type, pdp_type);
if (apn)
- profile_req.data.apn_name = (char *) apn;
+ profile_req.data.apn_name = (char *)apn;
+ if (username)
+ profile_req.data.username = (char *)username;
+ if (password)
+ profile_req.data.password = (char *)password;
int ret = qmi_set_wds_modify_profile_request(msg, &profile_req);
if (ret) {
int tx_wda_set_data_format(struct modem *modem, struct qmi_service *wda, request_cb cb);
int tx_wds_get_profile_list(struct modem *modem, struct qmi_service *wds, request_cb cb);
int tx_wds_modify_profile(struct modem *modem, struct qmi_service *wds, request_cb cb, uint8_t profile, const char *apn,
- uint8_t pdp_type);
+ uint8_t pdp_type, const char *username, const char *password);
int tx_wds_start_network(struct modem *modem, struct qmi_service *wds, request_cb cb, uint8_t profile_idx,
uint8_t ip_family);
int tx_wds_get_current_settings(struct modem *modem, struct qmi_service *wds, request_cb cb);
return UBUS_STATUS_OK;
}
-enum { CFG_APN, CFG_PIN, CFG_ROAMING, __CFG_MAX };
+enum { CFG_APN, CFG_PIN, CFG_ROAMING, CFG_USERNAME, CFG_PASSWORD, __CFG_MAX };
/** ubus call modem_configure{apn: internet, pin: 2342, roaming: false}` */
static const struct blobmsg_policy modem_configure_policy[__CFG_MAX] = {
[CFG_APN] = { .name = "apn", .type = BLOBMSG_TYPE_STRING },
[CFG_PIN] = { .name = "pin", .type = BLOBMSG_TYPE_STRING },
[CFG_ROAMING] = { .name = "roaming", .type = BLOBMSG_TYPE_BOOL },
+ [CFG_USERNAME] = { .name = "username", .type = BLOBMSG_TYPE_STRING },
+ [CFG_PASSWORD] = { .name = "password", .type = BLOBMSG_TYPE_STRING },
};
static int modem_configure(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req,
modem->config.roaming = blobmsg_get_bool(tb[CFG_ROAMING]);
}
+ if (tb[CFG_USERNAME]) {
+ TALLOC_FREE(modem->config.username);
+ value = blobmsg_get_string(tb[CFG_USERNAME]);
+ if (value && strlen(value))
+ modem->config.username = talloc_strdup(modem, blobmsg_get_string(tb[CFG_USERNAME]));
+ }
+
+ if (tb[CFG_PASSWORD]) {
+ TALLOC_FREE(modem->config.password);
+ value = blobmsg_get_string(tb[CFG_PASSWORD]);
+ if (value && strlen(value))
+ modem->config.password = talloc_strdup(modem, blobmsg_get_string(tb[CFG_PASSWORD]));
+ }
+
modem->config.pdp_type = QMI_WDS_PDP_TYPE_IPV4;
modem->config.configured = true;