All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 27/27] simutil: Add MMC MNC pair encoding utility.
@ 2010-05-16 14:08 Andrzej Zaborowski
  2010-05-25 21:52 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Zaborowski @ 2010-05-16 14:08 UTC (permalink / raw)
  To: ofono

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

---
 src/simutil.c |   17 +++++++++++++++++
 src/simutil.h |    1 +
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/simutil.c b/src/simutil.c
index a0e824a..78270ba 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -884,6 +884,23 @@ void sim_parse_mcc_mnc(const guint8 *bcd, char *mcc, char *mnc)
 	*mnc++ = digit_lut[digit];
 }
 
+void sim_encode_mcc_mnc(guint8 *out, const char *mcc, const char *mnc)
+{
+	char str[7] = "ffffff";
+
+	str[0] = mcc[0];
+	str[1] = mcc[1];
+	if (mcc[2])
+		str[2] = mcc[2];
+
+	str[4] = mnc[0];
+	str[5] = mnc[1];
+	if (mnc[2])
+		str[3] = mnc[2];
+
+	encode_bcd_number(str, out);
+}
+
 static gint spdi_operator_compare(gconstpointer a, gconstpointer b)
 {
 	const struct spdi_operator *opa = a;
diff --git a/src/simutil.h b/src/simutil.h
index 53e7743..2b3b604 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -232,6 +232,7 @@ const struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
 void sim_eons_free(struct sim_eons *eons);
 
 void sim_parse_mcc_mnc(const guint8 *bcd, char *mcc, char *mnc);
+void sim_encode_mcc_mnc(guint8 *out, const char *mcc, const char *mnc);
 struct sim_spdi *sim_spdi_new(const guint8 *tlv, int length);
 gboolean sim_spdi_lookup(struct sim_spdi *spdi,
 				const char *mcc, const char *mnc);
-- 
1.7.1.86.g0e460.dirty


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

* Re: [PATCH 27/27] simutil: Add MMC MNC pair encoding utility.
  2010-05-16 14:08 [PATCH 27/27] simutil: Add MMC MNC pair encoding utility Andrzej Zaborowski
@ 2010-05-25 21:52 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2010-05-25 21:52 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

> ---
>  src/simutil.c |   17 +++++++++++++++++
>  src/simutil.h |    1 +
>  2 files changed, 18 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2010-05-25 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-16 14:08 [PATCH 27/27] simutil: Add MMC MNC pair encoding utility Andrzej Zaborowski
2010-05-25 21:52 ` 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.