[-]
[+]
|
Changed |
_service:tar_git:ofono.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:ofono.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://git.monich.net/git/ofono.git</param>
<param name="branch">master</param>
- <param name="revision">15d0364d</param>
+ <param name="revision">01c5e7fc</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/ChangeLog
^
|
@@ -1,3 +1,9 @@
+ver 1.29:
+ Fix issue with QMI and SIM initialized notification.
+ Add support for multiple PDP contexts and xmm7xxx modems.
+ Add support for handling Dual SIM Single Active feature
+ Add support for SIM PIN caching feature.
+
ver 1.28:
Fix issue with SIM initialization and Gemalto modems.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/configure.ac
^
|
@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
-AC_INIT(ofono, 1.28)
+AC_INIT(ofono, 1.29)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/doc/sim-api.txt
^
|
@@ -205,3 +205,15 @@
Contains the SIM's ImsPrivateIdentity, read from the
ISIM.
+
+ uint32 CardSlotCount [readonly, experimental]
+
+ Contains the count of number of SIM card slots available.
+
+ uint32 ActiveCardSlot [readwrite, experimental]
+
+ Contains the index of the currently active SIM card slot
+ for dual SIM single active mode.
+
+ This property will range from 1 (default) to
+ CardSlotCount (max) value.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/atmodem/gprs.c
^
|
@@ -455,7 +455,6 @@
FALSE, gprs, NULL);
break;
case OFONO_VENDOR_UBLOX:
- case OFONO_VENDOR_UBLOX_TOBY_L2:
g_at_chat_register(gd->chat, "+UREG:", ublox_ureg_notify,
FALSE, gprs, NULL);
g_at_chat_send(gd->chat, "AT+UREG=1", none_prefix,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/atmodem/network-registration.c
^
|
@@ -1559,12 +1559,12 @@
option_query_tech_cb, tq, g_free) > 0)
return;
break;
- case OFONO_VENDOR_GEMALTO:
- if (g_at_chat_send(nd->chat, "AT^SMONI",
- smoni_prefix,
- gemalto_query_tech_cb, tq, g_free) > 0)
- return;
- break;
+ case OFONO_VENDOR_GEMALTO:
+ if (g_at_chat_send(nd->chat, "AT^SMONI",
+ smoni_prefix,
+ gemalto_query_tech_cb, tq, g_free) > 0)
+ return;
+ break;
}
g_free(tq);
@@ -1655,8 +1655,11 @@
DBG("");
switch (nd->vendor) {
- case OFONO_VENDOR_UBLOX_TOBY_L2:
- /* UBX-13002752 R33: TOBY L2 doesn't support mode 2 and 3 */
+ case OFONO_VENDOR_UBLOX:
+ /* For all u-blox models, mode 3 is equivalent to mode 1;
+ * since some models do not support setting modes 2 nor 3
+ * (see UBX-13002752), we prefer mode 1 for all models.
+ */
mode = "1";
break;
default:
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/atmodem/sim.c
^
|
@@ -75,6 +75,7 @@
static const char *ccho_prefix[] = { "+CCHO:", NULL };
static const char *crla_prefix[] = { "+CRLA:", NULL };
static const char *cgla_prefix[] = { "+CGLA:", NULL };
+static const char *xcmscsc_prefix[] = { "+XCMSCSC:", NULL};
static const char *none_prefix[] = { NULL };
static void append_file_path(char *buf, const unsigned char *path,
@@ -1160,6 +1161,7 @@
DBG("");
switch (sd->vendor) {
+ case OFONO_VENDOR_XMM:
case OFONO_VENDOR_IFX:
if (g_at_chat_send(sd->chat, "AT+XPINCNT", xpincnt_prefix,
xpincnt_cb, cbd, g_free) > 0)
@@ -1221,7 +1223,6 @@
return;
break;
case OFONO_VENDOR_UBLOX:
- case OFONO_VENDOR_UBLOX_TOBY_L2:
if (g_at_chat_send(sd->chat, "AT+UPINCNT", upincnt_prefix,
upincnt_cb, cbd, g_free) > 0)
return;
@@ -1921,6 +1922,83 @@
CALLBACK_WITH_FAILURE(cb, NULL, 0, data);
}
+static void xcmscsc_query_cb(gboolean ok, GAtResult *result, gpointer user)
+{
+ struct ofono_sim *sim = user;
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ GAtResultIter iter;
+ int active_slot;
+
+ if (!ok)
+ goto done;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XCMSCSC:"))
+ goto done;
+
+ g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_skip_next(&iter);
+
+ g_at_result_iter_next_number(&iter, &active_slot);
+
+ /* set active SIM slot */
+ ofono_sim_set_active_card_slot(sim, active_slot + 1);
+
+done:
+ /* Query supported <fac>s */
+ g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
+ at_clck_query_cb, sim, NULL);
+}
+
+static void at_xcmscsc_test_cb(gboolean ok, GAtResult *result, gpointer user)
+{
+ struct ofono_sim *sim = user;
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ GAtResultIter iter;
+ int card_slot_count;
+
+ if (!ok)
+ goto done;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XCMSCSC:"))
+ goto done;
+
+ g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_skip_next(&iter);
+
+ if (!g_at_result_iter_open_list(&iter))
+ goto done;
+
+ g_at_result_iter_skip_next(&iter);
+
+ if (!g_at_result_iter_next_number(&iter, &card_slot_count))
+ goto done;
+
+ /* Set num slots */
+ ofono_sim_set_card_slot_count(sim, card_slot_count + 1);
+
+ /*
+ * enable reporting of MSIM remap status information
+ * and enable automatic acceptance of MSIM Remap
+ * acknowledgement
+ */
+ g_at_chat_send(sd->chat, "AT+XCMSRS=2", none_prefix,
+ NULL, NULL, NULL);
+
+ /* Query active card slot */
+ g_at_chat_send(sd->chat, "AT+XCMSCSC?", xcmscsc_prefix,
+ xcmscsc_query_cb, sim, NULL);
+ return;
+
+done:
+ /* Query supported <fac>s */
+ g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
+ at_clck_query_cb, sim, NULL);
+}
+
static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
void *data)
{
@@ -1939,6 +2017,10 @@
if (at_clck_cpwd_fac[i])
sd->passwd_type_mask |= (1 << i);
+ if (sd->vendor == OFONO_VENDOR_XMM)
+ return g_at_chat_send(sd->chat, "AT+XCMSCSC=?", xcmscsc_prefix,
+ at_xcmscsc_test_cb, sim, NULL) ? 0 : -1;
+
/* Query supported <fac>s */
return g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
at_clck_query_cb, sim, NULL) ? 0 : -1;
@@ -1958,6 +2040,46 @@
g_free(sd);
}
+static void xcmscsc_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_sim_set_active_card_slot_cb_t cb = cbd->cb;
+ struct ofono_error error;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (cb)
+ cb(&error, cbd->data);
+}
+
+static void at_set_active_card_slot(struct ofono_sim *sim, unsigned int index,
+ ofono_sim_set_active_card_slot_cb_t cb, void *data)
+{
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ struct cb_data *cbd = cb_data_new(cb, data);
+ char cmd[43];
+
+ if (sd->vendor != OFONO_VENDOR_XMM) {
+ struct ofono_error error;
+ error.type = OFONO_ERROR_TYPE_CME;
+ error.error = 4;
+
+ cb(&error, data);
+ return;
+ }
+
+ /* Enable single SIM mode for indicated card slot id */
+ snprintf(cmd, sizeof(cmd), "AT+XCMSCSC=1,0,%u,1", index);
+
+ if (g_at_chat_send(sd->chat, cmd, none_prefix, xcmscsc_cb,
+ cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static const struct ofono_sim_driver driver = {
.name = "atmodem",
.probe = at_sim_probe,
@@ -1983,7 +2105,8 @@
.session_read_binary = at_session_read_binary,
.session_read_record = at_session_read_record,
.session_read_info = at_session_read_info,
- .logical_access = at_logical_access
+ .logical_access = at_logical_access,
+ .set_active_card_slot = at_set_active_card_slot
};
static const struct ofono_sim_driver driver_noef = {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/atmodem/vendor.h
^
|
@@ -46,7 +46,6 @@
OFONO_VENDOR_QUECTEL,
OFONO_VENDOR_QUECTEL_M95,
OFONO_VENDOR_UBLOX,
- OFONO_VENDOR_UBLOX_TOBY_L2,
OFONO_VENDOR_XMM,
OFONO_VENDOR_GEMALTO,
};
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/ifxmodem/gprs-context.c
^
|
@@ -260,6 +260,45 @@
failed_setup(gc, NULL, TRUE);
}
+static void cgdata_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_gprs_context *gc = user_data;
+ struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+
+ DBG("ok %d", ok);
+
+ if (!ok) {
+ ofono_error("Failed to establish session");
+ failed_setup(gc, result, TRUE);
+ return;
+ }
+
+ CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+}
+
+static const char *get_datapath(struct ofono_modem *modem,
+ const char *interface)
+{
+ static char datapath[256];
+ char n;
+
+ if (!strcmp(interface,
+ ofono_modem_get_string(modem, "NetworkInterface")))
+ n = '0';
+ else if (!strcmp(interface,
+ ofono_modem_get_string(modem, "NetworkInterface2")))
+ n = '1';
+ else if (!strcmp(interface,
+ ofono_modem_get_string(modem, "NetworkInterface3")))
+ n = '2';
+ else
+ return NULL;
+
+ snprintf(datapath, sizeof(datapath), "%s%c",
+ ofono_modem_get_string(modem, "DataPath"), n);
+ return datapath;
+}
+
static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_gprs_context *gc = user_data;
@@ -269,8 +308,11 @@
const char *laddrnetmask = NULL;
const char *gw = NULL;
- const char *interface;
const char *dns[3];
+ const char *ctrlpath;
+ const char *datapath;
+ char buf[512];
+ const char *interface;
DBG("ok %d", ok);
@@ -327,9 +369,10 @@
DBG("DNS2: %s\n", gcd->dns2);
DBG("Gateway: %s\n", gcd->gateway);
- interface = ofono_modem_get_string(modem, "NetworkInterface");
+ ctrlpath = ofono_modem_get_string(modem, "CtrlPath");
+ interface = ofono_gprs_context_get_interface(gc);
+ datapath = get_datapath(modem, interface);
- ofono_gprs_context_set_interface(gc, interface);
ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
if (gcd->netmask[0])
@@ -340,7 +383,17 @@
ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
- CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+ snprintf(buf, sizeof(buf), "AT+XDATACHANNEL=1,1,\"%s\",\"%s\",2,%u",
+ ctrlpath, datapath, gcd->active_context);
+ g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+ snprintf(buf, sizeof(buf), "AT+CGDATA=\"M-RAW_IP\",%u",
+ gcd->active_context);
+
+ if (g_at_chat_send(gcd->chat, buf, none_prefix, cgdata_cb,
+ gc, NULL) > 0)
+ return;
+
+ CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
}
static void ifx_read_settings(struct ofono_gprs_context *gc)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/qmimodem/sim-legacy.c
^
|
@@ -250,6 +250,7 @@
switch (state) {
case QMI_DMS_UIM_STATE_INIT_COMPLETE:
ofono_sim_inserted_notify(sim, TRUE);
+ ofono_sim_initialized_notify(sim);
break;
case QMI_DMS_UIM_STATE_INIT_FAILED:
case QMI_DMS_UIM_STATE_NOT_PRESENT:
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/qmimodem/sim.c
^
|
@@ -524,7 +524,7 @@
return need_retry;
}
-static enum get_card_status_result handle_get_card_status_result(
+static enum get_card_status_result handle_get_card_status_data(
struct qmi_result *result, struct sim_status *sim_stat)
{
const void *ptr;
@@ -533,9 +533,6 @@
uint8_t i;
enum get_card_status_result res = GET_CARD_STATUS_RESULT_ERROR;
- if (qmi_result_set_error(result, NULL))
- goto done;
-
ptr = qmi_result_get(result, QMI_UIM_RESULT_CARD_STATUS, &len);
if (!ptr)
goto done;
@@ -578,6 +575,15 @@
return res;
}
+static enum get_card_status_result handle_get_card_status_result(
+ struct qmi_result *result, struct sim_status *sim_stat)
+{
+ if (qmi_result_set_error(result, NULL))
+ return GET_CARD_STATUS_RESULT_ERROR;
+
+ return handle_get_card_status_data(result, sim_stat);
+}
+
static gboolean query_passwd_state_retry(gpointer userdata)
{
struct cb_data *cbd = userdata;
@@ -791,6 +797,34 @@
break;
case 0x01: /* Present */
ofono_sim_inserted_notify(sim, TRUE);
+ ofono_sim_initialized_notify(sim);
+ break;
+ }
+}
+
+static void card_status_notify(struct qmi_result *result, void *user_data)
+{
+ struct ofono_sim *sim = user_data;
+ struct sim_data *data = ofono_sim_get_data(sim);
+ struct sim_status sim_stat;
+
+ DBG("");
+
+ if (handle_get_card_status_data(result, &sim_stat) !=
+ GET_CARD_STATUS_RESULT_OK) {
+ data->app_type = 0; /* Unknown */
+ sim_stat.card_state = 0x00; /* Absent */
+ } else {
+ data->app_type = sim_stat.app_type;
+ }
+
+ switch (sim_stat.card_state) {
+ case 0x00: /* Absent */
+ case 0x02: /* Error */
+ ofono_sim_inserted_notify(sim, FALSE);
+ break;
+ case 0x01: /* Present */
+ ofono_sim_inserted_notify(sim, TRUE);
break;
}
}
@@ -810,6 +844,9 @@
goto error;
DBG("event mask 0x%04x", data->event_mask);
+ if (data->event_mask & 0x0001)
+ qmi_service_register(data->uim, QMI_UIM_GET_CARD_STATUS_EVENT,
+ card_status_notify, sim, NULL);
if (qmi_service_send(data->uim, QMI_UIM_GET_CARD_STATUS, NULL,
get_card_status_cb, sim, NULL) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/qmimodem/uim.h
^
|
@@ -29,7 +29,7 @@
#define QMI_UIM_EVENT_REGISTRATION 46 /* Register for indications */
#define QMI_UIM_GET_CARD_STATUS 47 /* Get card status */
-
+#define QMI_UIM_GET_CARD_STATUS_EVENT 50 /* Card status indication */
/* Register for indications */
#define QMI_UIM_PARAM_EVENT_MASK 0x01 /* uint32 */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/ubloxmodem/gprs-context.c
^
|
@@ -43,12 +43,20 @@
static const char *none_prefix[] = { NULL };
static const char *cgcontrdp_prefix[] = { "+CGCONTRDP:", NULL };
static const char *uipaddr_prefix[] = { "+UIPADDR:", NULL };
+static const char *ubmconf_prefix[] = { "+UBMCONF:", NULL };
+
+enum netmode {
+ NETWORKING_MODE_ROUTER,
+ NETWORKING_MODE_BRIDGE,
+};
struct gprs_context_data {
+ const struct ublox_model *model;
GAtChat *chat;
unsigned int active_context;
ofono_gprs_context_cb_t cb;
void *cb_data;
+ enum netmode networking_mode;
};
static void uipaddr_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -227,6 +235,14 @@
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ if (gcd->networking_mode == NETWORKING_MODE_ROUTER) {
+ /* Use DHCP */
+ set_gprs_context_interface(gc);
+ ofono_gprs_context_set_ipv4_address(gc, NULL, 0);
+ CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+ return;
+ }
+
if (ublox_send_cgcontrdp(gc) < 0)
CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
}
@@ -461,8 +477,44 @@
gcd->active_context = 0;
}
+static void at_ubmconf_read_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct ofono_gprs_context *gc = user_data;
+ struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ GAtResultIter iter;
+ int mode;
+
+ if (!ok)
+ goto error;
+
+ g_at_result_iter_init(&iter, result);
+ if (!g_at_result_iter_next(&iter, "+UBMCONF:"))
+ goto error;
+
+ if (!g_at_result_iter_next_number(&iter, &mode))
+ goto error;
+
+ switch (mode) {
+ case 1:
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+ break;
+ case 2:
+ gcd->networking_mode = NETWORKING_MODE_BRIDGE;
+ break;
+ default:
+ goto error;
+ }
+
+ return;
+
+error:
+ ofono_error("AT+UBMCONF? failed; assuming router mode");
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+}
+
static int ublox_gprs_context_probe(struct ofono_gprs_context *gc,
- unsigned int vendor, void *data)
+ unsigned int model_id, void *data)
{
GAtChat *chat = data;
struct gprs_context_data *gcd;
@@ -473,10 +525,23 @@
if (gcd == NULL)
return -ENOMEM;
+ gcd->model = ublox_model_from_id(model_id);
+ if (!gcd->model)
+ return -EINVAL;
+
gcd->chat = g_at_chat_clone(chat);
ofono_gprs_context_set_data(gc, gcd);
+ if (ublox_is_toby_l2(gcd->model)) {
+ g_at_chat_send(chat, "AT+UBMCONF?", ubmconf_prefix,
+ at_ubmconf_read_cb, gc, NULL);
+ } else if (ublox_is_toby_l4(gcd->model)) {
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+ } else {
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+ }
+
g_at_chat_register(chat, "+CGEV:", cgev_notify, FALSE, gc, NULL);
return 0;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/ubloxmodem/lte.c
^
|
@@ -39,24 +39,85 @@
#include "ubloxmodem.h"
-static const char *ucgdflt_prefix[] = { "+UCGDFLT:", NULL };
+static const char *none_prefix[] = { NULL };
struct lte_driver_data {
GAtChat *chat;
+ const struct ublox_model *model;
+ struct ofono_lte_default_attach_info pending_info;
};
-static void ucgdflt_cb(gboolean ok, GAtResult *result, gpointer user_data)
+static void at_lte_set_auth_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_lte_cb_t cb = cbd->cb;
struct ofono_error error;
- DBG("ok %d", ok);
-
decode_at_error(&error, g_at_result_final_response(result));
cb(&error, cbd->data);
}
+static void at_lte_set_default_attach_info_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_lte_cb_t cb = cbd->cb;
+ void *data = cbd->data;
+ struct lte_driver_data *ldd = cbd->user;
+ struct ofono_error error;
+ char buf[32 + OFONO_GPRS_MAX_USERNAME_LENGTH +
+ OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
+ enum ofono_gprs_auth_method auth_method;
+ int cid;
+
+ if (!ok) {
+ decode_at_error(&error, g_at_result_final_response(result));
+ cb(&error, data);
+ return;
+ }
+
+ if (ublox_is_toby_l2(ldd->model)) {
+ /* If CGDCONT has already been used to set up cid 4 then
+ * the EPS default bearer will be configured from another
+ * cid (see documentation for how this is selected). Avoid
+ * doing so as this assumes as much...
+ */
+ cid = 4;
+ } else if (ublox_is_toby_l4(ldd->model)) {
+ cid = 1;
+ } else {
+ ofono_error("Unknown model; "
+ "unable to determine EPS default bearer CID");
+ goto out;
+ }
+
+ auth_method = ldd->pending_info.auth_method;
+
+ /* change the authentication method if the parameters are invalid */
+ if (!*ldd->pending_info.username || !*ldd->pending_info.password)
+ auth_method = OFONO_GPRS_AUTH_METHOD_NONE;
+
+ /* In contrast to CGAUTH, all four parameters are _required_ here;
+ * if auth type is NONE then username and password must be set to
+ * empty strings.
+ */
+ sprintf(buf, "AT+UAUTHREQ=%d,%d,\"%s\",\"%s\"",
+ cid,
+ at_util_gprs_auth_method_to_auth_prot(auth_method),
+ ldd->pending_info.username,
+ ldd->pending_info.password);
+
+ cbd = cb_data_ref(cbd);
+ if (g_at_chat_send(ldd->chat, buf, none_prefix,
+ at_lte_set_auth_cb, cbd, cb_data_unref) > 0)
+ return;
+
+out:
+ cb_data_unref(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static void ublox_lte_set_default_attach_info(const struct ofono_lte *lte,
const struct ofono_lte_default_attach_info *info,
ofono_lte_cb_t cb, void *data)
@@ -67,17 +128,32 @@
DBG("LTE config with APN: %s", info->apn);
- if (strlen(info->apn) > 0)
- snprintf(buf, sizeof(buf), "AT+UCGDFLT=0,\"IP\",\"%s\"",
+ cbd->user = ldd;
+ memcpy(&ldd->pending_info, info, sizeof(ldd->pending_info));
+
+ if (ublox_is_toby_l2(ldd->model)) {
+ if (strlen(info->apn) > 0)
+ snprintf(buf, sizeof(buf), "AT+UCGDFLT=0,%s,\"%s\"",
+ at_util_gprs_proto_to_pdp_type(info->proto),
info->apn);
- else
- snprintf(buf, sizeof(buf), "AT+UCGDFLT=0");
+ else
+ snprintf(buf, sizeof(buf), "AT+UCGDFLT=0");
- /* We can't do much in case of failure so don't check response. */
- if (g_at_chat_send(ldd->chat, buf, ucgdflt_prefix,
- ucgdflt_cb, cbd, g_free) > 0)
+ } else if (ublox_is_toby_l4(ldd->model)) {
+ if (strlen(info->apn) > 0)
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=1,%s,\"%s\"",
+ at_util_gprs_proto_to_pdp_type(info->proto),
+ info->apn);
+ else
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=1");
+ }
+
+ if (g_at_chat_send(ldd->chat, buf, none_prefix,
+ at_lte_set_default_attach_info_cb,
+ cbd, cb_data_unref) > 0)
return;
+ cb_data_unref(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -91,7 +167,7 @@
}
static int ublox_lte_probe(struct ofono_lte *lte,
- unsigned int vendor, void *data)
+ unsigned int model_id, void *data)
{
GAtChat *chat = data;
struct lte_driver_data *ldd;
@@ -103,6 +179,7 @@
return -ENOMEM;
ldd->chat = g_at_chat_clone(chat);
+ ldd->model = ublox_model_from_id(model_id);
ofono_lte_set_data(lte, ldd);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/ubloxmodem/ubloxmodem.c
^
|
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#include <string.h>
+
#include <glib.h>
#include <gatchat.h>
@@ -33,6 +35,83 @@
#include "ubloxmodem.h"
+const struct ublox_model ublox_models[] = {
+ {
+ .name = "SARA-G270",
+ },
+ /* TOBY L2 series */
+ {
+ .name = "TOBY-L200",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L201",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L210",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L220",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L280",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ /* TOBY L4 series */
+ {
+ .name = "TOBY-L4006",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ {
+ .name = "TOBY-L4106",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ {
+ .name = "TOBY-L4206",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ {
+ .name = "TOBY-L4906",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ { /* sentinel */ },
+};
+
+const struct ublox_model *ublox_model_from_name(const char *name)
+{
+ const struct ublox_model *m;
+
+ for (m = ublox_models; m->name; m++) {
+ if (!strcmp(name, m->name))
+ return m;
+ }
+
+ return NULL;
+}
+
+const struct ublox_model *ublox_model_from_id(int id)
+{
+ return ublox_models + id;
+}
+
+int ublox_model_to_id(const struct ublox_model *model)
+{
+ return model - ublox_models;
+}
+
+int ublox_is_toby_l2(const struct ublox_model *model)
+{
+ return model->flags & UBLOX_F_TOBY_L2;
+}
+
+int ublox_is_toby_l4(const struct ublox_model *model)
+{
+ return model->flags & UBLOX_F_TOBY_L4;
+}
+
static int ubloxmodem_init(void)
{
ublox_gprs_context_init();
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/drivers/ubloxmodem/ubloxmodem.h
^
|
@@ -23,6 +23,23 @@
#define UBLOXMODEM "ubloxmodem"
+enum ublox_flags {
+ UBLOX_F_TOBY_L2 = (1 << 0),
+ UBLOX_F_TOBY_L4 = (1 << 1),
+ UBLOX_F_HAVE_USBCONF = (1 << 2),
+};
+
+struct ublox_model {
+ char *name;
+ int flags;
+};
+
+const struct ublox_model *ublox_model_from_name(const char *name);
+const struct ublox_model *ublox_model_from_id(int id);
+int ublox_model_to_id(const struct ublox_model *model);
+int ublox_is_toby_l2(const struct ublox_model *model);
+int ublox_is_toby_l4(const struct ublox_model *model);
+
extern void ublox_gprs_context_init(void);
extern void ublox_gprs_context_exit(void);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/dbus-access.h
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony
*
- * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2022 Jolla Ltd.
* Copyright (C) 2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
@@ -53,6 +53,7 @@
/* OFONO_DBUS_ACCESS_INTF_MESSAGEMGR */
enum ofono_dbus_access_messagemgr_method {
OFONO_DBUS_ACCESS_MESSAGEMGR_SEND_MESSAGE,
+ OFONO_DBUS_ACCESS_MESSAGEMGR_SEND_DATA_MESSAGE, /* Since 1.28+git5 */
OFONO_DBUS_ACCESS_MESSAGEMGR_METHOD_COUNT
};
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/devinfo.h
^
|
@@ -3,6 +3,7 @@
* oFono - Open Telephony stack for Linux
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2015-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -65,6 +66,9 @@
struct ofono_modem *ofono_devinfo_get_modem(struct ofono_devinfo *info);
+/* Since 1.28+git4 */
+const char *ofono_devinfo_get_serial(struct ofono_devinfo *info);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/gprs-context.h
^
|
@@ -93,6 +93,8 @@
enum ofono_gprs_context_type ofono_gprs_context_get_type(
struct ofono_gprs_context *gc);
+const char *ofono_gprs_context_get_interface(struct ofono_gprs_context *gc);
+
void ofono_gprs_context_set_interface(struct ofono_gprs_context *gc,
const char *interface);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/ims.h
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
+ * Copyright (C) 2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -30,6 +31,10 @@
struct ofono_ims;
+/* ext_info bits */
+#define OFONO_IMS_VOICE_CAPABLE 0x1
+#define OFONO_IMS_SMS_CAPABLE 0x4
+
typedef void (*ofono_ims_register_cb_t)(const struct ofono_error *error,
void *data);
typedef void (*ofono_ims_status_cb_t)(const struct ofono_error *error,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/modem.h
^
|
@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2015-2021 Jolla Ltd.
+ * Copyright (C) 2015-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -29,6 +29,7 @@
#include <ofono/types.h>
+struct ofono_devinfo;
struct ofono_modem;
struct ofono_gprs;
struct ofono_sim;
@@ -92,7 +93,9 @@
struct ofono_voicecall *ofono_modem_get_voicecall(struct ofono_modem *modem);
struct ofono_netreg *ofono_modem_get_netreg(struct ofono_modem *modem);
struct ofono_radio_settings *ofono_modem_get_radio_settings
- (struct ofono_modem *modem); /* Since mer/1.24+git2 */
+ (struct ofono_modem *modem); /* Since 1.24+git2 */
+struct ofono_devinfo *ofono_modem_get_devinfo
+ (struct ofono_modem *modem); /* Since 1.28+git4 */
void ofono_modem_set_data(struct ofono_modem *modem, void *data);
void *ofono_modem_get_data(struct ofono_modem *modem);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/sim.h
^
|
@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2015-2021 Jolla Ltd.
+ * Copyright (C) 2015-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -138,6 +138,10 @@
typedef void (*ofono_sim_logical_access_cb_t)(const struct ofono_error *error,
const unsigned char *resp, unsigned int len, void *data);
+typedef void (*ofono_sim_set_active_card_slot_cb_t)(
+ const struct ofono_error *error,
+ void *data);
+
struct ofono_sim_driver {
const char *name;
int (*probe)(struct ofono_sim *sim, unsigned int vendor, void *data);
@@ -211,15 +215,23 @@
void (*logical_access)(struct ofono_sim *sim, int session_id,
const unsigned char *pdu, unsigned int len,
ofono_sim_logical_access_cb_t cb, void *data);
- /* Since mer/1.23+git28 */
+ /* API version 1 (since 1.23+git28) */
void (*open_channel2)(struct ofono_sim *sim, const unsigned char *aid,
unsigned int len, ofono_sim_open_channel_cb_t cb,
void *data);
+ /* API version 2 (since 1.29+git1) */
+ void (*set_active_card_slot)(struct ofono_sim *sim, unsigned int index,
+ ofono_sim_set_active_card_slot_cb_t cb, void *data);
};
int ofono_sim_driver_register(const struct ofono_sim_driver *d);
void ofono_sim_driver_unregister(const struct ofono_sim_driver *d);
+#define OFONO_SIM_DRIVER_API_VERSION 2
+#define ofono_sim_driver_register(d) /* Since 1.28+git4 */ \
+ ofono_sim_driver_register_version(d, OFONO_SIM_DRIVER_API_VERSION)
+int ofono_sim_driver_register_version(const struct ofono_sim_driver *d, int v);
+
struct ofono_sim *ofono_sim_create(struct ofono_modem *modem,
unsigned int vendor,
const char *driver, void *data);
@@ -229,6 +241,9 @@
void ofono_sim_set_data(struct ofono_sim *sim, void *data);
void *ofono_sim_get_data(struct ofono_sim *sim);
+void ofono_sim_set_card_slot_count(struct ofono_sim *sim, unsigned int val);
+void ofono_sim_set_active_card_slot(struct ofono_sim *sim,
+ unsigned int val);
const char *ofono_sim_get_imsi(struct ofono_sim *sim);
const char *ofono_sim_get_mcc(struct ofono_sim *sim);
@@ -241,8 +256,8 @@
enum ofono_sim_password_type ofono_sim_get_password_type(struct ofono_sim *sim);
-void ofono_sim_refresh_full(struct ofono_sim *sim); /* Since mer/1.24+git2 */
-enum ofono_sim_password_type ofono_sim_puk2pin( /* Since mer/1.24+git2 */
+void ofono_sim_refresh_full(struct ofono_sim *sim); /* Since 1.24+git2 */
+enum ofono_sim_password_type ofono_sim_puk2pin( /* Since 1.24+git2 */
enum ofono_sim_password_type type);
unsigned int ofono_sim_add_state_watch(struct ofono_sim *sim,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/sms.h
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -60,6 +61,11 @@
ofono_sms_bearer_set_cb_t, void *data);
};
+enum ofono_sms_data_flag {
+ OFONO_SMS_DATA_FLAG_DELIVERY_REPORT = 0x01,
+ OFONO_SMS_DATA_FLAG_USE_LITTLE_ENDIAN = 0x02
+}; /* Since 1.28+git5 */
+
void ofono_sms_deliver_notify(struct ofono_sms *sms, const unsigned char *pdu,
int len, int tpdu_len);
void ofono_sms_status_notify(struct ofono_sms *sms, const unsigned char *pdu,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/types.h
^
|
@@ -55,7 +55,9 @@
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA = 4,
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSUPA = 5,
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA = 6,
- OFONO_ACCESS_TECHNOLOGY_EUTRAN = 7
+ OFONO_ACCESS_TECHNOLOGY_EUTRAN = 7,
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_M1 = 8,
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 = 9
};
/* 27.007 Section 6.2 */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/include/ussd.h
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2021-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -69,6 +70,10 @@
void ofono_ussd_set_data(struct ofono_ussd *ussd, void *data);
void *ofono_ussd_get_data(struct ofono_ussd *ussd);
+/* Since mer/1.28+git2 */
+char *ofono_ussd_decode(int dcs, const void *pdu, int len);
+void ofono_ussd_decode_free(char *ussd);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/plugins/sim900.c
^
|
@@ -115,7 +115,7 @@
if (strstr(model, "SIM800"))
data->modem_type = SIM800;
else if (strstr(model, "SIM900"))
- data->modem_type = SIM800;
+ data->modem_type = SIM900;
else
data->modem_type = SIMCOM_UNKNOWN;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/plugins/ublox.c
^
|
@@ -42,23 +42,24 @@
#include <ofono/lte.h>
#include <ofono/voicecall.h>
-#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
+#include <drivers/ubloxmodem/ubloxmodem.h>
+
+static const char *uusbconf_prefix[] = { "+UUSBCONF:", NULL };
static const char *none_prefix[] = { NULL };
-enum supported_models {
- SARA_G270 = 1102,
- TOBYL2_COMPATIBLE_MODE = 1141,
- TOBYL2_MEDIUM_THROUGHPUT_MODE = 1143,
- TOBYL2_HIGH_THROUGHPUT_MODE = 1146,
+enum ublox_device_flags {
+ UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE = (1 << 0),
};
struct ublox_data {
GAtChat *modem;
GAtChat *aux;
- int model_id;
enum ofono_vendor vendor_family;
+
+ const struct ublox_model *model;
+ int flags;
};
static void ublox_debug(const char *str, void *user_data)
@@ -144,77 +145,151 @@
return;
}
- if (data->model_id == TOBYL2_HIGH_THROUGHPUT_MODE)
- /* use bridged mode until routed mode support is added */
- g_at_chat_send(data->aux, "AT+UBMCONF=2", none_prefix,
- NULL, NULL, NULL);
-
ofono_modem_set_powered(modem, TRUE);
}
-static int ublox_enable(struct ofono_modem *modem)
+static void query_usbconf_cb(gboolean ok,
+ GAtResult *result, gpointer user_data)
{
+ struct ofono_modem *modem = user_data;
struct ublox_data *data = ofono_modem_get_data(modem);
- const char *model_str = NULL;
+ GAtResultIter iter;
+ int profile;
- DBG("%p", modem);
+ if (!ok) {
+ ofono_error("Unable to query USB configuration");
+ goto error;
+ }
- model_str = ofono_modem_get_string(modem, "Model");
- if (model_str == NULL)
- return -EINVAL;
+ g_at_result_iter_init(&iter, result);
- /*
- * Toby L2 devices are more complex and special than previously
- * supported U-Blox devices. So they need a vendor of their own.
- */
- data->model_id = atoi(model_str);
+retry:
+ if (!g_at_result_iter_next(&iter, "+UUSBCONF:")) {
+ ofono_error("Unable to query USB configuration");
+ goto error;
+ }
- switch (data->model_id) {
- case SARA_G270:
- data->vendor_family = OFONO_VENDOR_UBLOX;
- break;
- case TOBYL2_COMPATIBLE_MODE:
- case TOBYL2_HIGH_THROUGHPUT_MODE:
- data->vendor_family = OFONO_VENDOR_UBLOX_TOBY_L2;
+ if (!g_at_result_iter_next_number(&iter, &profile))
+ goto retry;
+
+ switch (profile) {
+ case 0: /* Fairly back compatible */
+ case 1: /* Fairly back compatible plus audio */
break;
- case TOBYL2_MEDIUM_THROUGHPUT_MODE:
- DBG("low/medium throughtput profile unsupported");
+ case 2: /* Low/medium throughput */
+ ofono_error("Medium throughput mode not supported");
+ goto error;
+ case 3: /* High throughput mode */
+ data->flags |= UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE;
break;
default:
- DBG("unknown ublox model id %d", data->model_id);
- return -EINVAL;
+ ofono_error("Unexpected USB profile: %d", profile);
+ goto error;
}
- data->aux = open_device(modem, "Aux", "Aux: ");
- if (data->aux == NULL)
- return -EINVAL;
+ if (g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix,
+ cfun_enable, modem, NULL))
+ return;
- if (data->vendor_family == OFONO_VENDOR_UBLOX) {
- data->modem = open_device(modem, "Modem", "Modem: ");
- if (data->modem == NULL) {
- g_at_chat_unref(data->aux);
- data->aux = NULL;
- return -EIO;
- }
+error:
+ g_at_chat_unref(data->aux);
+ data->aux = NULL;
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+ ofono_modem_set_powered(modem, FALSE);
+}
- g_at_chat_set_slave(data->modem, data->aux);
+static void query_model_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ublox_data *data = ofono_modem_get_data(modem);
+ struct ofono_error error;
+ const char *model;
+ const struct ublox_model *m;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (!ok)
+ goto fail;
+
+ if (at_util_parse_attr(result, "", &model) == FALSE) {
+ ofono_error("Failed to query modem model");
+ goto fail;
+ }
+
+ m = ublox_model_from_name(model);
+ if (!m) {
+ ofono_error("Unrecognized model: %s", model);
+ goto fail;
+ }
+ data->model = m;
+
+ DBG("Model: %s", data->model->name);
+
+ data->vendor_family = OFONO_VENDOR_UBLOX;
+
+ if (data->model->flags & UBLOX_F_HAVE_USBCONF) {
+ if (g_at_chat_send(data->aux, "AT+UUSBCONF?", uusbconf_prefix,
+ query_usbconf_cb, modem, NULL))
+ return;
+
+ ofono_error("Unable to query USB configuration");
+ goto fail;
+ }
+
+ if (g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix,
+ cfun_enable, modem, NULL))
+ return;
+
+fail:
+ g_at_chat_unref(data->aux);
+ data->aux = NULL;
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+ ofono_modem_set_powered(modem, FALSE);
+}
+
+static int ublox_enable(struct ofono_modem *modem)
+{
+ struct ublox_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ data->aux = open_device(modem, "Aux", "Aux: ");
+ /* If this is a serial modem then the device may be behind
+ * the 'Device' attribute instead...
+ */
+ if (data->aux == NULL) {
+ data->aux = open_device(modem, "Device", "Aux: ");
+ if (data->aux == NULL)
+ return -EINVAL;
+ }
+
+ data->modem = open_device(modem, "Modem", "Modem: ");
+ if (data->modem) {
+ g_at_chat_set_slave(data->modem, data->aux);
g_at_chat_send(data->modem, "ATE0 +CMEE=1", none_prefix,
NULL, NULL, NULL);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/plugins/udevng.c
^
|
@@ -1090,11 +1090,17 @@
* - high throughput profile : 224/1/3
*/
} else if (g_strcmp0(info->interface, "2/2/1") == 0) {
- if (g_strcmp0(info->number, "02") == 0)
- aux = info->devnode;
- else if (g_strcmp0(info->number, "00") == 0)
+ if (!g_strcmp0(modem->model, "1010")) {
+ if (g_strcmp0(info->number, "06") == 0)
+ aux = info->devnode;
+ } else {
+ if (g_strcmp0(info->number, "02") == 0)
+ aux = info->devnode;
+ }
+ if (g_strcmp0(info->number, "00") == 0)
mdm = info->devnode;
} else if (g_strcmp0(info->interface, "2/6/0") == 0 ||
+ g_strcmp0(info->interface, "2/13/0") == 0 ||
g_strcmp0(info->interface, "10/0/0") == 0 ||
g_strcmp0(info->interface, "224/1/3") == 0) {
net = info->devnode;
@@ -1111,7 +1117,6 @@
ofono_modem_set_string(modem->modem, "Aux", aux);
ofono_modem_set_string(modem->modem, "Modem", mdm);
- ofono_modem_set_string(modem->modem, "Model", modem->model);
ofono_modem_set_string(modem->modem, "NetworkInterface", net);
return TRUE;
@@ -1179,7 +1184,7 @@
static gboolean setup_xmm7xxx(struct modem_info *modem)
{
- const char *mdm = NULL, *net = NULL;
+ const char *mdm = NULL, *net = NULL, *net2 = NULL, *net3 = NULL;
GSList *list;
DBG("%s %s %s %s %s %s\n", modem->syspath, modem->devname,
@@ -1199,6 +1204,10 @@
} else if (g_strcmp0(info->subsystem, "net") == 0) {
if (g_strcmp0(info->number, "06") == 0)
net = info->devnode;
+ if (g_strcmp0(info->number, "08") == 0)
+ net2 = info->devnode;
+ if (g_strcmp0(info->number, "0a") == 0)
+ net3 = info->devnode;
}
} else {
if (g_strcmp0(info->subsystem, "tty") == 0) {
@@ -1219,6 +1228,15 @@
ofono_modem_set_string(modem->modem, "Modem", mdm);
ofono_modem_set_string(modem->modem, "NetworkInterface", net);
+ if (net2)
+ ofono_modem_set_string(modem->modem, "NetworkInterface2", net2);
+
+ if (net3)
+ ofono_modem_set_string(modem->modem, "NetworkInterface3", net3);
+
+ ofono_modem_set_string(modem->modem, "CtrlPath", "/USBCDC/0");
+ ofono_modem_set_string(modem->modem, "DataPath", "/USBHS/NCM/");
+
return TRUE;
}
@@ -1678,6 +1696,8 @@
{ "quectelqmi", "qcserial", "2c7c", "0121" },
{ "quectelqmi", "qmi_wwan", "2c7c", "0125" },
{ "quectelqmi", "qcserial", "2c7c", "0125" },
+ { "ublox", "cdc_acm", "1546", "1010" },
+ { "ublox", "cdc_ncm", "1546", "1010" },
{ "ublox", "cdc_acm", "1546", "1102" },
{ "ublox", "rndis_host", "1546", "1146" },
{ "ublox", "cdc_acm", "1546", "1146" },
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/plugins/xmm7xxx.c
^
|
@@ -1223,7 +1223,7 @@
DBG("%p", modem);
ofono_devinfo_create(modem, OFONO_VENDOR_IFX, "atmodem", data->chat);
- data->sim = ofono_sim_create(modem, OFONO_VENDOR_IFX, "atmodem",
+ data->sim = ofono_sim_create(modem, OFONO_VENDOR_XMM, "atmodem",
data->chat);
}
@@ -1269,6 +1269,7 @@
struct xmm7xxx_data *data = ofono_modem_get_data(modem);
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+ const char *interface = NULL;
DBG("%p", modem);
@@ -1276,11 +1277,39 @@
gprs = ofono_gprs_create(modem, OFONO_VENDOR_IFX, "atmodem",
data->chat);
+
+ interface = ofono_modem_get_string(modem, "NetworkInterface");
gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM, "ifxmodem",
data->chat);
- if (gprs && gc)
+ if (gprs && gc) {
ofono_gprs_add_context(gprs, gc);
+ ofono_gprs_context_set_interface(gc, interface);
+ }
+
+ interface = ofono_modem_get_string(modem, "NetworkInterface2");
+
+ if (interface) {
+ gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM,
+ "ifxmodem", data->chat);
+
+ if (gprs && gc) {
+ ofono_gprs_add_context(gprs, gc);
+ ofono_gprs_context_set_interface(gc, interface);
+ }
+ }
+
+ interface = ofono_modem_get_string(modem, "NetworkInterface3");
+
+ if (interface) {
+ gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM,
+ "ifxmodem", data->chat);
+
+ if (gprs && gc) {
+ ofono_gprs_add_context(gprs, gc);
+ ofono_gprs_context_set_interface(gc, interface);
+ }
+ }
ofono_ims_create(modem, "xmm7modem", data->chat);
ofono_netmon_create(modem, 0, "xmm7modem", data->chat);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/common.c
^
|
@@ -706,8 +706,14 @@
return "hspa";
case ACCESS_TECHNOLOGY_EUTRAN:
return "lte";
+ case ACCESS_TECHNOLOGY_NB_IOT_M1:
+ return "lte-cat-m1";
+ case ACCESS_TECHNOLOGY_NB_IOT_NB1:
+ return "lte-cat-nb1";
case OFONO_ACCESS_TECHNOLOGY_NONE:
break;
+ default:
+ return "";
}
return "";
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/common.h
^
|
@@ -42,6 +42,10 @@
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA /* 6 */
#define ACCESS_TECHNOLOGY_EUTRAN \
OFONO_ACCESS_TECHNOLOGY_EUTRAN /* 7 */
+#define ACCESS_TECHNOLOGY_NB_IOT_M1 \
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_M1 /* 8 */
+#define ACCESS_TECHNOLOGY_NB_IOT_NB1 \
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 /* 9 */
/* 27.007 Section 7.2 <stat> */
#define NETWORK_REGISTRATION_STATUS_NOT_REGISTERED \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/dbus-access.c
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony
*
- * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2022 Jolla Ltd.
* Copyright (C) 2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
@@ -68,6 +68,8 @@
switch ((enum ofono_dbus_access_messagemgr_method)method) {
case OFONO_DBUS_ACCESS_MESSAGEMGR_SEND_MESSAGE:
return "SendMessage";
+ case OFONO_DBUS_ACCESS_MESSAGEMGR_SEND_DATA_MESSAGE:
+ return "SendDataMessage";
case OFONO_DBUS_ACCESS_MESSAGEMGR_METHOD_COUNT:
break;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/gprs.c
^
|
@@ -110,7 +110,6 @@
};
struct context_settings {
- char *interface;
struct ipv4_settings *ipv4;
struct ipv6_settings *ipv6;
};
@@ -121,6 +120,7 @@
ofono_bool_t inuse;
const struct ofono_gprs_context_driver *driver;
void *driver_data;
+ char *interface;
struct context_settings *settings;
struct ofono_atom *atom;
};
@@ -361,12 +361,10 @@
g_free(settings->ipv6);
settings->ipv6 = NULL;
}
-
- g_free(settings->interface);
- settings->interface = NULL;
}
static void context_settings_append_ipv4(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *iter)
{
DBusMessageIter variant;
@@ -391,7 +389,7 @@
goto done;
ofono_dbus_dict_append(&array, "Interface",
- DBUS_TYPE_STRING, &settings->interface);
+ DBUS_TYPE_STRING, &interface);
if (settings->ipv4->proxy)
ofono_dbus_dict_append(&array, "Proxy", DBUS_TYPE_STRING,
@@ -433,6 +431,7 @@
}
static void context_settings_append_ipv4_dict(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *dict)
{
DBusMessageIter entry;
@@ -443,12 +442,13 @@
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
- context_settings_append_ipv4(settings, &entry);
+ context_settings_append_ipv4(settings, interface, &entry);
dbus_message_iter_close_container(dict, &entry);
}
static void context_settings_append_ipv6(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *iter)
{
DBusMessageIter variant;
@@ -472,7 +472,7 @@
goto done;
ofono_dbus_dict_append(&array, "Interface",
- DBUS_TYPE_STRING, &settings->interface);
+ DBUS_TYPE_STRING, &interface);
if (settings->ipv6->ip)
ofono_dbus_dict_append(&array, "Address", DBUS_TYPE_STRING,
@@ -503,6 +503,7 @@
}
static void context_settings_append_ipv6_dict(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *dict)
{
DBusMessageIter entry;
@@ -513,13 +514,14 @@
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
- context_settings_append_ipv6(settings, &entry);
+ context_settings_append_ipv6(settings, interface, &entry);
dbus_message_iter_close_container(dict, &entry);
}
static void signal_settings(struct pri_context *ctx, const char *prop,
- void (*append)(struct context_settings *, DBusMessageIter *))
+ void (*append)(struct context_settings *,
+ const char *, DBusMessageIter *))
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -527,6 +529,7 @@
DBusMessage *signal;
DBusMessageIter iter;
struct context_settings *settings;
+ const char *interface;
signal = dbus_message_new_signal(path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
@@ -538,12 +541,15 @@
dbus_message_iter_init_append(signal, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &prop);
- if (ctx->context_driver)
+ if (ctx->context_driver) {
settings = ctx->context_driver->settings;
- else
+ interface = ctx->context_driver->interface;
+ } else {
settings = NULL;
+ interface = NULL;
+ }
- append(settings, &iter);
+ append(settings, interface, &iter);
g_dbus_send_message(conn, signal);
}
@@ -781,18 +787,16 @@
static void pri_reset_context_settings(struct pri_context *ctx)
{
struct context_settings *settings;
- char *interface;
+ const char *interface;
gboolean signal_ipv4;
gboolean signal_ipv6;
if (ctx->context_driver == NULL)
return;
+ interface = ctx->context_driver->interface;
settings = ctx->context_driver->settings;
- interface = settings->interface;
- settings->interface = NULL;
-
signal_ipv4 = settings->ipv4 != NULL;
signal_ipv6 = settings->ipv6 != NULL;
@@ -809,8 +813,6 @@
}
pri_ifupdown(interface, FALSE);
-
- g_free(interface);
}
static void pri_update_mms_context_settings(struct pri_context *ctx)
@@ -826,10 +828,10 @@
DBG("proxy %s port %u", ctx->proxy_host, ctx->proxy_port);
- pri_set_ipv4_addr(settings->interface, settings->ipv4->ip);
+ pri_set_ipv4_addr(gc->interface, settings->ipv4->ip);
if (ctx->proxy_host)
- pri_setproxy(settings->interface, ctx->proxy_host);
+ pri_setproxy(gc->interface, ctx->proxy_host);
}
static gboolean pri_str_changed(const char *val, const char *newval)
@@ -1056,6 +1058,7 @@
dbus_bool_t value;
const char *strvalue;
struct context_settings *settings;
+ const char *interface;
ofono_dbus_dict_append(dict, "Name", DBUS_TYPE_STRING, &name);
@@ -1092,13 +1095,16 @@
DBUS_TYPE_STRING, &strvalue);
}
- if (ctx->context_driver)
+ if (ctx->context_driver) {
settings = ctx->context_driver->settings;
- else
+ interface = ctx->context_driver->interface;
+ } else {
settings = NULL;
+ interface = NULL;
+ }
- context_settings_append_ipv4_dict(settings, dict);
- context_settings_append_ipv6_dict(settings, dict);
+ context_settings_append_ipv4_dict(settings, interface, dict);
+ context_settings_append_ipv6_dict(settings, interface, dict);
}
static DBusMessage *pri_get_properties(DBusConnection *conn,
@@ -1147,8 +1153,8 @@
__ofono_dbus_pending_reply(&ctx->pending,
dbus_message_new_method_return(ctx->pending));
- if (gc->settings->interface != NULL) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/ims.c
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
+ * Copyright (C) 2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -36,8 +37,8 @@
#include "common.h"
-#define VOICE_CAPABLE_FLAG 0x1
-#define SMS_CAPABLE_FLAG 0x4
+#define VOICE_CAPABLE_FLAG OFONO_IMS_VOICE_CAPABLE
+#define SMS_CAPABLE_FLAG OFONO_IMS_SMS_CAPABLE
struct ofono_ims {
int reg_info;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/modem.c
^
|
@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2015-2021 Jolla Ltd.
+ * Copyright (C) 2015-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -1150,6 +1150,9 @@
if (modem->lockdown)
return __ofono_error_access_denied(msg);
+ if (!powered)
+ __ofono_sim_clear_cached_pins(modem->sim);
+
err = set_powered(modem, powered);
if (err < 0) {
if (err != -EINPROGRESS)
@@ -2371,7 +2374,7 @@
modem->emergency--;
}
-/* Since mer/1.25+git2 */
+/* Since 1.25+git2 */
unsigned int ofono_modem_add_watch(ofono_modemwatch_cb_t cb, void *user,
ofono_destroy_func destroy)
@@ -2383,3 +2386,15 @@
{
return __ofono_modemwatch_remove(id);
}
+
+/* Since 1.28+git4 */
+
+struct ofono_devinfo *ofono_modem_get_devinfo(struct ofono_modem *modem)
+{
+ return __ofono_atom_find(OFONO_ATOM_TYPE_DEVINFO, modem);
+}
+
+const char *ofono_devinfo_get_serial(struct ofono_devinfo *info)
+{
+ return info ? info->serial : NULL;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/ofono.h
^
|
@@ -428,6 +428,7 @@
struct ofono_sim_aid_session *session);
const char *__ofono_sim_get_impi(struct ofono_sim *sim);
+void __ofono_sim_clear_cached_pins(struct ofono_sim *sim);
#include <ofono/stk.h>
@@ -575,6 +576,9 @@
typedef void (*sms_send_text_cb_t)(struct ofono_sms *sms,
const struct sms_address *addr, const char *text, void *data);
+typedef void (*sms_send_datagram_cb_t)(struct ofono_sms *sms,
+ const struct sms_address *addr, int dstport, int srcport,
+ unsigned char *bytes, unsigned int len, int flags, void *data);
typedef void (*sms_dispatch_recv_text_cb_t)
(struct ofono_sms *sms, const struct ofono_uuid *uuid,
@@ -594,6 +598,11 @@
const struct sms_address *addr, const char *text,
sms_send_text_cb_t sender, ofono_destroy_func destroy,
void *data);
+void __ofono_sms_filter_chain_send_datagram(struct sms_filter_chain *chain,
+ const struct sms_address *addr, int dstport, int srcport,
+ unsigned char *bytes, int len, int flags,
+ sms_send_datagram_cb_t sender, ofono_destroy_func destroy,
+ void *data);
/* Does g_free(buf) when done */
void __ofono_sms_filter_chain_recv_datagram(struct sms_filter_chain *chain,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/sim.c
^
|
@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2015-2021 Jolla Ltd.
+ * Copyright (C) 2015-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -132,6 +132,10 @@
struct ofono_atom *atom;
unsigned int hfp_watch;
+ unsigned int card_slot_count;
+ unsigned int active_card_slot;
+ unsigned int pending_active_card_slot;
+
GSList *aid_sessions;
GSList *aid_list;
char *impi;
@@ -144,6 +148,11 @@
bool wait_initialized : 1;
};
+struct cached_pin {
+ char *id;
+ char *pin;
+};
+
struct msisdn_set_request {
struct ofono_sim *sim;
int pending;
@@ -175,10 +184,18 @@
[OFONO_SIM_PASSWORD_PHCORP_PUK] = "corppuk",
};
+#undef ofono_sim_driver_register
+struct ofono_sim_driver_data {
+ struct ofono_sim_driver driver; /* Must be first */
+ const struct ofono_sim_driver *d;
+};
+
static void sim_own_numbers_update(struct ofono_sim *sim);
static GSList *g_drivers = NULL;
+static GSList *cached_pins = NULL;
+
static const char *sim_passwd_name(enum ofono_sim_password_type type)
{
return passwd_name[type];
@@ -558,6 +575,13 @@
get_pin_retries(sim, &pin_retries_dict, &dbus_retries);
ofono_dbus_dict_append_dict(&dict, "Retries", DBUS_TYPE_BYTE,
&pin_retries_dict);
+
+ ofono_dbus_dict_append(&dict, "CardSlotCount", DBUS_TYPE_UINT32,
+ &sim->card_slot_count);
+
+ ofono_dbus_dict_append(&dict, "ActiveCardSlot", DBUS_TYPE_UINT32,
+ &sim->active_card_slot);
+
g_free(pin_retries_dict);
g_free(dbus_retries);
@@ -567,6 +591,72 @@
return reply;
}
+static struct cached_pin *pin_cache_lookup(const char *iccid)
+{
+ struct cached_pin *c;
+ GSList *l;
+
+ if (cached_pins == NULL)
+ return NULL;
+
+ for (l = cached_pins; l; l = l->next) {
+ c = l->data;
+
+ if (g_strcmp0(iccid, c->id) == 0)
+ return c;
+ }
+
+ return NULL;
+}
+
+static void pin_cache_update(const char *iccid, const char *pin)
+{
+ struct cached_pin *pin_cached = pin_cache_lookup(iccid);
+ struct cached_pin *cpins;
+
+ if (pin_cached != NULL) {
+ g_free(pin_cached->pin);
+ pin_cached->pin = g_strdup(pin);
+ return;
+ }
+
+ cpins = g_new0(struct cached_pin, 1);
+
+ cpins->id = g_strdup(iccid);
+ cpins->pin = g_strdup(pin);
+ cached_pins = g_slist_prepend(cached_pins, cpins);
+}
+
+static void pin_cache_remove(const char *iccid)
+{
+ struct cached_pin *pin_cached = pin_cache_lookup(iccid);
+
+ if (pin_cached == NULL)
+ return;
+
+ cached_pins = g_slist_remove(cached_pins, pin_cached);
+
+ g_free(pin_cached->pin);
+ g_free(pin_cached->id);
+ g_free(pin_cached);
+}
+
+static void pin_cache_enter_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_sim *sim = data;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ pin_cache_remove(sim->iccid);
+
+ __ofono_sim_recheck_pin(sim);
+
+ return;
+ }
+
+ sim->wait_initialized = true;
+ DBG("Waiting for ofono_sim_initialized_notify");
+}
+
static void sim_pin_retries_query_cb(const struct ofono_error *error,
int retries[OFONO_SIM_PASSWORD_INVALID],
void *data)
@@ -683,6 +773,36 @@
OFONO_DBUS_ACCESS_INTF_SIMMGR, method, arg);
}
+static void sim_set_slot_callback(const struct ofono_error *error, void *data)
+{
+ struct ofono_sim *sim = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+ DBusMessage *reply;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ DBG("Error setting radio access mode");
+
+ sim->pending_active_card_slot = sim->active_card_slot;
+
+ reply = __ofono_error_from_error(error, sim->pending);
+ __ofono_dbus_pending_reply(&sim->pending, reply);
+
+ return;
+ }
+
+ sim->active_card_slot = sim->pending_active_card_slot;
+
+ reply = dbus_message_new_method_return(sim->pending);
+ __ofono_dbus_pending_reply(&sim->pending, reply);
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "ActiveCardSlot",
+ DBUS_TYPE_UINT32,
+ &sim->active_card_slot);
+}
+
static DBusMessage *sim_set_property(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -753,6 +873,37 @@
if (set_ok)
return NULL;
+ } else if (!strcmp(name, "ActiveCardSlot")) {
+ dbus_uint32_t value;
+
+ dbus_message_iter_next(&iter);
+
+ if (sim->driver->set_active_card_slot == NULL)
+ return __ofono_error_not_implemented(msg);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_recurse(&iter, &var);
+
+ if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_UINT32)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&var, &value);
+
+ if (value <= 0 || value > sim->card_slot_count)
+ return __ofono_error_invalid_args(msg);
+
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/sms-filter.c
^
|
@@ -85,6 +85,19 @@
struct ofono_sms_address addr;
};
+struct sms_filter_chain_send_datagram {
+ struct sms_filter_message message;
+ sms_send_datagram_cb_t send;
+ ofono_destroy_func destroy;
+ void *data;
+ int dst_port;
+ int src_port;
+ unsigned char *bytes;
+ unsigned int len;
+ int flags;
+ struct ofono_sms_address addr;
+};
+
struct sms_filter_chain_recv_text {
struct sms_filter_message message;
sms_dispatch_recv_text_cb_t default_handler;
@@ -445,6 +458,140 @@
return &send_msg->message;
}
+/* sms_filter_chain_send_datagram */
+
+static inline struct sms_filter_chain_send_datagram
+ *sms_filter_chain_send_datagram_cast
+ (struct sms_filter_message *msg)
+{
+ return CAST(msg, struct sms_filter_chain_send_datagram, message);
+}
+
+static gboolean sms_filter_chain_send_datagram_can_process
+ (const struct ofono_sms_filter *filter)
+{
+ return filter->filter_send_datagram != NULL;
+}
+
+static void sms_datagram_set_bytes(
+ struct sms_filter_chain_send_datagram *msg,
+ const unsigned char *bytes, unsigned int len)
+{
+ msg->bytes = g_malloc0(sizeof(unsigned char) * len);
+ memcpy(msg->bytes, bytes, len);
+ msg->len = len;
+}
+
+static void sms_filter_chain_send_datagram_process_cb
+ (enum ofono_sms_filter_result res,
+ const struct ofono_sms_address *addr,
+ int dst_port, int src_port,
+ const unsigned char *bytes,
+ unsigned int len, void *data)
+{
+ struct sms_filter_chain_send_datagram *msg = data;
+
+ if (res != OFONO_SMS_FILTER_DROP) {
+ /* Update the message */
+ if (&msg->addr != addr) {
+ msg->addr = *addr;
+ }
+ if (msg->bytes != bytes) {
+ g_free(msg->bytes);
+ sms_datagram_set_bytes(msg, bytes, len);
+ }
+
+ msg->dst_port = dst_port;
+ msg->src_port = src_port;
+ }
+
+ sms_filter_message_processed(&msg->message, res);
+}
+
+static guint sms_filter_chain_send_datagram_process
+ (const struct ofono_sms_filter *filter,
+ struct sms_filter_message *msg)
+{
+ struct sms_filter_chain_send_datagram *send_msg =
+ sms_filter_chain_send_datagram_cast(msg);
+ struct sms_filter_chain *chain = msg->chain;
+
+ return filter->filter_send_datagram(chain->modem, &send_msg->addr,
+ send_msg->dst_port, send_msg->src_port,
+ send_msg->bytes, send_msg->len,
+ sms_filter_chain_send_datagram_process_cb,
+ send_msg);
+}
+
+static void sms_filter_chain_send_datagram_passthrough
+ (struct sms_filter_message *msg)
+{
+ struct sms_filter_chain_send_datagram *send_msg =
+ sms_filter_chain_send_datagram_cast(msg);
+
+ if (send_msg->send) {
+ struct sms_filter_chain *chain = msg->chain;
+ struct sms_address addr;
+
+ sms_filter_convert_sms_address_back(&addr, &send_msg->addr);
+ send_msg->send(chain->sms, &addr, send_msg->dst_port,
+ send_msg->src_port, send_msg->bytes,
+ send_msg->len, send_msg->flags,
+ send_msg->data);
+ }
+}
+
+static void sms_filter_chain_send_datagram_destroy
+ (struct sms_filter_message *msg)
+{
+ struct sms_filter_chain_send_datagram *send_msg =
+ sms_filter_chain_send_datagram_cast(msg);
+
+ if (send_msg->destroy) {
+ send_msg->destroy(send_msg->data);
+ }
+}
+
+static void sms_filter_chain_send_datagram_free
+ (struct sms_filter_message *msg)
+{
+ struct sms_filter_chain_send_datagram *send_msg =
+ sms_filter_chain_send_datagram_cast(msg);
+
+ g_free(send_msg->bytes);
+ g_free(send_msg);
+}
+
+static struct sms_filter_message *sms_filter_send_datagram_new
+ (struct sms_filter_chain *chain, const struct sms_address *addr,
+ int dst_port, int src_port, unsigned char *bytes,
+ unsigned int len, int flags, sms_send_datagram_cb_t send,
+ void *data, ofono_destroy_func destroy)
+{
+ static const struct sms_filter_message_fn send_datagram_fn = {
+ .name = "outgoing SMS data message",
+ .can_process = sms_filter_chain_send_datagram_can_process,
+ .process = sms_filter_chain_send_datagram_process,
+ .passthrough = sms_filter_chain_send_datagram_passthrough,
+ .destroy = sms_filter_chain_send_datagram_destroy,
+ .free = sms_filter_chain_send_datagram_free
+ };
+
+ struct sms_filter_chain_send_datagram *send_msg =
+ g_new0(struct sms_filter_chain_send_datagram, 1);
+
+ sms_filter_message_init(&send_msg->message, chain, &send_datagram_fn);
+ sms_filter_convert_sms_address(&send_msg->addr, addr);
+ send_msg->send = send;
+ send_msg->destroy = destroy;
+ send_msg->data = data;
+ sms_datagram_set_bytes(send_msg, bytes, len);
+ send_msg->dst_port = dst_port;
+ send_msg->src_port = src_port;
+ send_msg->flags = flags;
+ return &send_msg->message;
+}
+
/* sms_filter_chain_recv_text */
static inline struct sms_filter_chain_recv_text *
@@ -707,6 +854,30 @@
}
}
if (destroy) {
+ destroy(data);
+ }
+}
+
+void __ofono_sms_filter_chain_send_datagram(struct sms_filter_chain *chain,
+ const struct sms_address *addr, int dstport,
+ int srcport, unsigned char *bytes, int len,
+ int flags, sms_send_datagram_cb_t sender,
+ ofono_destroy_func destroy, void *data)
+{
+ if (chain) {
+ if (sms_filter_list) {
+ sms_filter_message_process
+ (sms_filter_send_datagram_new(chain, addr,
+ dstport, srcport, bytes, len,
+ flags, sender, data, destroy));
+ return;
+ }
+ if (sender) {
+ sender(chain->sms, addr, dstport, srcport, bytes, len,
+ flags, data);
+ }
+ }
+ if (destroy) {
destroy(data);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/sms.c
^
|
@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2015-2021 Jolla Ltd.
+ * Copyright (C) 2015-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -1043,6 +1043,64 @@
message->pending = NULL;
}
+static void sms_send_data_message_submit(struct ofono_sms *sms,
+ const struct sms_address *addr, int dstport,
+ int srcport, unsigned char *bytes, unsigned int len,
+ int flags, void *data)
+{
+ struct sms_message_data *message = data;
+ const char *to = sms_address_to_string(addr);
+ GSList *msg_list = NULL;
+ gboolean use_16bit_ref = FALSE;
+ gboolean use_delivery_reports;
+ int err;
+ struct ofono_uuid uuid;
+ enum ofono_sms_submit_flag submit_flags;
+ enum sms_datagram_endianess endianess = SMS_DATAGRAM_ENDIANESS_GSM;
+
+ if (bytes == NULL) {
+ __ofono_dbus_pending_reply(&message->pending,
+ __ofono_error_invalid_format(message->pending));
+ return;
+ }
+
+ if (flags & OFONO_SMS_DATA_FLAG_USE_LITTLE_ENDIAN)
+ endianess = SMS_DATAGRAM_ENDIANESS_LITTLE_ENDIAN;
+
+ use_delivery_reports = flags & OFONO_SMS_DATA_FLAG_DELIVERY_REPORT;
+ msg_list = sms_datagram_prepare_with_endianess(to, bytes, len, sms->ref,
+ use_16bit_ref, srcport, dstport, TRUE,
+ use_delivery_reports, endianess);
+
+ if (msg_list == NULL) {
+ __ofono_dbus_pending_reply(&message->pending,
+ __ofono_error_invalid_format(message->pending));
+ return;
+ }
+
+ submit_flags = OFONO_SMS_SUBMIT_FLAG_RETRY;
+ submit_flags |= OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS;
+
+ if (use_delivery_reports)
+ submit_flags |= OFONO_SMS_SUBMIT_FLAG_REQUEST_SR;
+
+ err = __ofono_sms_txq_submit(sms, msg_list, submit_flags, &uuid,
+ message_queued, message->pending);
+
+ g_slist_free_full(msg_list, g_free);
+
+ if (err < 0) {
+ __ofono_dbus_pending_reply(&message->pending,
+ __ofono_error_failed(message->pending));
+ return;
+ }
+
+ /* Ownership has been transfered to the message queue */
+ message->pending = NULL;
+
+ DBG("SMS data sent");
+}
+
static void sms_send_message_destroy(void *data)
{
struct sms_message_data *message = data;
@@ -1099,6 +1157,49 @@
return NULL;
}
+static DBusMessage *sms_send_data_message(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_sms *sms = data;
+ const char *to;
+ unsigned char *bytes = NULL;
+ struct sms_message_data *message;
+ struct sms_address addr;
+ dbus_int32_t srcport;
+ dbus_int32_t dstport;
+ dbus_uint32_t flags;
+ int len;
+
+ if (!ofono_dbus_access_method_allowed(dbus_message_get_sender(msg),
+ OFONO_DBUS_ACCESS_INTF_MESSAGEMGR,
+ OFONO_DBUS_ACCESS_MESSAGEMGR_SEND_DATA_MESSAGE, NULL))
+ return __ofono_error_access_denied(msg);
+
+ if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &to,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+ &bytes, &len,
+ DBUS_TYPE_INT32, &srcport,
+ DBUS_TYPE_INT32, &dstport,
+ DBUS_TYPE_UINT32, &flags,
+ DBUS_TYPE_INVALID))
+ return __ofono_error_invalid_args(msg);
+
+ if (valid_phone_number_format(to) == FALSE)
+ return __ofono_error_invalid_format(msg);
+
+ message = g_new0(struct sms_message_data, 1);
+ message->pending = dbus_message_ref(msg);
+
+ sms_address_from_string(&addr, to);
+ __ofono_sms_filter_chain_send_datagram(sms->filter_chain, &addr,
+ dstport, srcport, bytes, len, flags,
+ sms_send_data_message_submit,
+ sms_send_message_destroy, message);
+
+
+ return NULL;
+}
+
static DBusMessage *sms_get_messages(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -1216,6 +1317,15 @@
GDBUS_ARGS({ "to", "s" }, { "text", "s" }),
GDBUS_ARGS({ "path", "o" }),
sms_send_message) },
+ { GDBUS_ASYNC_METHOD("SendDataMessage",
+ GDBUS_ARGS(
+ { "to", "s" },
+ { "data", "ay" },
+ { "srcport", "i"},
+ { "dstport", "i"},
+ { "flags", "u"}),
+ GDBUS_ARGS({ "path", "o" }),
+ sms_send_data_message) },
{ GDBUS_METHOD("GetMessages",
NULL, GDBUS_ARGS({ "messages", "a(oa{sv})" }),
sms_get_messages) },
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/smsutil.c
^
|
@@ -3423,19 +3423,21 @@
}
/*
- * Prepares a datagram for transmission. Breaks up into fragments if
- * necessary using ref as the concatenated message reference number.
+ * Prepares a datagram for transmission with requested endianess Breaks up
+ * into fragments if necessary using ref as the concatenated message reference
+ * number.
* Returns a list of sms messages in order.
*
* @use_delivery_reports: value for the Status-Report-Request field
* (23.040 3.2.9, 9.2.2.2)
*/
-GSList *sms_datagram_prepare(const char *to,
+GSList *sms_datagram_prepare_with_endianess(const char *to,
const unsigned char *data, unsigned int len,
guint16 ref, gboolean use_16bit_ref,
unsigned short src, unsigned short dst,
gboolean use_16bit_port,
- gboolean use_delivery_reports)
+ gboolean use_delivery_reports,
+ enum sms_datagram_endianess endianess)
{
struct sms template;
unsigned int offset;
@@ -3462,10 +3464,22 @@
template.submit.ud[0] += 6;
template.submit.ud[offset] = SMS_IEI_APPLICATION_ADDRESS_16BIT;
template.submit.ud[offset + 1] = 4;
- template.submit.ud[offset + 2] = (dst & 0xff00) >> 8;
- template.submit.ud[offset + 3] = dst & 0xff;
- template.submit.ud[offset + 4] = (src & 0xff00) >> 8;
- template.submit.ud[offset + 5] = src & 0xff;
+
+ switch (endianess) {
+ case SMS_DATAGRAM_ENDIANESS_GSM:
+ case SMS_DATAGRAM_ENDIANESS_BIG_ENDIAN:
+ template.submit.ud[offset + 2] = (dst & 0xff00) >> 8;
+ template.submit.ud[offset + 3] = dst & 0xff;
+ template.submit.ud[offset + 4] = (src & 0xff00) >> 8;
+ template.submit.ud[offset + 5] = src & 0xff;
+ break;
+ case SMS_DATAGRAM_ENDIANESS_LITTLE_ENDIAN:
+ template.submit.ud[offset + 2] = dst & 0xff;
+ template.submit.ud[offset + 3] = (dst & 0xff00) >> 8;
+ template.submit.ud[offset + 4] = src & 0xff;
+ template.submit.ud[offset + 5] = (src & 0xff00) >> 8;
+ break;
+ }
offset += 6;
} else {
@@ -3489,8 +3503,18 @@
template.submit.ud[0] += 6;
template.submit.ud[offset] = SMS_IEI_CONCATENATED_16BIT;
template.submit.ud[offset + 1] = 4;
- template.submit.ud[offset + 2] = (ref & 0xff00) >> 8;
- template.submit.ud[offset + 3] = ref & 0xff;
+
+ switch (endianess) {
+ case SMS_DATAGRAM_ENDIANESS_GSM:
+ case SMS_DATAGRAM_ENDIANESS_BIG_ENDIAN:
+ template.submit.ud[offset + 2] = (ref & 0xff00) >> 8;
+ template.submit.ud[offset + 3] = ref & 0xff;
+ break;
+ case SMS_DATAGRAM_ENDIANESS_LITTLE_ENDIAN:
+ template.submit.ud[offset + 2] = ref & 0xff;
+ template.submit.ud[offset + 3] = (ref & 0xff00) >> 8;
+ break;
+ }
offset += 6;
} else {
@@ -3549,6 +3573,28 @@
}
/*
+ * Prepares a datagram for transmission Breaks up into fragments if
+ * necessary using ref as the concatenated message reference number.
+ * Returns a list of sms messages in order.
+ *
+ * @use_delivery_reports: value for the Status-Report-Request field
+ * (23.040 3.2.9, 9.2.2.2)
+ */
+
+GSList *sms_datagram_prepare(const char *to,
+ const unsigned char *data, unsigned int len,
+ guint16 ref, gboolean use_16bit_ref,
+ unsigned short src, unsigned short dst,
+ gboolean use_16bit_port,
+ gboolean use_delivery_reports)
+{
+ return sms_datagram_prepare_with_endianess(to, data, len, ref,
+ use_16bit_ref, src, dst,
+ use_16bit_port, use_delivery_reports,
+ SMS_DATAGRAM_ENDIANESS_GSM);
+}
+
+/*
* Prepares the text for transmission. Breaks up into fragments if
* necessary using ref as the concatenated message reference number.
* Returns a list of sms messages in order.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/smsutil.h
^
|
@@ -229,6 +229,12 @@
CBS_GEO_SCOPE_CELL_NORMAL
};
+enum sms_datagram_endianess {
+ SMS_DATAGRAM_ENDIANESS_GSM,
+ SMS_DATAGRAM_ENDIANESS_BIG_ENDIAN,
+ SMS_DATAGRAM_ENDIANESS_LITTLE_ENDIAN
+};
+
struct sms_address {
enum sms_number_type number_type;
enum sms_numbering_plan numbering_plan;
@@ -574,6 +580,14 @@
gboolean use_16bit_port,
gboolean use_delivery_reports);
+GSList *sms_datagram_prepare_with_endianess(const char *to,
+ const unsigned char *data, unsigned int len,
+ guint16 ref, gboolean use_16bit_ref,
+ unsigned short src, unsigned short dst,
+ gboolean use_16bit_port,
+ gboolean use_delivery_reports,
+ enum sms_datagram_endianess endianess);
+
gboolean cbs_dcs_decode(guint8 dcs, gboolean *udhi, enum sms_class *cls,
enum sms_charset *charset, gboolean *compressed,
enum cbs_language *language, gboolean *iso639);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/ussd.c
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2021-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -970,3 +971,17 @@
ussd->req->cb = NULL;
}
+
+/* Since mer/1.28+git2 */
+
+char *ofono_ussd_decode(int dcs, const void *pdu, int len)
+{
+ /* Returns NULL-terminated UTF-8 string */
+ return ussd_decode(dcs, len, pdu);
+}
+
+void ofono_ussd_decode_free(char *ussd)
+{
+ /* Deallocates a USSD string returned by ofono_ussd_decode */
+ return g_free(ussd);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/src/voicecall.c
^
|
@@ -1738,11 +1738,7 @@
string_to_phone_number(number, &ph);
- /* No filtering for emergency calls */
- if (is_emergency_number(vc, number))
- vc->driver->dial(vc, &ph, clir, cb, vc);
- else
- dial_filter(vc, &ph, clir, cb, vc);
+ dial_filter(vc, &ph, clir, cb, vc);
return 0;
}
@@ -4262,14 +4258,10 @@
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
__ofono_modem_inc_emergency_mode(modem);
-
- /* No filtering for emergency calls */
- vc->driver->dial(vc, &vc->dial_req->ph,
- OFONO_CLIR_OPTION_DEFAULT, dial_request_cb, vc);
- } else {
- dial_filter(vc, &vc->dial_req->ph, OFONO_CLIR_OPTION_DEFAULT,
- dial_request_cb, vc);
}
+
+ dial_filter(vc, &vc->dial_req->ph, OFONO_CLIR_OPTION_DEFAULT,
+ dial_request_cb, vc);
}
static void dial_req_disconnect_cb(const struct ofono_error *error, void *data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.29+git1.tar.bz2/ofono/test/dial-number
^
|
@@ -4,7 +4,8 @@
import dbus
if (len(sys.argv) < 2):
- print("Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]))
+ print("Usage: %s [modem] <number> [enabled|disabled|default]" % (sys.argv[0]))
+ print("Last argument enables/disables callerid")
sys.exit(1)
bus = dbus.SystemBus()
|