All of lore.kernel.org
 help / color / mirror / Atom feed
From: JongSeok Won <wjs890204@gmail.com>
To: ofono@ofono.org
Subject: [PATCHv2 2/3] rilmodem: support cell type LTE for netmon
Date: Fri, 31 Jul 2020 11:20:52 +0900	[thread overview]
Message-ID: <20200731022052.18948-1-wjs890204@gmail.com> (raw)

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

---
 drivers/rilmodem/netmon.c | 51 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/drivers/rilmodem/netmon.c b/drivers/rilmodem/netmon.c
index 547ebccc..9f3a1191 100644
--- a/drivers/rilmodem/netmon.c
+++ b/drivers/rilmodem/netmon.c
@@ -109,6 +109,9 @@ static int process_cellinfo_list(struct ril_msg *message,
 	int mcc, mnc;
 	int lac, cid, psc;
 	int rssi, ber;
+	int ci, pci, tac;
+	int rsrp, rsrq, rssnr;
+	int cqi, tadv;
 	char s_mcc[OFONO_MAX_MCC_LENGTH + 1];
 	char s_mnc[OFONO_MAX_MNC_LENGTH + 1];
 	int i, j;
@@ -216,6 +219,54 @@ static int process_cellinfo_list(struct ril_msg *message,
 				OFONO_NETMON_INFO_BER, ber,
 				OFONO_NETMON_INFO_INVALID);
 
+	} else if (cell_type == NETMON_RIL_CELLINFO_TYPE_LTE) {
+		mcc = parcel_r_int32(&rilp);
+		mnc = parcel_r_int32(&rilp);
+		ci =  parcel_r_int32(&rilp);
+		pci = parcel_r_int32(&rilp);
+		tac = parcel_r_int32(&rilp);
+		rssi = parcel_r_int32(&rilp);
+		rsrp = parcel_r_int32(&rilp);
+		rsrq = parcel_r_int32(&rilp);
+		rssnr = parcel_r_int32(&rilp);
+		cqi = parcel_r_int32(&rilp);
+		tadv = parcel_r_int32(&rilp);
+
+		if (mcc >= 0 && mcc <= 999)
+		snprintf(s_mcc, sizeof(s_mcc), "%03d", mcc);
+		else
+		strcpy(s_mcc, "");
+
+		if (mnc >= 0 && mnc <= 999)
+		snprintf(s_mnc, sizeof(s_mnc), "%03d", mnc);
+		else
+		strcpy(s_mnc, "");
+
+		ci = (ci >= 0 && ci <= 268435455) ? ci : -1;
+		pci = (pci >= 0 && pci <= 503) ? pci : -1;
+		tac = (tac >= 0 && tac <= 65535) ? tac : -1;
+		rssi = (rssi >= 0 && rssi <= 31) ? rssi : -1;
+		rsrp = (rsrp >= 44 && rsrp <= 140) ? -rsrp : -1;
+		rsrq = (rsrq >= 3 && rsrq <= 20) ? -rsrq : -1;
+		rssnr = (rssnr >= -200 && rssnr <= 300) ? rssnr : -1;
+		cqi = (cqi >= 0 && cqi <= 15) ? cqi : -1;
+		tadv = (tadv >=0 && tadv <= 63) ? tadv : -1;
+
+		ofono_netmon_serving_cell_notify(netmon,
+				OFONO_NETMON_CELL_TYPE_LTE,
+				OFONO_NETMON_INFO_MCC, s_mcc,
+				OFONO_NETMON_INFO_MNC, s_mnc,
+				OFONO_NETMON_INFO_CI, ci,
+				OFONO_NETMON_INFO_PCI, pci,
+				OFONO_NETMON_INFO_TAC, tac,
+				OFONO_NETMON_INFO_RSSI, rssi,
+				OFONO_NETMON_INFO_RSRP, rsrp,
+				OFONO_NETMON_INFO_RSRQ, rsrq,
+				OFONO_NETMON_INFO_SNR, rssnr,
+				OFONO_NETMON_INFO_CQI, cqi,
+				OFONO_NETMON_INFO_TIMING_ADVANCE, tadv,
+				OFONO_NETMON_INFO_INVALID);
+
 	}
 
 	return OFONO_ERROR_TYPE_NO_ERROR;
-- 
2.17.1

                 reply	other threads:[~2020-07-31  2:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200731022052.18948-1-wjs890204@gmail.com \
    --to=wjs890204@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.