[PATCH 3/6] netmon: Add serving cell info support
by Nishanth V
---
Makefile.am | 3 +-
src/netmon.c | 350 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 1 +
3 files changed, 353 insertions(+), 1 deletion(-)
create mode 100644 src/netmon.c
diff --git a/Makefile.am b/Makefile.am
index b9f114d..ec648bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -598,7 +598,8 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
src/cdma-provision.c src/handsfree.c \
src/handsfree-audio.c src/bluetooth.h \
- src/hfp.h src/siri.c
+ src/hfp.h src/siri.c \
+ src/netmon.c
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
diff --git a/src/netmon.c b/src/netmon.c
new file mode 100644
index 0000000..a8a0ffd
--- /dev/null
+++ b/src/netmon.c
@@ -0,0 +1,350 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ *
+ * Copyright (C) 2008-2016 Intel Corporation. All rights reserved.
+ *
+ * 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
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <errno.h>
+
+#include <glib.h>
+#include <gdbus.h>
+
+#include "ofono.h"
+#include <ofono/netmon.h>
+
+#define CELL_INFO_DICT_APPEND(p_dict, key, info, type, dbus_type) do { \
+ type value; \
+ if (info < 0) \
+ break; \
+ value = (type) info; \
+ ofono_dbus_dict_append(p_dict, key, dbus_type, &value); \
+} while (0)
+
+
+static GSList *g_drivers = NULL;
+
+struct ofono_netmon {
+ const struct ofono_netmon_driver *driver;
+ DBusMessage *pending;
+ DBusMessage *reply;
+ void *driver_data;
+ struct ofono_atom *atom;
+};
+
+static const char *cell_type_to_tech_name(enum ofono_netmon_cell_type type)
+{
+ switch (type) {
+ case OFONO_NETMON_CELL_TYPE_GSM:
+ return "gsm";
+ case OFONO_NETMON_CELL_TYPE_UMTS:
+ return "umts";
+ case OFONO_NETMON_CELL_TYPE_LTE:
+ return "lte";
+ }
+
+ return NULL;
+}
+
+void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ enum ofono_netmon_info next_info_type = info_type;
+ const char *technology = cell_type_to_tech_name(type);
+ char *mcc = NULL;
+ char *mnc = NULL;
+ int intval;
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+
+ if (netmon->reply == NULL)
+ return;
+
+ dbus_message_iter_init_append(netmon->reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (technology == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology", DBUS_TYPE_STRING, &technology);
+
+ while (next_info_type != OFONO_NETMON_INFO_INVALID) {
+ switch (next_info_type) {
+ case OFONO_NETMON_INFO_MCC:
+ mcc = va_arg(arglist, char *);
+
+ if (mcc && strlen(mcc))
+ ofono_dbus_dict_append(&dict, "MobileCountryCode",
+ DBUS_TYPE_STRING, &mcc);
+
+ break;
+
+ case OFONO_NETMON_INFO_MNC:
+ mnc = va_arg(arglist, char *);
+
+ if (mnc && strlen(mnc))
+ ofono_dbus_dict_append(&dict, "MobileNetworkCode", \
+ DBUS_TYPE_STRING, &mnc);
+
+ break;
+
+ case OFONO_NETMON_INFO_LAC:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "LocationAreaCode", \
+ intval, uint16_t, DBUS_TYPE_UINT16);
+
+ break;
+
+ case OFONO_NETMON_INFO_CI:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "CellId",
+ intval, uint32_t, DBUS_TYPE_UINT32);
+
+ break;
+
+ case OFONO_NETMON_INFO_ARFCN:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "ARFCN",
+ intval, uint16_t, DBUS_TYPE_UINT16);
+ break;
+
+ case OFONO_NETMON_INFO_BSIC:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "BSIC",
+ intval, uint8_t, DBUS_TYPE_BYTE);
+
+ break;
+
+ case OFONO_NETMON_INFO_RXLEV:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalStrength",
+ intval, uint8_t, DBUS_TYPE_BYTE);
+
+ break;
+
+ case OFONO_NETMON_INFO_TIMING_ADVANCE:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "TimingAdvance",
+ intval, uint8_t, DBUS_TYPE_BYTE);
+
+ break;
+
+ case OFONO_NETMON_INFO_PSC:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "PrimaryScramblingCode",
+ intval, uint16_t, DBUS_TYPE_UINT16);
+
+ break;
+
+ case OFONO_NETMON_INFO_BER:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "BitErrorRate", \
+ intval, uint8_t, DBUS_TYPE_BYTE);
+
+ break;
+
+ case OFONO_NETMON_INFO_RSSI:
+ intval = va_arg(arglist, int);
+
+ CELL_INFO_DICT_APPEND(&dict, "Strength", \
+ intval, uint8_t, DBUS_TYPE_BYTE);
+ break;
+
+ case OFONO_NETMON_INFO_INVALID:
+ break;
+ }
+
+ next_info_type = va_arg(arglist, int);
+ }
+
+done:
+ va_end(arglist);
+
+ dbus_message_iter_close_container(&iter, &dict);
+}
+
+static void serving_cell_info_callback(const struct ofono_error *error,
+ void *data)
+{
+ struct ofono_netmon *netmon = data;
+ DBusMessage *reply = netmon->reply;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
+ reply = __ofono_error_failed(netmon->pending);
+
+ __ofono_dbus_pending_reply(&netmon->pending, reply);
+}
+
+static DBusMessage *netmon_get_serving_cell_info(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_netmon *netmon = data;
+
+ if (!netmon->driver && !netmon->driver->request_update)
+ return __ofono_error_not_implemented(msg);
+
+ if (netmon->pending)
+ return __ofono_error_busy(msg);
+
+ netmon->pending = dbus_message_ref(msg);
+
+ netmon->driver->request_update(netmon, serving_cell_info_callback, netmon);
+
+ return NULL;
+}
+
+static const GDBusMethodTable netmon_methods[] = {
+ { GDBUS_ASYNC_METHOD("GetServingCellInformation",
+ NULL, GDBUS_ARGS({ "cellinfo", "a{sv}" }),
+ netmon_get_serving_cell_info) },
+ { }
+};
+
+int ofono_netmon_driver_register(const struct ofono_netmon_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ if (d->probe == NULL)
+ return -EINVAL;
+
+ g_drivers = g_slist_prepend(g_drivers, (void *) d);
+
+ return 0;
+}
+
+void ofono_netmon_driver_unregister(const struct ofono_netmon_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ g_drivers = g_slist_remove(g_drivers, (void *) d);
+}
+
+static void netmon_unregister(struct ofono_atom *atom)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(atom);
+ const char *path = __ofono_atom_get_path(atom);
+
+ ofono_modem_remove_interface(modem, OFONO_NETMON_INTERFACE);
+ g_dbus_unregister_interface(conn, path, OFONO_NETMON_INTERFACE);
+}
+
+static void netmon_remove(struct ofono_atom *atom)
+{
+ struct ofono_netmon *netmon = __ofono_atom_get_data(atom);
+
+ if (netmon == NULL)
+ return;
+
+ if (netmon->driver && netmon->driver->remove)
+ netmon->driver->remove(netmon);
+
+ g_free(netmon);
+}
+
+struct ofono_netmon *ofono_netmon_create(struct ofono_modem *modem,
+ unsigned int vendor, const char *driver, void *data)
+{
+ struct ofono_netmon *netmon;
+ GSList *l;
+
+ if (driver == NULL)
+ return NULL;
+
+ netmon = g_try_new0(struct ofono_netmon, 1);
+
+ if (netmon == NULL)
+ return NULL;
+
+ netmon->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_NETMON,
+ netmon_remove, netmon);
+
+ for (l = g_drivers; l; l = l->next) {
+ const struct ofono_netmon_driver *drv = l->data;
+
+ if (g_strcmp0(drv->name, driver))
+ continue;
+
+ if (drv->probe(netmon, vendor, data) < 0)
+ continue;
+
+ netmon->driver = drv;
+ break;
+ }
+
+ return netmon;
+}
+
+void ofono_netmon_register(struct ofono_netmon *netmon)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(netmon->atom);
+ const char *path = __ofono_atom_get_path(netmon->atom);
+
+ if (!g_dbus_register_interface(conn, path,
+ OFONO_NETMON_INTERFACE,
+ netmon_methods, NULL, NULL,
+ netmon, NULL)) {
+ ofono_error("Could not create %s interface",
+ OFONO_NETMON_INTERFACE);
+ return;
+ }
+
+ ofono_modem_add_interface(modem, OFONO_NETMON_INTERFACE);
+
+ __ofono_atom_register(netmon->atom, netmon_unregister);
+}
+
+void ofono_netmon_remove(struct ofono_netmon *netmon)
+{
+ __ofono_atom_free(netmon->atom);
+}
+
+void ofono_netmon_set_data(struct ofono_netmon *netmon, void *data)
+{
+ netmon->driver_data = data;
+}
+
+void *ofono_netmon_get_data(struct ofono_netmon *netmon)
+{
+ return netmon->driver_data;
+}
diff --git a/src/ofono.h b/src/ofono.h
index bfcb58f..31fb893 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -152,6 +152,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_CDMA_NETREG,
OFONO_ATOM_TYPE_HANDSFREE,
OFONO_ATOM_TYPE_SIRI,
+ OFONO_ATOM_TYPE_NETMON,
};
enum ofono_atom_watch_condition {
--
1.9.1
4 years, 9 months
[PATCH 2/6] gril: Added RIL_REQUEST_GET_CELL_INFO_LIST
by Nishanth V
---
gril/grilutil.c | 2 ++
gril/ril_constants.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/gril/grilutil.c b/gril/grilutil.c
index 3970517..9e7cd31 100644
--- a/gril/grilutil.c
+++ b/gril/grilutil.c
@@ -334,6 +334,8 @@ const char *ril_request_id_to_string(int req)
return "RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU";
case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS:
return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS";
+ case RIL_REQUEST_GET_CELL_INFO_LIST:
+ return "RIL_REQUEST_GET_CELL_INFO_LIST";
case RIL_REQUEST_SET_INITIAL_ATTACH_APN:
return "RIL_REQUEST_SET_INITIAL_ATTACH_APN";
default:
diff --git a/gril/ril_constants.h b/gril/ril_constants.h
index 6649353..cbc596e 100644
--- a/gril/ril_constants.h
+++ b/gril/ril_constants.h
@@ -347,6 +347,7 @@
#define RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU 106
#define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107
#define RIL_REQUEST_VOICE_RADIO_TECH 108
+#define RIL_REQUEST_GET_CELL_INFO_LIST 109
#define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111
/* RIL Unsolicited Messages */
--
1.9.1
4 years, 9 months
[PATCH] gril: Really use given uid/gid to open ril socket
by Alfonso Sanchez-Beato
---
gril/gril.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/gril/gril.c b/gril/gril.c
index fa1a780..297a772 100644
--- a/gril/gril.c
+++ b/gril/gril.c
@@ -824,14 +824,15 @@ static struct ril_s *create_ril(const char *sock_path, unsigned int uid,
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, sock_path, sizeof(addr.sun_path) - 1);
- if (uid != 0 && seteuid(uid) < 0)
- ofono_error("%s: seteuid(%d) failed: %s (%d)",
- __func__, uid, strerror(errno), errno);
-
+ /* Drop root user last, otherwise we won't be able to change egid */
if (gid != 0 && setegid(gid) < 0)
ofono_error("%s: setegid(%d) failed: %s (%d)",
__func__, gid, strerror(errno), errno);
+ if (uid != 0 && seteuid(uid) < 0)
+ ofono_error("%s: seteuid(%d) failed: %s (%d)",
+ __func__, uid, strerror(errno), errno);
+
r = connect(sk, (struct sockaddr *) &addr, sizeof(addr));
/* Switch back to root as needed */
@@ -1053,7 +1054,7 @@ GRil *g_ril_new_with_ucred(const char *sock_path, enum ofono_ril_vendor vendor,
if (ril == NULL)
return NULL;
- ril->parent = create_ril(sock_path, 0, 0);
+ ril->parent = create_ril(sock_path, uid, gid);
if (ril->parent == NULL) {
g_free(ril);
return NULL;
--
2.5.0
4 years, 9 months
[PATCH] test: Add sms bearer set and SMSC set scripts
by Samrat Guha Niyogi
From: Anirudh Gargi <anirudh.gargi(a)intel.com>
---
test/set-sms-bearer | 31 +++++++++++++++++++++++++++++++
test/set-sms-smsc | 31 +++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100755 test/set-sms-bearer
create mode 100755 test/set-sms-smsc
diff --git a/test/set-sms-bearer b/test/set-sms-bearer
new file mode 100755
index 0000000..33e64e3
--- /dev/null
+++ b/test/set-sms-bearer
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import sys
+import dbus
+
+if len(sys.argv) < 2:
+ print("Usage: %s <bearer> Bearer types: <cs-only> <ps-only> <cs-preferred> <ps-preferred>" %\
+ (sys.argv[0]))
+ sys.exit(1)
+
+def message_bearer(sms, value):
+ try:
+ sms.SetProperty("Bearer", dbus.String(value))
+ except dbus.DBusException as e:
+ print("Unable to set Bearer[%s] - FAIL" % (value))
+ exit(1)
+
+bus = dbus.SystemBus()
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),'org.ofono.Manager')
+modems = manager.GetModems()
+value = sys.argv[1]
+
+for path, properties in modems:
+ print("Setting bearer for [ %s ]" % (path))
+
+ if "org.ofono.MessageManager" not in properties["Interfaces"]:
+ continue
+
+ sms = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.MessageManager')
+
+ message_bearer(sms, value)
+ print("SMS Bearer updated for [ %s ]" % (path))
diff --git a/test/set-sms-smsc b/test/set-sms-smsc
new file mode 100755
index 0000000..7fc9e4d
--- /dev/null
+++ b/test/set-sms-smsc
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import sys
+import dbus
+
+if len(sys.argv) < 2:
+ print("Usage: %s <SMSC address>" % (sys.argv[0]))
+ sys.exit(1)
+
+def message_service_center_address(sms, value):
+ try:
+ sms.SetProperty("ServiceCenterAddress", dbus.String(value))
+ except dbus.DBusException as e:
+ print("Unable to set correct Service Center Address - FAIL")
+ exit(1)
+
+bus = dbus.SystemBus()
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),'org.ofono.Manager')
+modems = manager.GetModems()
+value = sys.argv[1]
+
+for path, properties in modems:
+ print("Setting SMSC for [ %s ]" % (path))
+
+ if "org.ofono.MessageManager" not in properties["Interfaces"]:
+ continue
+
+ sms = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.MessageManager')
+
+ message_service_center_address(sms, value)
+ print("SMSC address Updated for [ %s ]" % (path))
--
1.9.1
4 years, 9 months
[PATCH] sofia3gr: Enable vendor type in SMS driver
by Samrat Guha Niyogi
From: Anirudh Gargi <anirudh.gargi(a)intel.com>
---
plugins/ril_sofia3gr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/ril_sofia3gr.c b/plugins/ril_sofia3gr.c
index 0d4a204..ac60f7f 100644
--- a/plugins/ril_sofia3gr.c
+++ b/plugins/ril_sofia3gr.c
@@ -152,7 +152,7 @@ static void ril_post_sim(struct ofono_modem *modem)
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
- ofono_sms_create(modem, 0, "rilmodem", rd->ril);
+ ofono_sms_create(modem, OFONO_RIL_VENDOR_IMC_SOFIA3GR, "rilmodem", rd->ril);
gprs = ofono_gprs_create(modem, 0, "rilmodem", rd->ril);
gc = ofono_gprs_context_create(modem, 0, "rilmodem", rd->ril);
--
1.9.1
4 years, 9 months
[PATCH] rilmodem: Add sms bearer set and bearer query func
by Samrat Guha Niyogi
From: Anirudh Gargi <anirudh.gargi(a)intel.com>
---
drivers/rilmodem/sms.c | 148 ++++++++++++++++++++++++++++++++++++++++++++--
drivers/rilmodem/vendor.h | 3 +-
2 files changed, 144 insertions(+), 7 deletions(-)
diff --git a/drivers/rilmodem/sms.c b/drivers/rilmodem/sms.c
index ea57b84..4b8d07c 100644
--- a/drivers/rilmodem/sms.c
+++ b/drivers/rilmodem/sms.c
@@ -185,6 +185,146 @@ static void ril_submit_sms_cb(struct ril_msg *message, gpointer user_data)
CALLBACK_WITH_SUCCESS(cb, mr, cbd->data);
}
+static void imc_sms_bearer_query_cb(struct ril_msg *message,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_sms_bearer_query_cb_t cb = cbd->cb;
+ struct parcel rilp;
+ int bearer;
+ char **strv = NULL;
+ char *endptr;
+
+ DBG("");
+
+ if (message->error != RIL_E_SUCCESS) {
+ ofono_error("Reply failure: %s",
+ ril_error_to_string(message->error));
+ goto error;
+ }
+
+ /*
+ * OEM_HOOK_STRINGS response is a char**, representing
+ * an array of null-terminated UTF-8 strings.
+ */
+ g_ril_init_parcel(message, &rilp);
+ strv = parcel_r_strv(&rilp);
+
+ if (strv == NULL){
+ ofono_error("%s: malformed parcel", __func__);
+ goto error;
+ }
+
+ bearer = strtoul(strv[0], &endptr, 10); /* convert to int */
+
+ if (endptr == strv[0] || *endptr != '\0') {
+ ofono_error("Convert to Int failed");
+ goto error;
+ }
+
+ g_strfreev(strv);
+
+ CALLBACK_WITH_SUCCESS(cb, bearer, cbd->data);
+ return;
+error:
+
+ if(strv != NULL)
+ g_strfreev(strv);
+
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+}
+
+static void ril_sms_bearer_query(struct ofono_sms *sms,
+ ofono_sms_bearer_query_cb_t cb, void *user_data)
+{
+ struct sms_data *sd = ofono_sms_get_data(sms);
+ struct cb_data *cbd = cb_data_new(cb, user_data, sd);
+ struct parcel rilp;
+ int cmd_id;
+ char buf[4];
+
+ DBG("");
+
+ if (sd->vendor == OFONO_RIL_VENDOR_IMC_SOFIA3GR) {
+ /*
+ * OEM_HOOK_STRINGS request is a char **, representing an array
+ * of null-terminated UTF-8 strings. Here just cmd_id as string.
+ */
+ parcel_init(&rilp);
+ parcel_w_int32(&rilp, 1); /* No. of strings */
+
+ /* RIL_OEM_HOOK_STRING_GET_SMS_TRANSPORT_MODE = 0x000000A9 */
+ cmd_id = 0x000000A9;
+ sprintf(buf, "%d", cmd_id);
+ parcel_w_string(&rilp, buf);
+
+ if (g_ril_send(sd->ril, RIL_REQUEST_OEM_HOOK_STRINGS, &rilp,
+ imc_sms_bearer_query_cb,
+ cbd, g_free) > 0)
+ return;
+ }
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, -1, user_data);
+}
+
+static void imc_set_domain_pref_cb(struct ril_msg *message, void *user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_sms_bearer_set_cb_t cb = cbd->cb;
+ struct sms_data *sd = cbd->user;
+
+ DBG("");
+
+ if (message->error != RIL_E_SUCCESS) {
+ ofono_error("%s RILD reply failure: %s",
+ g_ril_request_id_to_string(sd->ril, message->req),
+ ril_error_to_string(message->error));
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+ return;
+ }
+
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+}
+
+static void ril_sms_bearer_set(struct ofono_sms *sms, int bearer,
+ ofono_sms_bearer_set_cb_t cb, void *user_data)
+{
+ struct sms_data *sd = ofono_sms_get_data(sms);
+ struct cb_data *cbd = cb_data_new(cb, user_data, sd);
+ struct parcel rilp;
+ int cmd_id;
+ char buf1[4];
+ char buf2[4];
+
+ DBG("Bearer: %d", bearer);
+
+ if (sd->vendor == OFONO_RIL_VENDOR_IMC_SOFIA3GR) {
+ /*
+ * OEM_HOOK_STRINGS request is a char **, representing an array
+ * of null-terminated UTF-8 strings. Here cmd_id and domain
+ * to be sent as strings.
+ */
+ parcel_init(&rilp);
+ parcel_w_int32(&rilp, 2); /* no. of strings */
+
+ /* RIL_OEM_HOOK_STRING_SET_SMS_TRANSPORT_MODE = 0x000000AA */
+ cmd_id = 0x000000AA;
+ sprintf(buf1, "%d", cmd_id);
+ parcel_w_string(&rilp, buf1);
+ sprintf(buf2, "%d", bearer);
+ parcel_w_string(&rilp, buf2);
+
+ if (g_ril_send(sd->ril, RIL_REQUEST_OEM_HOOK_STRINGS, &rilp,
+ imc_set_domain_pref_cb,
+ cbd, g_free) > 0)
+ return;
+ }
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, user_data);
+}
+
static void ril_cmgs(struct ofono_sms *sms, const unsigned char *pdu,
int pdu_len, int tpdu_len, int mms,
ofono_sms_submit_cb_t cb, void *user_data)
@@ -370,12 +510,8 @@ static struct ofono_sms_driver driver = {
.sca_set = ril_csca_set,
.remove = ril_sms_remove,
.submit = ril_cmgs,
-
- /*
- * TODO: investigate/implement:
- * .bearer_query = NULL,
- * .bearer_set = NULL,
- */
+ .bearer_query = ril_sms_bearer_query,
+ .bearer_set = ril_sms_bearer_set
};
void ril_sms_init(void)
diff --git a/drivers/rilmodem/vendor.h b/drivers/rilmodem/vendor.h
index 83cc939..82f6ceb 100644
--- a/drivers/rilmodem/vendor.h
+++ b/drivers/rilmodem/vendor.h
@@ -26,7 +26,8 @@ enum ofono_ril_vendor {
OFONO_RIL_VENDOR_AOSP = 0,
OFONO_RIL_VENDOR_MTK,
OFONO_RIL_VENDOR_INFINEON,
- OFONO_RIL_VENDOR_QCOM_MSIM
+ OFONO_RIL_VENDOR_QCOM_MSIM,
+ OFONO_RIL_VENDOR_IMC_SOFIA3GR
};
#endif /* RILMODEM_VENDOR_H */
--
1.9.1
4 years, 9 months
[PATCH] gprs: assume attached state when registered on LTE
by Dragos Tatulea
LTE doesn't really use the concept of an attached state. However,
the oFono API needs it. ConnMan needs it as well.
---
src/gprs.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/gprs.c b/src/gprs.c
index 9a85121..3acb412 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1585,12 +1585,27 @@ static void release_active_contexts(struct ofono_gprs *gprs)
}
}
-static void gprs_attached_update(struct ofono_gprs *gprs)
+static void gprs_set_attached_property(struct ofono_gprs *gprs,
+ ofono_bool_t attached)
{
- DBusConnection *conn = ofono_dbus_get_connection();
const char *path;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ dbus_bool_t value = attached;
+
+ if (gprs->attached == attached)
+ return;
+
+ gprs->attached = attached;
+
+ path = __ofono_atom_get_path(gprs->atom);
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_CONNECTION_MANAGER_INTERFACE,
+ "Attached", DBUS_TYPE_BOOLEAN, &value);
+}
+
+static void gprs_attached_update(struct ofono_gprs *gprs)
+{
ofono_bool_t attached;
- dbus_bool_t value;
attached = gprs->driver_attached &&
(gprs->status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
@@ -1613,13 +1628,7 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
return;
}
- gprs->attached = attached;
-
- path = __ofono_atom_get_path(gprs->atom);
- value = attached;
- ofono_dbus_signal_property_changed(conn, path,
- OFONO_CONNECTION_MANAGER_INTERFACE,
- "Attached", DBUS_TYPE_BOOLEAN, &value);
+ gprs_set_attached_property(gprs, attached);
}
static void registration_status_cb(const struct ofono_error *error,
@@ -1690,6 +1699,13 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
DBG("attach: %u, driver_attached: %u", attach, gprs->driver_attached);
+ if (ofono_netreg_get_technology(gprs->netreg) ==
+ ACCESS_TECHNOLOGY_EUTRAN) {
+ /* Ignore attach logic for LTE. There is no such concept. */
+ gprs_set_attached_property(gprs, attach);
+ return;
+ }
+
if (gprs->driver_attached == attach)
return;
--
2.5.5
4 years, 10 months
[PATCH v4 0/5] allow automatic context activation
by Dragos Tatulea
LTE uses default bearer activation. Once register to the network is
received of which context has been activated.
This patchset takes action in the atmodem gprs driver when receiving
the activation event. It reads the cid and apn and sends it to the
gprs core. From there a matching (my apn) pri_context is
found/created and a gprs-context driver is assigned.
A read_settings operation has been added to the gprs-context driver
to read context ip configuration without activating the context.
The last patch in the patchset adds this support to the U-Blox
Toby L2 modem.
Implementation based mostly on ideas from Denis Kenzior.
Changes in patchset v4:
* Patchset v3 was borked.
Changes in patchset v3:
* Fixed apn string length check.
Changes in patchset v2:
* Removed reliance on pri_activate_callback
* Context recycling: Use failed provision node if no apn match.
* Assign APN to pri_context if apn field is NULL.
* Fixed all suggestions from v1 review.
Dragos Tatulea (5):
idmap: add api for finding a certain id in map
gprs-context.h: add op for reading context config
gprs: implement ofono_gprs_cid_activated
atmodem: gprs: handle automatic context activation
ubloxmodem: support automatic ctx activation
drivers/atmodem/gprs.c | 50 +++++++++++++++++
drivers/ubloxmodem/gprs-context.c | 32 +++++++----
include/gprs-context.h | 3 +
src/gprs.c | 114 ++++++++++++++++++++++++++++++++++++++
src/idmap.c | 12 ++++
src/idmap.h | 1 +
6 files changed, 202 insertions(+), 10 deletions(-)
--
2.5.0
4 years, 10 months
[PATCH v3 0/9] allow automatic context activation
by Dragos Tatulea
LTE uses default bearer activation. Once register to the network is
received of which context has been activated.
This patchset takes action in the atmodem gprs driver when receiving
the activation event. It reads the cid and apn and sends it to the
gprs core. From there a matching (my apn) pri_context is
found/created and a gprs-context driver is assigned.
A read_settings operation has been added to the gprs-context driver
to read context ip configuration without activating the context.
The last patch in the patchset adds this support to the U-Blox
Toby L2 modem.
Implementation based mostly on ideas from Denis Kenzior.
Changes in patchset v3:
* Fixed apn string length check.
Changes in patchset v2:
* Removed reliance on pri_activate_callback
* Context recycling: Use failed provision node if no apn match.
* Assign APN to pri_context if apn field is NULL.
* Fixed all suggestions from v1 review.
Dragos Tatulea (5):
idmap: add api for finding a certain id in map
gprs-context.h: add op for reading context config
gprs: implement ofono_gprs_cid_activated
atmodem: gprs: handle automatic context activation
ubloxmodem: support automatic ctx activation
drivers/atmodem/gprs.c | 50 +++++++++++++++++
drivers/ubloxmodem/gprs-context.c | 32 +++++++----
include/gprs-context.h | 3 +
src/gprs.c | 114 ++++++++++++++++++++++++++++++++++++++
src/idmap.c | 12 ++++
src/idmap.h | 1 +
6 files changed, 202 insertions(+), 10 deletions(-)
--
2.5.0
4 years, 10 months
[PATCH v2 0/9] allow automatic context activation
by Dragos Tatulea
LTE uses default bearer activation. Once register to the network is
received of which context has been activated.
This patchset takes action in the atmodem gprs driver when receiving
the activation event. It reads the cid and apn and sends it to the
gprs core. From there a matching (my apn) pri_context is
found/created and a gprs-context driver is assigned.
A read_settings operation has been added to the gprs-context driver
to read context ip configuration without activating the context.
The last patch in the patchset adds this support to the U-Blox
Toby L2 modem.
Implementation based mostly on ideas from Denis Kenzior.
Changes in patchset v2:
* Removed reliance on pri_activate_callback
* Context recycling: Use failed provision node if no apn match.
* Assign APN to pri_context if apn field is NULL.
* Fixed all suggestions from v1 review.
Dragos Tatulea (5):
idmap: add api for finding a certain id in map
gprs-context.h: add op for reading context config
gprs: implement ofono_gprs_cid_activated
atmodem: gprs: handle automatic context activation
ubloxmodem: support automatic ctx activation
drivers/atmodem/gprs.c | 50 +++++++++++++++++
drivers/ubloxmodem/gprs-context.c | 32 +++++++----
include/gprs-context.h | 3 +
src/gprs.c | 114 ++++++++++++++++++++++++++++++++++++++
src/idmap.c | 12 ++++
src/idmap.h | 1 +
6 files changed, 202 insertions(+), 10 deletions(-)
--
2.5.0
4 years, 10 months