All of lore.kernel.org
 help / color / mirror / Atom feed
* Monitor current technology
@ 2010-06-24 13:55 Daniel Wagner
  2010-06-24 13:55 ` [PATCH v2 1/3] Add CurrentTechnology property to DCM Daniel Wagner
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Daniel Wagner @ 2010-06-24 13:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

This series adds a new property to DCM to export the 
current technology used. 

Changes from the last version:

 - The core will only update the CurrentTechnology when
   attached and != -1.

Here is a log from ofonod: http://pastebin.com/A8r4wNqL
Here is a log from ofono-monitor: http://pastebin.com/e11jRrxB


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] Add CurrentTechnology property to DCM
  2010-06-24 13:55 Monitor current technology Daniel Wagner
@ 2010-06-24 13:55 ` Daniel Wagner
  2010-06-24 13:55 ` [PATCH v2 2/3] Pass down vendor flag into DCM Daniel Wagner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2010-06-24 13:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3847 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

---
 doc/dataconnectionmanager-api.txt |    7 ++++++
 include/gprs.h                    |    1 +
 src/gprs.c                        |   40 +++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/doc/dataconnectionmanager-api.txt b/doc/dataconnectionmanager-api.txt
index 510bd42..cb6b699 100644
--- a/doc/dataconnectionmanager-api.txt
+++ b/doc/dataconnectionmanager-api.txt
@@ -75,6 +75,13 @@ Properties	array{object} PrimaryContexts [readonly]
 			this value to off detaches the modem from the
 			Packet Domain network.
 
+		string CurrentTechnology [readonly, optional]
+
+			Contains the current technology used.
+
+			The possible values are: "gsm", "edge", "umts", "hspa",
+							"lte"
+
 Primary Data Context hierarchy
 =================
 
diff --git a/include/gprs.h b/include/gprs.h
index a1cbcd9..44ccb09 100644
--- a/include/gprs.h
+++ b/include/gprs.h
@@ -48,6 +48,7 @@ struct ofono_gprs_driver {
 };
 
 void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status);
+void ofono_gprs_technology_notify(struct ofono_gprs *gprs, int technology);
 void ofono_gprs_detached_notify(struct ofono_gprs *gprs);
 
 int ofono_gprs_driver_register(const struct ofono_gprs_driver *d);
diff --git a/src/gprs.c b/src/gprs.c
index 11876e2..5feac38 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -66,6 +66,7 @@ struct ofono_gprs {
 	ofono_bool_t powered;
 	int status;
 	int flags;
+	int technology;
 	struct idmap *pid_map;
 	unsigned int last_context_id;
 	struct idmap *cid_map;
@@ -879,6 +880,8 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
 						"Active", DBUS_TYPE_BOOLEAN,
 						&value);
 		}
+
+		gprs->technology = -1;
 	}
 
 	path = __ofono_atom_get_path(gprs->atom);
@@ -1007,6 +1010,14 @@ static DBusMessage *gprs_get_properties(DBusConnection *conn,
 	value = gprs->powered;
 	ofono_dbus_dict_append(&dict, "Powered", DBUS_TYPE_BOOLEAN, &value);
 
+	if (gprs->technology != -1) {
+		const char *technology =
+			registration_tech_to_string(gprs->technology);
+
+		ofono_dbus_dict_append(&dict, "CurrentTechnology",
+				DBUS_TYPE_STRING, &technology);
+	}
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
@@ -1302,6 +1313,24 @@ static GDBusSignalTable manager_signals[] = {
 	{ }
 };
 
+static void set_gprs_technology(struct ofono_gprs *gprs, int technology)
+{
+	const char *str_technology =
+		registration_tech_to_string(technology);
+	const char *path = __ofono_atom_get_path(gprs->atom);
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	gprs->technology = technology;
+
+	if (gprs->technology == -1)
+		return;
+
+	ofono_dbus_signal_property_changed(conn, path,
+					OFONO_DATA_CONNECTION_MANAGER_INTERFACE,
+					"CurrentTechnology", DBUS_TYPE_STRING,
+					&str_technology);
+}
+
 void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
 {
 	if (gprs->driver_attached == FALSE)
@@ -1326,6 +1355,16 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 	gprs_attached_update(gprs);
 }
 
+void ofono_gprs_technology_notify(struct ofono_gprs *gprs, int technology)
+{
+	/* If we are not attached, ignore */
+	if (gprs->attached == FALSE)
+		return;
+
+	if (gprs->technology != technology)
+		set_gprs_technology(gprs, technology);
+}
+
 void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
 				unsigned int min, unsigned int max)
 {
@@ -1602,6 +1641,7 @@ struct ofono_gprs *ofono_gprs_create(struct ofono_modem *modem,
 	gprs->status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
 	gprs->netreg_status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
 	gprs->pid_map = idmap_new(MAX_CONTEXTS);
+	gprs->technology = -1;
 
 	return gprs;
 }
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] Pass down vendor flag into DCM
  2010-06-24 13:55 Monitor current technology Daniel Wagner
  2010-06-24 13:55 ` [PATCH v2 1/3] Add CurrentTechnology property to DCM Daniel Wagner
@ 2010-06-24 13:55 ` Daniel Wagner
  2010-06-24 13:55 ` [PATCH v2 3/3] Monitor current technology used for Option modems Daniel Wagner
  2010-06-25 15:47 ` Monitor current technology Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2010-06-24 13:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

---
 plugins/hso.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/plugins/hso.c b/plugins/hso.c
index 9e3b35a..e645221 100644
--- a/plugins/hso.c
+++ b/plugins/hso.c
@@ -246,7 +246,8 @@ static void hso_post_sim(struct ofono_modem *modem)
 				"atmodem", data->app);
 	ofono_ussd_create(modem, 0, "atmodem", data->app);
 
-	gprs = ofono_gprs_create(modem, 0, "atmodem", data->app);
+	gprs = ofono_gprs_create(modem, OFONO_VENDOR_OPTION_HSO,
+				"atmodem", data->app);
 	gc = ofono_gprs_context_create(modem, 0, "hsomodem", data->control);
 
 	if (gprs && gc)
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] Monitor current technology used for Option modems
  2010-06-24 13:55 Monitor current technology Daniel Wagner
  2010-06-24 13:55 ` [PATCH v2 1/3] Add CurrentTechnology property to DCM Daniel Wagner
  2010-06-24 13:55 ` [PATCH v2 2/3] Pass down vendor flag into DCM Daniel Wagner
@ 2010-06-24 13:55 ` Daniel Wagner
  2010-06-25 15:47 ` Monitor current technology Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2010-06-24 13:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 5614 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

---
 drivers/atmodem/gprs.c |  170 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 170 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index bf82d06..9988217 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -48,8 +48,84 @@ static const char *none_prefix[] = { NULL };
 struct gprs_data {
 	GAtChat *chat;
 	unsigned int vendor;
+	int ossysi; /* option hso 2G/3G info */
+	int octi; /* option hso 2G info details */
+	int ouwcti; /* otpion hso 3G info details */
 };
 
+static int option_octi_to_tech(struct gprs_data *gd)
+{
+	int tech = -1;
+	switch (gd->octi) {
+	case 1:	/* GSM */
+		tech = 0;
+		break;
+	case 2: /* GPRS */
+		tech = 1;
+		break;
+	case 3:	/* EDGE */
+		tech = 3;
+	}
+
+	return tech;
+}
+
+static int option_ouwcti_to_tech(struct gprs_data *gd)
+{
+	int tech = -1;
+
+	switch (gd->ouwcti) {
+	case 1: /* UMTS */
+		tech = 2;
+		break;
+	case 2: /* HSDPA */
+		tech = 4;
+		break;
+	case 3: /* HSUPA */
+		tech = 5;
+		break;
+	case 4: /* HSPA */
+		tech = 6;
+	}
+
+	return tech;
+}
+
+static int option_get_tech(struct gprs_data *gd)
+{
+	int tech = -1;
+	int tech_2g, tech_3g;
+
+	switch (gd->ossysi) {
+	case -1:
+		tech_2g = option_octi_to_tech(gd);
+		tech_3g = option_ouwcti_to_tech(gd);
+
+		/* 3G tech takes precedence over 2G tech */
+		if (tech_3g == -1)
+			tech = tech_2g;
+		else
+			tech = tech_3g;
+		break;
+	case 0: /* 2G */
+		tech = option_octi_to_tech(gd);
+		break;
+	case 2: /* 3G */
+		tech = option_ouwcti_to_tech(gd);
+		break;
+	case 3: /* Unknown */
+		/* reset all ossysi and octi */
+		gd->octi = -1;
+		gd->ossysi = -1;
+		break;
+	}
+
+	DBG("ossysi %d octi %d ouwcti %d tech %d",
+		gd->ossysi, gd->octi, gd->ouwcti, tech);
+
+	return tech;
+}
+
 static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct cb_data *cbd = user_data;
@@ -142,6 +218,67 @@ error:
 	CALLBACK_WITH_FAILURE(cb, -1, data);
 }
 
+static void option_ossysi_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_data *gd = ofono_gprs_get_data(gprs);
+	GAtResultIter iter;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "_OSSYSI:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &gd->ossysi))
+		return;
+
+	ofono_gprs_technology_notify(gprs, option_get_tech(gd));
+}
+
+static void option_octi_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_data *gd = ofono_gprs_get_data(gprs);
+	GAtResultIter iter;
+	int mode;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "_OCTI:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &gd->octi))
+		return;
+
+	/* Handle query responses too */
+	if (!g_at_result_iter_next_number(&iter, &mode) == FALSE)
+		gd->octi = mode;
+
+	ofono_gprs_technology_notify(gprs, option_get_tech(gd));
+}
+
+static void option_ouwcti_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_data *gd = ofono_gprs_get_data(gprs);
+	GAtResultIter iter;
+	int mode;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "_OUWCTI:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &gd->ouwcti))
+		return;
+
+	/* Handle query responses too */
+	if (!g_at_result_iter_next_number(&iter, &mode) == FALSE)
+		gd->ouwcti = mode;
+
+	ofono_gprs_technology_notify(gprs, option_get_tech(gd));
+}
+
 static void cgreg_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_gprs *gprs = user_data;
@@ -153,6 +290,20 @@ static void cgreg_notify(GAtResult *result, gpointer user_data)
 		return;
 
 	ofono_gprs_status_notify(gprs, status);
+
+	switch (gd->vendor) {
+	case OFONO_VENDOR_OPTION_HSO:
+		/*
+		 * After attaching Option modems will send an unsolicited
+		 * CGREG. Unfortunalty, the technology messages
+		 * appear before we are attached. So we need to update the core
+		 * about the current technology after we tell the core we are
+		 * attached. Otherwise, the CurrentTechnology property wont be
+		 * updated until a technology change happends.
+		 */
+		ofono_gprs_technology_notify(gprs, option_get_tech(gd));
+		break;
+	}
 }
 
 static void cgev_notify(GAtResult *result, gpointer user_data)
@@ -181,6 +332,25 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
 	struct ofono_gprs *gprs = user_data;
 	struct gprs_data *gd = ofono_gprs_get_data(gprs);
 
+	switch (gd->vendor) {
+	case OFONO_VENDOR_OPTION_HSO:
+		g_at_chat_register(gd->chat, "_OSSYSI:", option_ossysi_notify,
+					FALSE, gprs, NULL);
+		g_at_chat_register(gd->chat, "_OCTI:", option_octi_notify,
+					FALSE, gprs, NULL);
+		g_at_chat_register(gd->chat, "_OUWCTI:", option_ouwcti_notify,
+					FALSE, gprs, NULL);
+		g_at_chat_send(gd->chat, "AT_OCTI=1", none_prefix,
+				NULL, NULL, NULL);
+		g_at_chat_send(gd->chat, "AT_OUWCTI=1", none_prefix,
+				NULL, NULL, NULL);
+		g_at_chat_send(gd->chat, "AT_OCTI?", none_prefix,
+				NULL, NULL, NULL);
+		g_at_chat_send(gd->chat, "AT_OUWCTI?", none_prefix,
+				NULL, NULL, NULL);
+		break;
+	}
+
 	g_at_chat_register(gd->chat, "+CGEV:", cgev_notify, FALSE, gprs, NULL);
 	g_at_chat_register(gd->chat, "+CGREG:", cgreg_notify,
 				FALSE, gprs, NULL);
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Monitor current technology
  2010-06-24 13:55 Monitor current technology Daniel Wagner
                   ` (2 preceding siblings ...)
  2010-06-24 13:55 ` [PATCH v2 3/3] Monitor current technology used for Option modems Daniel Wagner
@ 2010-06-25 15:47 ` Denis Kenzior
  2010-06-25 23:27   ` Bastian, Waldo
  3 siblings, 1 reply; 7+ messages in thread
From: Denis Kenzior @ 2010-06-25 15:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2582 bytes --]

Hi Daniel,

> This series adds a new property to DCM to export the
> current technology used.
> 

So I've been reviewing your patches and also thinking about solving this 
technology problem nicely.  First a bit of background on the state of hardware 
today:

27.007 (The Standard):
- +CREG - Reports CS netreg parameters, including tech.
- +CGREG - Same as above for PS netreg parameters
- +CPSB - Reports the current packet switched bearer for a given context.  
Presumably this can change quite dynamically during a GPRS session.

MBM:

- *EREG - Reports CS netreg parameters, including status/lac/ci and tech (0 - 
GSM, 2 - UMTS).  Essentially same as CREG with addition of tech reporting.
- +CGREG - Reports PS netreg parameters, including status/lac/ci/tech (per 
27.007)
- *ERINFO - Reports current Cell capability, gprs/egprs/umts/hsdpa, nothing 
new over +CGREG
- *EPSB - Reports current packet switched bearer.  This is only available on 
recent devices.  This one is supposed to tell the actual packet bearer and 
acts similar to 27.007 +CPSB.  The state depends on the link state, and tends 
to oscillate between 0 (no bearer) and some bearer quite often, even when 
context is active.

STE:

- Same as MBM with *ERINFO seemingly missing.

ISI:

I'm not an ISI expert, but here's what I gleamed from a quick look at that 
driver:

- Reports RAT (gsm/gsm compact/umts) and current cell capability (edge / no 
edge, hsupa availability, hsdpa availability)
- No equivalent of +CPSB

Huawei:

- ^MODE and ^SYSINFO can report current mode.  This seems to be the same as 
cell capability on other devices.

HSO:

- One of the weird ones.  There is no tech reporting through CREG/CGREG at all
- The current access technology (gsm / umts) is reported through OSSYSI
- Edge / no edge capability is reported through OCTI
- UMTS/HSDPA/HSUPA are reported through OUWCTI.  Unfortunately OUWCTI is not 
always reported properly and can change within the cell when the context is 
activated / deactivated.  Some firmware does not report / support OUWCTI at 
all.

The consensus among the hw seems to be to report the capability of the 
currently selected cell, with the exception of HSO, which just acts stupidly.

So my current thinking is to drop any Tech reporting in gprs atom for now.  At 
least until we actually find a usecase for EPSB/CPSB style reporting.

HSO OUWCTI reporting is still an issue.  I'd be glad to hear some alternate 
ideas about how to integrate it properly at this point.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Monitor current technology
  2010-06-25 15:47 ` Monitor current technology Denis Kenzior
@ 2010-06-25 23:27   ` Bastian, Waldo
  2010-06-28 16:41     ` Denis Kenzior
  0 siblings, 1 reply; 7+ messages in thread
From: Bastian, Waldo @ 2010-06-25 23:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]


> So my current thinking is to drop any Tech reporting in gprs atom for now.  > At least until we actually find a usecase for EPSB/CPSB style reporting.

What about the CGREG style tech reporting? 

Cheers,
Waldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Monitor current technology
  2010-06-25 23:27   ` Bastian, Waldo
@ 2010-06-28 16:41     ` Denis Kenzior
  0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2010-06-28 16:41 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

Hi Waldo,

> > So my current thinking is to drop any Tech reporting in gprs atom for
> > now.  > At least until we actually find a usecase for EPSB/CPSB style
> > reporting.
> 
> What about the CGREG style tech reporting?

It turns out that either nobody actually does it this way (Huawei, Option, 
Novatel, Telit, Nokia ISI) or they provide alternative commands for obtaining 
this information (MBM).

The Nokia guys were also fundamentally opposed to doing it this way.  See 
threads from Remi late last year.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-28 16:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-24 13:55 Monitor current technology Daniel Wagner
2010-06-24 13:55 ` [PATCH v2 1/3] Add CurrentTechnology property to DCM Daniel Wagner
2010-06-24 13:55 ` [PATCH v2 2/3] Pass down vendor flag into DCM Daniel Wagner
2010-06-24 13:55 ` [PATCH v2 3/3] Monitor current technology used for Option modems Daniel Wagner
2010-06-25 15:47 ` Monitor current technology Denis Kenzior
2010-06-25 23:27   ` Bastian, Waldo
2010-06-28 16:41     ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.