Skip to contentSkip to conversation

sim: added error handling in set slot callback

PATCH In review Antara Borwankar 2 participants 2 messages Apr 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 sim: added error handling in set slot callback

Adding the handling of error when the driver returns CME ERROR:4.

This error will be returned for non xmm vendor modems using ifxmodem driver for sim.

---
 src/sim.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
src/sim.c +7 -2
index 9f0183f..1943989 100644
@@ -680,8 +680,13 @@ static void sim_set_slot_callback(const struct ofono_error *error, void *data)
 
 		sim->pending_active_card_slot = sim->active_card_slot;
 
-		reply = __ofono_error_failed(sim->pending);
-		__ofono_dbus_pending_reply(&sim->pending, reply);
+		if (error->type == OFONO_ERROR_TYPE_CME && error->error == 4) {
+			reply = __ofono_error_not_implemented(sim->pending);
+			__ofono_dbus_pending_reply(&sim->pending, reply);
+		} else {
+			reply = __ofono_error_failed(sim->pending);
+			__ofono_dbus_pending_reply(&sim->pending, reply);
+		}
 
 		return;
 	}
Signature · 1 line
1.9.1
#1 lore raw

Hi Antara,

Quoted 16 lines · Antara Borwankar

Adding the handling of error when the driver returns CME ERROR:4.

This error will be returned for non xmm vendor modems using ifxmodem driver for sim.

---
  src/sim.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
src/sim.c +0 -0
index 9f0183f..1943989 100644
@@ -680,8 +680,13 @@ static void sim_set_slot_callback(const struct ofono_error *error, void *data)
 
  		sim->pending_active_card_slot = sim->active_card_slot;

src/sim.c static void sim_set_slot_callback(const struct ofono_error *error, void *data) · line 689

Quoted 10 lines
src/sim.c +7 -2
 
-		reply = __ofono_error_failed(sim->pending);
-		__ofono_dbus_pending_reply(&sim->pending, reply);
+		if (error->type == OFONO_ERROR_TYPE_CME && error->error == 4) {
+			reply = __ofono_error_not_implemented(sim->pending);
+			__ofono_dbus_pending_reply(&sim->pending, reply);
+		} else {
+			reply = __ofono_error_failed(sim->pending);
+			__ofono_dbus_pending_reply(&sim->pending, reply);
+		}

Lets use __ofono_error_from_error here instead.

src/sim.c static void sim_set_slot_callback(const struct ofono_error *error, void *data) · line 692

Quoted 4 lines
src/sim.c +0 -0
  		return;
  	}
 

Regards,
-Denis