Skip to contentSkip to conversation

ifx: Adding modem selftest for Infineon modem

PATCH Superseded Robertino Benis 2 participants 2 messages Jan 19, 2011 – Jan 20, 2011

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 ifx: Adding modem selftest for Infineon modem

Hi all,

This patch summarize changes that triggers Infineon modem selftest during ofono boot. Patch addresses issues raised by Marcel from the privious submissions.

Thank you,
-- r.

---
 plugins/ifx.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 111 insertions(+), 19 deletions(-)
plugins/ifx.c +111 -19
index 0d31167..8726da1 100644
@@ -72,6 +72,8 @@
 #define GPRS3_DLC   4
 #define AUX_DLC     5
 
+#define IFX_SETUP_TIMEOUT	10
+
 static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "GPRS1: ",
 					"GPRS2: ", "GPRS3: ", "Aux: " };
 
@@ -89,7 +91,7 @@ struct ifx_data {
 	guint dlc_poll_count;
 	guint dlc_poll_source;
 	guint dlc_init_source;
-	guint mux_init_timeout;
+	guint cmd_setup_timeout;
 	guint frame_size;
 	int mux_ldisc;
 	int saved_ldisc;
@@ -100,6 +102,9 @@ struct ifx_data {
 	int audio_loopback;
 	struct ofono_sim *sim;
 	gboolean have_sim;
+	gboolean rtc_gti_selftest_timeout;
+	gboolean dev_ver_selftest_timeout;
+	gboolean mux_setup_timeout;
 };
 
 static void ifx_debug(const char *str, void *user_data)
@@ -434,10 +439,17 @@ error:
 static void setup_internal_mux(struct ofono_modem *modem)
 {
 	struct ifx_data *data = ofono_modem_get_data(modem);
+	GIOFlags flags;
 	int i;
 
 	DBG("");
 
+	flags = g_io_channel_get_flags(data->device) | G_IO_FLAG_NONBLOCK;
+	g_io_channel_set_flags(data->device, flags, NULL);
+
+	g_io_channel_set_encoding(data->device, NULL, NULL);
+	g_io_channel_set_buffered(data->device, FALSE);
+
 	data->mux = g_at_mux_new_gsm0710_basic(data->device, data->frame_size);
 	if (data->mux == NULL)
 		goto error;
@@ -474,14 +486,17 @@ static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	int fd;
 
 	DBG("");
+	data->mux_setup_timeout = FALSE;
 
-	if (data->mux_init_timeout > 0) {
-		g_source_remove(data->mux_init_timeout);
-		data->mux_init_timeout = 0;
+	if (data->cmd_setup_timeout > 0) {
+		g_source_remove(data->cmd_setup_timeout);
+		data->cmd_setup_timeout = 0;
 	}
 
-	g_at_chat_unref(data->dlcs[AUX_DLC]);
-	data->dlcs[AUX_DLC] = NULL;
+	if (data->dlcs[AUX_DLC]) {
+		g_at_chat_unref(data->dlcs[AUX_DLC]);
+		data->dlcs[AUX_DLC] = NULL;
+	}
 
 	if (!ok)
 		goto error;
@@ -519,26 +534,91 @@ error:
 	ofono_modem_set_powered(modem, FALSE);
 }
 
-static gboolean mux_timeout_cb(gpointer user_data)
+static gboolean cmd_setup_timeout_cb(gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
 	struct ifx_data *data = ofono_modem_get_data(modem);
 
-	ofono_error("Timeout with multiplexer setup");
+	if (data->rtc_gti_selftest_timeout)
+		ofono_error("ERROR:IFX Selftest"
+			"at(a)rtc:rtc_gti_test_verify_32khz()-TIMEOUT");
 
-	data->mux_init_timeout = 0;
+	if (data->dev_ver_selftest_timeout)
+		ofono_error("ERROR:IFX Selftest"
+			"at(a)vers:device_version_id()-TIMEOUT");
 
-	g_at_chat_unref(data->dlcs[AUX_DLC]);
-	data->dlcs[AUX_DLC] = NULL;
+	if (data->mux_setup_timeout)
+		ofono_error("ERROR:IFX Mux setup-TIMEOUT");
 
-	g_io_channel_unref(data->device);
-	data->device = NULL;
+	data->cmd_setup_timeout = 0;
+
+	if (data->dlcs[AUX_DLC]) {
+		g_at_chat_unref(data->dlcs[AUX_DLC]);
+		data->dlcs[AUX_DLC] = NULL;
+	}
+
+	if (data->device) {
+		g_io_channel_unref(data->device);
+		data->device = NULL;
+	}
 
 	ofono_modem_set_powered(modem, FALSE);
 
 	return FALSE;
 }
 
+static void dev_ver_selftest_cb(gboolean ok, GAtResult *result,
+				gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct ifx_data *data = ofono_modem_get_data(modem);
+
+	data->dev_ver_selftest_timeout = FALSE;
+
+	if (!ok) {
+		ofono_error("ERROR:IFX Selftest at(a)vers:device_version_id()"
+			"-FAILED");
+
+		if (data->dlcs[AUX_DLC]) {
+			g_at_chat_unref(data->dlcs[AUX_DLC]);
+			data->dlcs[AUX_DLC] = NULL;
+		}
+
+		if (data->device) {
+			g_io_channel_unref(data->device);
+			data->device = NULL;
+		}
+
+		ofono_modem_set_powered(modem, FALSE);
+	}
+}
+
+static void rtc_gti_selftest_cb(gboolean ok, GAtResult *result,
+				gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct ifx_data *data = ofono_modem_get_data(modem);
+
+	data->rtc_gti_selftest_timeout = FALSE;
+
+	if (!ok) {
+		ofono_error("ERROR:IFX Selftest"
+			"at(a)rtc:rtc_gti_test_verify_32khz()-FAILED");
+
+		if (data->dlcs[AUX_DLC]) {
+			g_at_chat_unref(data->dlcs[AUX_DLC]);
+			data->dlcs[AUX_DLC] = NULL;
+		}
+
+		if (data->device) {
+			g_io_channel_unref(data->device);
+			data->device = NULL;
+		}
+
+		ofono_modem_set_powered(modem, FALSE);
+	}
+}
+
 static int ifx_enable(struct ofono_modem *modem)
 {
 	struct ifx_data *data = ofono_modem_get_data(modem);
@@ -592,15 +672,27 @@ static int ifx_enable(struct ofono_modem *modem)
 	g_at_chat_send(chat, "ATE0 +CMEE=1", NULL,
 					NULL, NULL, NULL);
 
-	data->frame_size = 1509;
+	/* Execute Modem Self tests */
+	data->dlcs[AUX_DLC] = chat;
 
-	g_at_chat_send(chat, "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
-					mux_setup_cb, modem, NULL);
+	g_at_chat_send(data->dlcs[AUX_DLC],
+		"at(a)rtc:rtc_gti_test_verify_32khz()",
+		NULL, rtc_gti_selftest_cb, modem, NULL);
+	data->rtc_gti_selftest_timeout = TRUE;
 
-	data->mux_init_timeout = g_timeout_add_seconds(5, mux_timeout_cb,
-								modem);
+	g_at_chat_send(data->dlcs[AUX_DLC], "at(a)vers:device_version_id()",
+		NULL, dev_ver_selftest_cb, modem, NULL);
+	data->dev_ver_selftest_timeout = TRUE;
 
-	data->dlcs[AUX_DLC] = chat;
+	/* Enable  MUX Channels */
+	data->frame_size = 1509;
+	g_at_chat_send(data->dlcs[AUX_DLC],
+			"AT+CMUX=0,0,,1509,10,3,30,,", NULL,
+			mux_setup_cb, modem, NULL);
+	data->mux_setup_timeout = TRUE;
+
+	data->cmd_setup_timeout = g_timeout_add_seconds(
+		IFX_SETUP_TIMEOUT, cmd_setup_timeout_cb, modem);
 
 	return -EINPROGRESS;
 }
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Robertino,

Quoted 6 lines

This patch summarize changes that triggers Infineon modem selftest during ofono boot. Patch addresses issues raised by Marcel from the privious submissions.

Thank you,
-- r.

so git works the way that it takes the subject of the email and the body as commit messages. So you can not write private messages in the body of an email addressed the people who review patches.

Check for yourself what happens if you store this email and use "git am" and then "git log".

I would prefer that you use the email body to describe your patch in detail and what happens here. If you wanna see examples then just use "git log plugins/ifx.c" to see what we have done in the past.

Especially since you are adding two modem selftest commands without any other explanation, it would be nice if you summarize the discussion from the mailing list in one paragraph here.

Quoted 1 line

---

Private comments have to be between "---" and the diffstat. Then git will ignore them.

<snip>

Quoted 4 lines

static void setup_internal_mux(struct ofono_modem *modem) {

plugins/ifx.c +1 -0
 	struct ifx_data *data = ofono_modem_get_data(modem);
+	GIOFlags flags;

plugins/ifx.c error: · line 452

Quoted 10 lines
plugins/ifx.c +6 -0
 	int i;
 
 	DBG("");
 
+	flags = g_io_channel_get_flags(data->device) | G_IO_FLAG_NONBLOCK;
+	g_io_channel_set_flags(data->device, flags, NULL);
+
+	g_io_channel_set_encoding(data->device, NULL, NULL);
+	g_io_channel_set_buffered(data->device, FALSE);
+

Please do me a favor and review the patch result for you submit it at least once. This is important. If you just blindly rebase the patch, then something like this happens. You sneak in fragments that are not related to your patch, but come in via a different path.

If I would apply your patch then we are back to the bug fixing from yesterday. I didn't bother with review of the rest of the patch.

Regards

Marcel