All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cbs: ETWS and cmas support for intel lte modem
@ 2018-06-07 10:26 Antara Borwankar
  2018-06-07 20:14 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Antara Borwankar @ 2018-06-07 10:26 UTC (permalink / raw)
  To: ofono

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

From: Antara <antara.borwankar@intel.com>

handling of intel propriotery AT commands in atdriver for
intel modems.

Signed-off-by: Antara <antara.borwankar@intel.com>
---
 drivers/atmodem/cbs.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/drivers/atmodem/cbs.c b/drivers/atmodem/cbs.c
index 3c491be..ef1e9c4 100644
--- a/drivers/atmodem/cbs.c
+++ b/drivers/atmodem/cbs.c
@@ -48,6 +48,51 @@ struct cbs_data {
 	unsigned int vendor;
 };
 
+static void at_xmm_etw_sec_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_cbs *cbs = user_data;
+	const char *hexpdu;
+	int pdulen;
+	GAtResultIter iter;
+	unsigned char pdu[88];
+	long hexpdulen;
+
+	DBG("");
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+XETWSECWARN:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &pdulen))
+		return;
+
+	if (pdulen != 88) {
+		ofono_error("Got a CBM message with invalid PDU size!");
+		return;
+	}
+
+	hexpdu = g_at_result_pdu(result);
+	if (hexpdu == NULL) {
+		ofono_error("Got a CBM, but no PDU.  Are we in text mode?");
+		return;
+	}
+
+	DBG("Got new Cell Broadcast via CBM: %s, %d", hexpdu, pdulen);
+
+	if (decode_hex_own_buf(hexpdu, -1, &hexpdulen, 0, pdu) == NULL) {
+		ofono_error("Unable to hex-decode the PDU");
+		return;
+	}
+
+	if (hexpdulen != pdulen) {
+		ofono_error("hexpdu length not equal to reported pdu length");
+		return;
+	}
+
+	ofono_cbs_notify(cbs, pdu, pdulen);
+}
+
 static void at_cbm_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_cbs *cbs = user_data;
@@ -124,6 +169,10 @@ static void at_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
 		g_at_chat_send(data->chat, "AT+CSCB=0", none_prefix,
 				NULL, NULL, NULL);
 		break;
+	case OFONO_VENDOR_XMM:
+		g_at_chat_send(data->chat, "AT+XETWNTFYSTART=2", none_prefix,
+				NULL, NULL, NULL);
+		break;
 	default:
 		break;
 	}
@@ -151,6 +200,10 @@ static void at_cbs_clear_topics(struct ofono_cbs *cbs,
 
 	DBG("");
 
+	if(data->vendor == OFONO_VENDOR_XMM)
+                g_at_chat_send(data->chat, "AT+XETWNTFYSTOP=2", none_prefix,
+                                NULL, NULL, NULL);
+
 	if (g_at_chat_send(data->chat, "AT+CSCB=0", none_prefix,
 				at_cscb_set_cb, cbd, g_free) > 0)
 		return;
@@ -175,6 +228,10 @@ static void at_cbs_register(gboolean ok, GAtResult *result, gpointer user)
 	 */
 	g_at_chat_register(data->chat, "+CBM:", at_cbm_notify, TRUE, cbs, NULL);
 
+	if(data->vendor == OFONO_VENDOR_XMM) {
+		g_at_chat_register(data->chat, "+XETWSECWARN:", at_xmm_etw_sec_notify, TRUE, cbs, NULL);
+	}
+
 	ofono_cbs_register(cbs);
 }
 
@@ -223,6 +280,13 @@ static int at_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
 
 	ofono_cbs_set_data(cbs, data);
 
+	if(vendor == OFONO_VENDOR_XMM) {
+		g_at_chat_send(data->chat, "AT+XCMAS=1", cscb_prefix,
+				NULL, NULL, NULL);
+		g_at_chat_send(data->chat, "AT+XETWCFG=1,1,0,0; ", none_prefix,
+				NULL, NULL, NULL);
+	}
+
 	g_at_chat_send(data->chat, "AT+CSCB=?", cscb_prefix,
 			at_cscb_support_cb, cbs, NULL);
 
-- 
1.9.1


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

* Re: [PATCH] cbs: ETWS and cmas support for intel lte modem
  2018-06-07 10:26 [PATCH] cbs: ETWS and cmas support for intel lte modem Antara Borwankar
@ 2018-06-07 20:14 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2018-06-07 20:14 UTC (permalink / raw)
  To: ofono

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

Hi Antara,

On 06/07/2018 05:26 AM, Antara Borwankar wrote:
> From: Antara <antara.borwankar@intel.com>
> 
> handling of intel propriotery AT commands in atdriver for
> intel modems.
> 
> Signed-off-by: Antara <antara.borwankar@intel.com>

Remember, no Signed-off-by for this project.

> ---
>   drivers/atmodem/cbs.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 64 insertions(+)
> 

Applied with a couple of minor cleanups.

Regards,
-Denis


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

end of thread, other threads:[~2018-06-07 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07 10:26 [PATCH] cbs: ETWS and cmas support for intel lte modem Antara Borwankar
2018-06-07 20:14 ` 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.