Skip to contentSkip to conversation

Don't remove atoms when state goes from INSERTED to NOT PRESENT.

PATCH In review Andrzej Zaborowski 2 participants 2 messages May 7, 2010 – May 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/6 Don't remove atoms when state goes from INSERTED to NOT PRESENT.

---
 src/modem.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
src/modem.c +6 -3
index 8319702..0d0cb2a 100644
@@ -1132,13 +1132,16 @@ static void modem_sim_ready(void *user, enum ofono_sim_state new_state)
 
 	switch (new_state) {
 	case OFONO_SIM_STATE_NOT_PRESENT:
-		remove_all_atoms(&modem->atoms);
+		if (modem->pre_sim_atoms != NULL)
+			remove_all_atoms(&modem->atoms);
 		break;
 	case OFONO_SIM_STATE_INSERTED:
 		break;
 	case OFONO_SIM_STATE_READY:
-		modem->pre_sim_atoms = modem->atoms;
-		modem->atoms = NULL;
+		if (modem->pre_sim_atoms == NULL) {
+			modem->pre_sim_atoms = modem->atoms;
+			modem->atoms = NULL;
+		}
 
 		if (modem->driver->post_sim)
 			modem->driver->post_sim(modem);
Signature · 1 line
1.6.1
#1 lore raw

Hi Andrew,

src/modem.c

Quoted 6 lines
---
 src/modem.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
src/modem.c +0 -0
index 8319702..0d0cb2a 100644

Patch has been applied with a modified description. However, I'm thinking we should manipulate the lists directly based on SIM presence / pin state inside ofono_modem_add_atom. The logic is a little too complicated now.

Regards,
-Denis