layer23: IMSI detach works now.
authorAndreas.Eversberg <jolly@eversberg.eu>
Sun, 13 Jun 2010 18:41:07 +0000 (18:41 +0000)
committerAndreas.Eversberg <jolly@eversberg.eu>
Sun, 13 Jun 2010 18:41:07 +0000 (18:41 +0000)
Pressing CTRL+c causes the detach process to run, then the mobile exits.
This procedure only runs after attachment (location update) and if detach
is required.

The SABM with the detach message is confirmed by a DISC message. the BS11
says that this is caused by sequence error or N200+1 error. Maybe someone
can trace that.

src/host/layer23/src/app_mobile.c
src/host/layer23/src/gsm48_mm.c

index bb97bbf..e93b1fb 100644 (file)
@@ -132,6 +132,8 @@ int mobile_exit(struct osmocom_ms *ms)
        gsm_subscr_exit(ms);
        gsm48_cc_exit(ms);
 
+       printf("Power off!\n");
+
        return 0;
 }
 
index a428928..276d599 100644 (file)
@@ -1738,13 +1738,6 @@ static int gsm48_mm_imsi_detach_end(struct osmocom_ms *ms, struct msgb *msg)
 
        LOGP(DMM, LOGL_INFO, "IMSI has been detached.\n");
 
-       /* power off when IMSI is detached */
-       if (mm->power_off) {
-               l23_app_exit(ms);
-               printf("Power off!\n");
-               exit (0);
-       }
-
        /* stop IMSI detach timer (if running) */
        stop_mm_t3220(mm);
 
@@ -1757,6 +1750,12 @@ static int gsm48_mm_imsi_detach_end(struct osmocom_ms *ms, struct msgb *msg)
        /* SIM invalid */
        subscr->sim_valid = 0;
 
+       /* power off when IMSI is detached */
+       if (mm->power_off) {
+               l23_app_exit(ms);
+               exit (0);
+       }
+
        /* send SIM remove event to gsm322 */
        nmsg = gsm322_msgb_alloc(GSM322_EVENT_SIM_REMOVE);
        if (!nmsg)
@@ -1821,6 +1820,12 @@ static int gsm48_mm_imsi_detach_release(struct osmocom_ms *ms, struct msgb *msg)
                LOGP(DMM, LOGL_INFO, "IMSI detach not required.\n");
                new_mm_state(mm, GSM48_MM_ST_WAIT_NETWORK_CMD, 0);
 
+               /* power off when IMSI is detached */
+               if (mm->power_off) {
+                       l23_app_exit(ms);
+                       exit (0);
+               }
+
                return 0;
        }