Skip to contentSkip to conversation

qmimodem: enable message waiting atom

PATCH Superseded Joey Hewitt 2 participants 6 messages Sep 9, 2017 – Sep 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qmimodem: enable message waiting atom

Conditional on one of UIM (SIM), DMS (legacy SIM), or WMS (SMS).
---

Tested on my Android phone. It correctly reported VoicemailMailboxNumber, and VoicemailWaiting property when a voicemail was sent. I got an error "Queuing a EF-MWI write to SIM failed", though -- I'm not sure if that's a bug somewhere in the stack, or if that's just how my SIM is.

 plugins/gobi.c | 7 +++++++
 1 file changed, 7 insertions(+)
plugins/gobi.c +7 -0
index a498599..0bc134f 100644
@@ -490,6 +490,7 @@ static void gobi_post_online(struct ofono_modem *modem)
 	struct gobi_data *data = ofono_modem_get_data(modem);
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
+	struct ofono_message_waiting *mw;
 
 	DBG("%p", modem);
 
@@ -499,6 +500,12 @@ static void gobi_post_online(struct ofono_modem *modem)
 	if (data->features & GOBI_VOICE)
 		ofono_ussd_create(modem, 0, "qmimodem", data->device);
 
+	if (data->features & (GOBI_UIM | GOBI_DMS | GOBI_WMS)) {
+		mw = ofono_message_waiting_create(modem);
+		if (mw)
+			ofono_message_waiting_register(mw);
+	}
+
 	if (data->features & GOBI_WDS) {
 		gprs = ofono_gprs_create(modem, 0, "qmimodem", data->device);
 		gc = ofono_gprs_context_create(modem, 0, "qmimodem",
Signature · 1 line
2.7.4
#1 lore raw

Hi Joey,

Quoted 8 lines · Joey Hewitt

Conditional on one of UIM (SIM), DMS (legacy SIM), or WMS (SMS).
---

Tested on my Android phone. It correctly reported VoicemailMailboxNumber, and VoicemailWaiting property when a voicemail was sent. I got an error "Queuing a EF-MWI write to SIM failed", though -- I'm not sure if that's a bug somewhere in the stack, or if that's just how my SIM is.

Neither QMI SIM driver supports SIM writes (e.g. write_file_transparent, write_file_linear, write_file_cyclic). Without those, the message-waiting atom is only half functional...

plugins/gobi.c static void gobi_post_online(struct ofono_modem *modem) · line 493

Quoted 13 lines
  plugins/gobi.c | 7 +++++++
  1 file changed, 7 insertions(+)
plugins/gobi.c +1 -0
index a498599..0bc134f 100644
@@ -490,6 +490,7 @@ static void gobi_post_online(struct ofono_modem *modem)
  	struct gobi_data *data = ofono_modem_get_data(modem);
  	struct ofono_gprs *gprs;
  	struct ofono_gprs_context *gc;
+	struct ofono_message_waiting *mw;

Variable declaration can be moved into the if statement.

plugins/gobi.c static void gobi_post_online(struct ofono_modem *modem) · line 503

Quoted 8 lines
plugins/gobi.c +1 -0
  	DBG("%p", modem);
 
@@ -499,6 +500,12 @@ static void gobi_post_online(struct ofono_modem *modem)
  	if (data->features & GOBI_VOICE)
  		ofono_ussd_create(modem, 0, "qmimodem", data->device);
 
+	if (data->features & (GOBI_UIM | GOBI_DMS | GOBI_WMS)) {

And strictly speaking the check should be for (data->features & (GOBI_UIM | GOBI_DMS)) && (data->features & GOBI_WMS))

However, since we got to post_sim/post_online somehow (e.g. presence of one of these services is implied), I'd just simply use

if (data->features & GOBI_WMS)

plugins/gobi.c static void gobi_post_online(struct ofono_modem *modem) · line 508

Quoted 5 lines
plugins/gobi.c +5 -0
+		mw = ofono_message_waiting_create(modem);
+		if (mw)
+			ofono_message_waiting_register(mw);
+	}
+

This should really go into post_sim

plugins/gobi.c static void gobi_post_online(struct ofono_modem *modem) · line 511

Quoted 4 lines
plugins/gobi.c +0 -0
  	if (data->features & GOBI_WDS) {
  		gprs = ofono_gprs_create(modem, 0, "qmimodem", data->device);
  		gc = ofono_gprs_context_create(modem, 0, "qmimodem",

Regards,
-Denis

#2 lore raw

PATCH v2 1/1 gobi: enable message waiting atom

---

Quoted 6 lines · Denis Kenzior

Hi Joey,

Neither QMI SIM driver supports SIM writes (e.g. write_file_transparent, write_file_linear, write_file_cyclic). Without those, the message-waiting atom is only half functional...

Ah, I thought I had checked the SIM support was there, but I missed that! I'm sending another patch to add that for qmimodem.

Quoted 7 lines

And strictly speaking the check should be for (data->features & (GOBI_UIM | GOBI_DMS)) && (data->features & GOBI_WMS))

However, since we got to post_sim/post_online somehow (e.g. presence of one of these services is implied), I'd just simply use

if (data->features & GOBI_WMS)

My logic was that any of the 3 features alone could provide some level of message-waiting functionality, but I suppose both SIM and SMS are needed to really be useful.

Now that I understand more that the legacy SIM will probably never be able to write SIM files, should the message waiting atom be "half-functional" if it's legacy, or not enabled at all?

 plugins/gobi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
plugins/gobi.c +5 -1
index a498599..3205307 100644
@@ -481,8 +481,12 @@ static void gobi_post_sim(struct ofono_modem *modem)
 	if (data->features & GOBI_NAS)
 		ofono_radio_settings_create(modem, 0, "qmimodem", data->device);
 
-	if (data->features & GOBI_WMS)
+	if (data->features & GOBI_WMS) {
 		ofono_sms_create(modem, 0, "qmimodem", data->device);
+		struct ofono_message_waiting *mw = ofono_message_waiting_create(modem);
+		if (mw)
+			ofono_message_waiting_register(mw);
+	}
 }
 
 static void gobi_post_online(struct ofono_modem *modem)
Signature · 1 line
2.7.4
#4 lore raw

PATCH v3 1/1 gobi: enable message waiting atom

In reply to Denis Kenzior

---

Quoted 5 lines · Denis Kenzior

Does DMS provide support to twiddle the EFmwis/EFmwi/EFmbdn by some other means? From what I remember it doesn't, but may be I'm not remembering correctly.

If not, then we shouldn't enable message-waiting in that case.

I'm not an expert, but from looking Gobi API, maybe the PBM service can update MBDN (eQMIPBMPhonebookTypes_MailBoxDialingNumber) and WMS could update MWI (WMSSetWaitingMessage). I don't see docs or examples of how they work though, and I haven't tried. I also don't know if it makes sense for oFono's target devices that don't have/use the UIM service.

Since the legacy SIM atom doesn't have that now, I've made the feature check for the UIM service, as well as not "ForceSimLegacy" flag.

 plugins/gobi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
plugins/gobi.c +10 -0
index a498599..59416f2 100644
@@ -45,6 +45,7 @@
 #include <ofono/radio-settings.h>
 #include <ofono/location-reporting.h>
 #include <ofono/log.h>
+#include <ofono/message-waiting.h>
 
 #include <drivers/qmimodem/qmi.h>
 #include <drivers/qmimodem/dms.h>
@@ -483,6 +484,15 @@ static void gobi_post_sim(struct ofono_modem *modem)
 
 	if (data->features & GOBI_WMS)
 		ofono_sms_create(modem, 0, "qmimodem", data->device);
+
+	if ((data->features & GOBI_WMS) && (data->features & GOBI_UIM) &&
+			!ofono_modem_get_boolean(modem, "ForceSimLegacy")) {
+		struct ofono_message_waiting *mw =
+					ofono_message_waiting_create(modem);
+
+		if (mw)
+			ofono_message_waiting_register(mw);
+	}
 }
 
 static void gobi_post_online(struct ofono_modem *modem)
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v2] gobi: enable message waiting atom

In reply to Joey Hewitt

Hi Joey,

Quoted 4 lines

Now that I understand more that the legacy SIM will probably never be able to write SIM files, should the message waiting atom be "half-functional" if it's legacy, or not enabled at all?

Does DMS provide support to twiddle the EFmwis/EFmwi/EFmbdn by some other means? From what I remember it doesn't, but may be I'm not remembering correctly.

If not, then we shouldn't enable message-waiting in that case.

plugins/gobi.c static void gobi_post_sim(struct ofono_modem *modem) · line 484

Quoted 13 lines
  plugins/gobi.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
plugins/gobi.c +1 -1
index a498599..3205307 100644
@@ -481,8 +481,12 @@ static void gobi_post_sim(struct ofono_modem *modem)
  	if (data->features & GOBI_NAS)
  		ofono_radio_settings_create(modem, 0, "qmimodem", data->device);
 
-	if (data->features & GOBI_WMS)
+	if (data->features & GOBI_WMS) {

And maybe this needs a separate block based on the discussion above. E.g.

if ((data->features & GOBI_WMS) && (data->features & GOBI_UIM))

plugins/gobi.c static void gobi_post_sim(struct ofono_modem *modem) · line 486

Quoted 2 lines
plugins/gobi.c +1 -0
  		ofono_sms_create(modem, 0, "qmimodem", data->device);
+		struct ofono_message_waiting *mw = ofono_message_waiting_create(modem);

We use a strict set of flags, so this make gcc complain about mixed declarations and code. So this should be

struct ofono_message_waiting *...

ofono_sms_create

if (mw)

	ofono_message_waiting_register(mw);

plugins/gobi.c static void gobi_post_sim(struct ofono_modem *modem) · line 492

Quoted 7 lines
plugins/gobi.c +3 -0
+		if (mw)
+			ofono_message_waiting_register(mw);
+	}
  }
 
  static void gobi_post_online(struct ofono_modem *modem)

Regards,
-Denis

#5 lore raw

Re: [PATCH v3] gobi: enable message waiting atom

In reply to Joey Hewitt

Hi Joey,

Quoted 7 lines · Joey Hewitt

---

Quoted 4 lines · Denis Kenzior

Does DMS provide support to twiddle the EFmwis/EFmwi/EFmbdn by some other means? From what I remember it doesn't, but may be I'm not remembering correctly.

Quoted 7 lines
Quoted 1 line

If not, then we shouldn't enable message-waiting in that case.

I'm not an expert, but from looking Gobi API, maybe the PBM service can update MBDN (eQMIPBMPhonebookTypes_MailBoxDialingNumber) and WMS could update MWI (WMSSetWaitingMessage). I don't see docs or examples of how they work though, and I haven't tried. I also don't know if it makes sense for oFono's target devices that don't have/use the UIM service.

In theory we could intercept the writes to those files in sim-legacy and based on the file-id invoke the right PBM/WMS command. But that seems like too much trouble.

Quoted 3 lines

Since the legacy SIM atom doesn't have that now, I've made the feature check for the UIM service, as well as not "ForceSimLegacy" flag.

Yes, good catch!

Patch has now been applied, thanks.

Regards,
-Denis