summaryrefslogtreecommitdiffstats
path: root/src/host
diff options
context:
space:
mode:
authorAndreas.Eversberg2010-05-05 10:40:10 +0200
committerAndreas.Eversberg2010-05-05 10:40:10 +0200
commit7c5b9ea2880ca7e347dd31abedd4418e57493d50 (patch)
tree715bb0339c29067e168f5edc8600ea0879f53ce5 /src/host
parentWork on layer 3 processes: (diff)
downloadosmocom-7c5b9ea2880ca7e347dd31abedd4418e57493d50.tar.gz
osmocom-7c5b9ea2880ca7e347dd31abedd4418e57493d50.tar.xz
osmocom-7c5b9ea2880ca7e347dd31abedd4418e57493d50.zip
Work on layer 3 processes:
- Fixes on PLMN search and cell selection process. - Fixes on radio ressource. - ^C will cause IMSI detach when pressed the first time. Pressing ^C again will cause termination of process at any time.
Diffstat (limited to 'src/host')
-rw-r--r--src/host/gsm48-andreas/issues.txt6
-rw-r--r--src/host/layer23/include/osmocom/gsm48_mm.h1
-rw-r--r--src/host/layer23/include/osmocom/gsm48_rr.h11
-rw-r--r--src/host/layer23/src/app_mobile.c31
-rwxr-xr-xsrc/host/layer23/src/gsm322.c71
-rw-r--r--src/host/layer23/src/gsm48_mm.c26
-rw-r--r--src/host/layer23/src/gsm48_rr.c30
-rw-r--r--src/host/layer23/src/main.c12
8 files changed, 138 insertions, 50 deletions
diff --git a/src/host/gsm48-andreas/issues.txt b/src/host/gsm48-andreas/issues.txt
index 6c926cc..01ef1c7 100644
--- a/src/host/gsm48-andreas/issues.txt
+++ b/src/host/gsm48-andreas/issues.txt
@@ -82,6 +82,12 @@ It is absolutely importaint for messages not beeing lost between layers.
What about the serial link between mobile and PC?
-> There must be a security layer!
+One solution: Store all radio action (DM / CCCH / power scan) and start timer.
+Send request again, if timer expires.
+-> Also send it again, if L1 resets (restart of phone).
+We MUST at least have CRCxx on serial interface.
+
+
diff --git a/src/host/layer23/include/osmocom/gsm48_mm.h b/src/host/layer23/include/osmocom/gsm48_mm.h
index 8e796dc..5c2d029 100644
--- a/src/host/layer23/include/osmocom/gsm48_mm.h
+++ b/src/host/layer23/include/osmocom/gsm48_mm.h
@@ -188,6 +188,7 @@ struct gsm48_mmlayer {
/* other */
int mr_substate; /* rem most recent substate */
+ uint8_t power_off; /* set, if power off after detach */
};
/* MM connection entry */
diff --git a/src/host/layer23/include/osmocom/gsm48_rr.h b/src/host/layer23/include/osmocom/gsm48_rr.h
index fbf9e0d..ba0bb25 100644
--- a/src/host/layer23/include/osmocom/gsm48_rr.h
+++ b/src/host/layer23/include/osmocom/gsm48_rr.h
@@ -56,7 +56,7 @@ struct gsm48_rr_hdr {
struct gsm48_rr_cd {
uint8_t tsc;
uint8_t h; /* using hopping */
- uint16_t arfcn;
+ uint16_t arfcn; /* dedicated mode */
uint8_t maio;
uint8_t hsn;
uint8_t chan_nr; /* type, slot, sub slot */
@@ -103,7 +103,7 @@ struct gsm48_rrlayer {
#endif
/* states if RR-EST-REQ was used */
- int rr_est_req;
+ uint8_t rr_est_req;
struct msgb *rr_est_msg;
/* channel request states */
@@ -115,7 +115,6 @@ struct gsm48_rrlayer {
/* cr_hist must be signed and greater 8 bit, -1 = no value */
/* current channel descriptions */
- uint16_t dm_arfcn; /* dedicated mode only */
struct gsm48_rr_cd cd_now;
/* current cipering */
@@ -123,9 +122,9 @@ struct gsm48_rrlayer {
uint8_t cipher_type; /* 10.5.2.9 */
/* special states when changing channel */
- int hando_susp_state;
- int assign_susp_state;
- int resume_last_state;
+ uint8_t hando_susp_state;
+ uint8_t assign_susp_state;
+ uint8_t resume_last_state;
struct gsm48_rr_cd cd_last;
/* measurements */
diff --git a/src/host/layer23/src/app_mobile.c b/src/host/layer23/src/app_mobile.c
index c5e8242..9beca06 100644
--- a/src/host/layer23/src/app_mobile.c
+++ b/src/host/layer23/src/app_mobile.c
@@ -23,6 +23,7 @@
*/
#include <errno.h>
+#include <signal.h>
#include <osmocom/osmocom_data.h>
#include <osmocom/l1ctl.h>
@@ -40,6 +41,8 @@
extern struct log_target *stderr_target;
+static int started = 0;
+
int mncc_recv_dummy(struct osmocom_ms *ms, int msg_type, void *arg);
int mobile_work(struct osmocom_ms *ms)
@@ -73,8 +76,14 @@ static int signal_cb(unsigned int subsys, unsigned int signal,
switch (signal) {
case S_L1CTL_RESET:
+ if (started) {
+ printf("L1_RESET, TODO: resend last radio request "
+ "(CCCH / dedicated / power scan)\n");
+ break;
+ }
+ started = 1;
ms = signal_data;
-// gsm_subscr_testcard(ms, 1, 1, "0000000000");
+ gsm_subscr_testcard(ms, 1, 1, "0000000000");
/* start PLMN + cell selection process */
nmsg = gsm322_msgb_alloc(GSM322_EVENT_SWITCH_ON);
if (!nmsg)
@@ -90,6 +99,26 @@ static int signal_cb(unsigned int subsys, unsigned int signal,
int mobile_exit(struct osmocom_ms *ms)
{
+ struct gsm48_mmlayer *mm = &ms->mmlayer;
+
+ if (!mm->power_off && started) {
+ struct msgb *nmsg;
+
+ mm->power_off = 1;
+ nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_IMSI_DETACH);
+ if (!nmsg)
+ return -ENOMEM;
+ gsm48_mmevent_msg(mm->ms, nmsg);
+
+ return -EBUSY;
+ }
+
+ /* in case there is a lockup during exit */
+ signal(SIGINT, SIG_DFL);
+ signal(SIGHUP, SIG_DFL);
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGPIPE, SIG_DFL);
+
unregister_signal_handler(SS_L1CTL, &signal_cb, NULL);
gsm322_exit(ms);
gsm48_mm_exit(ms);
diff --git a/src/host/layer23/src/gsm322.c b/src/host/layer23/src/gsm322.c
index cd008d1..2a9f3bd 100755
--- a/src/host/layer23/src/gsm322.c
+++ b/src/host/layer23/src/gsm322.c
@@ -85,6 +85,11 @@ int l1ctl_tx_ccch_req_(struct osmocom_ms *ms, uint16_t arfcn)
* - sysinfo pointing to sysinfo memory, allocated temporarily
* - cs->selected and cs->sel_* states of the current / last selected cell.
*
+ *
+ * There is a special state: GSM322_HPLMN_SEARCH
+ * It is used to search for all cells, to find the HPLMN. This is triggered
+ * by a timer.
+ *
*/
/* PLMN selection process
@@ -605,7 +610,7 @@ static int gsm322_sort_list(struct osmocom_ms *ms)
}
}
- /* move Home PLMN, if in list */
+ /* move Home PLMN, if in list, else add it */
if (subscr->sim_valid) {
found = NULL;
llist_for_each_entry(temp, &temp_list, entry) {
@@ -616,8 +621,18 @@ static int gsm322_sort_list(struct osmocom_ms *ms)
}
}
if (found) {
+ /* move */
llist_del(&found->entry);
llist_add_tail(&found->entry, &plmn->sorted_plmn);
+ } else {
+ /* add */
+ temp = talloc_zero(l23_ctx, struct gsm322_plmn_list);
+ if (!temp)
+ return -ENOMEM;
+ temp->mcc = subscr->mcc;
+ temp->mnc = subscr->mnc;
+ temp->rxlev_db = 0; /* unknown */
+ llist_add_tail(&temp->entry, &plmn->sorted_plmn);
}
}
@@ -693,6 +708,8 @@ static int gsm322_sort_list(struct osmocom_ms *ms)
i++;
}
+ gsm322_dump_sorted_plmn(ms);
+
return 0;
}
@@ -749,7 +766,8 @@ static int gsm322_a_no_more_plmn(struct osmocom_ms *ms, struct msgb *msg)
struct msgb *nmsg;
int found;
- /* any PLMN available */
+ /* any allowable PLMN available? */
+ plmn->mcc = plmn->mnc = 0;
found = gsm322_cs_select(ms, 0);
/* if no PLMN in list */
@@ -1074,13 +1092,15 @@ static int gsm322_a_roaming_na(struct osmocom_ms *ms, struct msgb *msg)
/* On VPLMN of home country and timeout occurs */
static int gsm322_a_hplmn_search(struct osmocom_ms *ms, struct msgb *msg)
{
+ struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm322_plmn *plmn = &ms->plmn;
struct gsm322_cellsel *cs = &ms->cellsel;
struct msgb *nmsg;
- /* try again later, if not idle */
- if (cs->state != GSM322_C3_CAMPED_NORMALLY) {
- LOGP(DPLMN, LOGL_INFO, "Not camping normal, wait some more.\n");
+ /* try again later, if not idle and not camping */
+ if (rr->state != GSM48_RR_ST_IDLE
+ || cs->state != GSM322_C3_CAMPED_NORMALLY) {
+ LOGP(DPLMN, LOGL_INFO, "Not camping, wait some more.\n");
start_plmn_timer(plmn, 60);
return 0;
@@ -1352,12 +1372,12 @@ static int gsm322_cs_select(struct osmocom_ms *ms, int any)
/* set out access class depending on the cell selection type */
if (any) {
acc_class = subscr->acc_class | 0x0400; /* add emergency */
- LOGP(DCS, LOGL_INFO, "Using access class with Emergency "
+ LOGP(DCS, LOGL_INFO, "Select using access class with Emergency "
"class.\n");
} else {
acc_class = subscr->acc_class & 0xfbff; /* remove emergency */
- LOGP(DCS, LOGL_INFO, "Using access class without Emergency "
- "class\n");
+ LOGP(DCS, LOGL_INFO, "Select using access class without "
+ "Emergency class\n");
}
/* flags to match */
@@ -1416,7 +1436,7 @@ static int gsm322_cs_select(struct osmocom_ms *ms, int any)
cs->list[i].flags |= GSM322_CS_FLAG_TEMP_AA;
/* if we search a specific PLMN, but it does not match */
- if (!any && (cs->mcc != s->mcc
+ if (!any && cs->mcc && (cs->mcc != s->mcc
|| cs->mnc != s->mnc)) {
LOGP(DCS, LOGL_INFO, "Skip frequency %d: PLMN of cell "
"does not match target PLMN. (mcc=%03d "
@@ -1437,8 +1457,6 @@ static int gsm322_cs_select(struct osmocom_ms *ms, int any)
}
}
- gsm322_dump_sorted_plmn(ms);
-
if (found >= 0)
LOGP(DCS, LOGL_INFO, "Cell frequency %d selected.\n", found);
@@ -1514,7 +1532,7 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
/* if all frequencies have been searched */
if (!weight) {
struct msgb *nmsg;
- int found, any;
+ int found, any = 0;
LOGP(DCS, LOGL_INFO, "All frequencies scanned.\n");
@@ -1602,8 +1620,11 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
cs->ccch_active = 0;
l1ctl_tx_ccch_req_(ms, cs->arfcn);
- /* Allocate system information. */
- if (!cs->list[cs->arfcn].sysinfo)
+ /* Allocate/clean system information. */
+ if (cs->list[cs->arfcn].sysinfo)
+ memset(cs->list[cs->arfcn].sysinfo, 0,
+ sizeof(struct gsm48_sysinfo));
+ else
cs->list[cs->arfcn].sysinfo = talloc_zero(l23_ctx,
struct gsm48_sysinfo);
if (!cs->list[cs->arfcn].sysinfo)
@@ -1629,7 +1650,8 @@ static int gsm322_cs_store(struct osmocom_ms *ms)
&& cs->state != GSM322_C4_NORMAL_CELL_RESEL
&& cs->state != GSM322_C8_ANY_CELL_RESEL
&& cs->state != GSM322_C5_CHOOSE_CELL
- && cs->state != GSM322_C9_CHOOSE_ANY_CELL) {
+ && cs->state != GSM322_C9_CHOOSE_ANY_CELL
+ && cs->state != GSM322_HPLMN_SEARCH) {
LOGP(DCS, LOGL_FATAL, "This must only happen during cell "
"(re-)selection, please fix!\n");
return -EINVAL;
@@ -1814,6 +1836,8 @@ static int gsm322_c_camp_sysinfo_bcch(struct osmocom_ms *ms, struct msgb *msg)
/* mark cell as unscanned */
cs->list[cs->arfcn].flags &= ~GSM322_CS_FLAG_SYSINFO;
if (cs->list[cs->arfcn].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n",
+ cs->arfcn);
talloc_free(cs->list[cs->arfcn].sysinfo);
cs->list[cs->arfcn].sysinfo = NULL;
}
@@ -1911,6 +1935,7 @@ static void gsm322_cs_timeout(void *arg)
/* remove system information */
cs->list[cs->arfcn].flags &= ~GSM322_CS_FLAG_SYSINFO;
if (cs->list[cs->arfcn].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n", cs->arfcn);
talloc_free(cs->list[cs->arfcn].sysinfo);
cs->list[cs->arfcn].sysinfo = NULL;
}
@@ -1984,6 +2009,9 @@ s = -1;
| GSM322_CS_FLAG_SIGNAL
| GSM322_CS_FLAG_SYSINFO);
if (cs->list[i].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free "
+ "sysinfo arfcn=%d\n",
+ i);
talloc_free(
cs->list[i].sysinfo);
cs->list[i].sysinfo = NULL;
@@ -2078,7 +2106,8 @@ static int gsm322_l1_signal(unsigned int subsys, unsigned int signal,
|| cs->state == GSM322_C4_NORMAL_CELL_RESEL
|| cs->state == GSM322_C8_ANY_CELL_RESEL
|| cs->state == GSM322_C5_CHOOSE_CELL
- || cs->state == GSM322_C9_CHOOSE_ANY_CELL)
+ || cs->state == GSM322_C9_CHOOSE_ANY_CELL
+ || cs->state == GSM322_HPLMN_SEARCH)
start_cs_timer(cs, ms->support.scan_to, 0);
// TODO: timer depends on BCCH config
}
@@ -2107,6 +2136,8 @@ static int gsm322_c_hplmn_search(struct osmocom_ms *ms, struct msgb *msg)
| GSM322_CS_FLAG_SIGNAL
| GSM322_CS_FLAG_SYSINFO);
if (cs->list[i].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n",
+ i);
talloc_free(cs->list[i].sysinfo);
cs->list[i].sysinfo = NULL;
}
@@ -2160,6 +2191,8 @@ static int gsm322_c_normal_cell_sel(struct osmocom_ms *ms, struct msgb *msg)
| GSM322_CS_FLAG_SIGNAL
| GSM322_CS_FLAG_SYSINFO);
if (cs->list[i].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n",
+ i);
talloc_free(cs->list[i].sysinfo);
cs->list[i].sysinfo = NULL;
}
@@ -2198,6 +2231,8 @@ static int gsm322_c_any_cell_sel(struct osmocom_ms *ms, struct msgb *msg)
| GSM322_CS_FLAG_SIGNAL
| GSM322_CS_FLAG_SYSINFO);
if (cs->list[i].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n",
+ i);
talloc_free(cs->list[i].sysinfo);
cs->list[i].sysinfo = NULL;
}
@@ -2322,6 +2357,7 @@ if we return from dedicated mode and we have a ba range, we can use that for cel
| GSM322_CS_FLAG_SIGNAL
| GSM322_CS_FLAG_SYSINFO);
if (cs->list[i].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n", i);
talloc_free(cs->list[i].sysinfo);
cs->list[i].sysinfo = NULL;
}
@@ -2683,7 +2719,7 @@ static struct cellselstatelist {
{SBIT(GSM322_C1_NORMAL_CELL_SEL) | SBIT(GSM322_C2_STORED_CELL_SEL) |
SBIT(GSM322_C4_NORMAL_CELL_RESEL) | SBIT(GSM322_C5_CHOOSE_CELL) |
SBIT(GSM322_C9_CHOOSE_ANY_CELL) | SBIT(GSM322_C8_ANY_CELL_RESEL) |
- SBIT(GSM322_C6_ANY_CELL_SEL),
+ SBIT(GSM322_C6_ANY_CELL_SEL) | SBIT(GSM322_HPLMN_SEARCH),
GSM322_EVENT_SYSINFO, gsm322_c_scan_sysinfo_bcch},
{SBIT(GSM322_C3_CAMPED_NORMALLY) | SBIT(GSM322_C7_CAMPED_ANY_CELL),
GSM322_EVENT_SYSINFO, gsm322_c_camp_sysinfo_bcch},
@@ -2944,6 +2980,7 @@ int gsm322_exit(struct osmocom_ms *ms)
/* flush sysinfo */
for (i = 0; i <= 1023; i++) {
if (cs->list[i].sysinfo) {
+ LOGP(DCS, LOGL_INFO, "free sysinfo arfcn=%d\n", i);
talloc_free(cs->list[i].sysinfo);
cs->list[i].sysinfo = NULL;
}
diff --git a/src/host/layer23/src/gsm48_mm.c b/src/host/layer23/src/gsm48_mm.c
index 2d05622..2c3803c 100644
--- a/src/host/layer23/src/gsm48_mm.c
+++ b/src/host/layer23/src/gsm48_mm.c
@@ -34,6 +34,7 @@
#include <osmocom/logging.h>
#include <osmocom/osmocom_data.h>
#include <osmocom/gsm48_cc.h>
+#include <osmocom/l23_app.h>
extern void *l23_ctx;
@@ -518,7 +519,6 @@ static const struct value_string gsm48_mmevent_names[] = {
{ GSM48_MM_EVENT_TIMEOUT_T3230, "MM_EVENT_TIMEOUT_T3230" },
{ GSM48_MM_EVENT_TIMEOUT_T3240, "MM_EVENT_TIMEOUT_T3240" },
{ GSM48_MM_EVENT_IMSI_DETACH, "MM_EVENT_IMSI_DETACH" },
- { GSM48_MM_EVENT_POWER_OFF, "MM_EVENT_POWER_OFF" },
{ GSM48_MM_EVENT_PAGING, "MM_EVENT_PAGING" },
{ GSM48_MM_EVENT_AUTH_RESPONSE, "MM_EVENT_AUTH_RESPONSE" },
{ GSM48_MM_EVENT_SYSINFO, "MM_EVENT_SYSINFO" },
@@ -1643,7 +1643,7 @@ static int gsm48_mm_tx_imsi_detach(struct osmocom_ms *ms, int rr_prim)
ngh->msg_type = GSM48_MT_MM_IMSI_DETACH_IND;
/* classmark 1 */
- if (rr->dm_arfcn >= 512 && rr->dm_arfcn <= 885)
+ if (rr->cd_now.arfcn >= 512 && rr->cd_now.arfcn <= 885)
pwr_lev = sup->pwr_lev_1800;
else
pwr_lev = sup->pwr_lev_900;
@@ -1668,6 +1668,13 @@ 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);
@@ -1969,6 +1976,7 @@ static int gsm48_mm_loc_upd_normal(struct osmocom_ms *ms, struct msgb *msg)
struct gsm_subscriber *subscr = &ms->subscr;
struct gsm322_cellsel *cs = &ms->cellsel;
struct gsm48_sysinfo *s = &cs->sel_si;
+ struct msgb *nmsg;
/* in case we already have a location update going on */
if (mm->lupd_pending) {
@@ -1981,6 +1989,12 @@ static int gsm48_mm_loc_upd_normal(struct osmocom_ms *ms, struct msgb *msg)
if (cs->state != GSM322_C3_CAMPED_NORMALLY) {
LOGP(DMM, LOGL_INFO, "Loc. upd. not allowed.\n");
+ /* send message to PLMN search process */
+ nmsg = gsm322_msgb_alloc(GSM322_EVENT_REG_FAILED);
+ if (!nmsg)
+ return -ENOMEM;
+ gsm322_plmn_sendmsg(ms, nmsg);
+
return 0;
}
@@ -1995,6 +2009,12 @@ static int gsm48_mm_loc_upd_normal(struct osmocom_ms *ms, struct msgb *msg)
LOGP(DMM, LOGL_INFO, "Loc. upd. not required.\n");
subscr->imsi_attached = 1;
+ /* send message to PLMN search process */
+ nmsg = gsm322_msgb_alloc(GSM322_EVENT_REG_SUCCESS);
+ if (!nmsg)
+ return -ENOMEM;
+ gsm322_plmn_sendmsg(ms, nmsg);
+
return 0;
}
@@ -2079,7 +2099,7 @@ static int gsm48_mm_tx_loc_upd_req(struct osmocom_ms *ms)
gsm48_generate_lai(&nlu->lai,
subscr->lai_mcc, subscr->lai_mnc, subscr->lai_lac);
/* classmark 1 */
- if (rr->dm_arfcn >= 512 && rr->dm_arfcn <= 885)
+ if (rr->cd_now.arfcn >= 512 && rr->cd_now.arfcn <= 885)
pwr_lev = sup->pwr_lev_1800;
else
pwr_lev = sup->pwr_lev_900;
diff --git a/src/host/layer23/src/gsm48_rr.c b/src/host/layer23/src/gsm48_rr.c
index 2b71ccc..360ae5f 100644
--- a/src/host/layer23/src/gsm48_rr.c
+++ b/src/host/layer23/src/gsm48_rr.c
@@ -619,7 +619,7 @@ int gsm48_rr_enc_cm2(struct osmocom_ms *ms, struct gsm48_classmark2 *cm)
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm_support *sup = &ms->support;
- if (rr->dm_arfcn >= 512 && rr->dm_arfcn <= 885)
+ if (rr->cd_now.arfcn >= 512 && rr->cd_now.arfcn <= 885)
cm->pwr_lev = sup->pwr_lev_1800;
else
cm->pwr_lev = sup->pwr_lev_900;
@@ -2436,20 +2436,20 @@ static int gsm48_rr_rx_imm_ass_ext(struct osmocom_ms *ms, struct msgb *msg)
}
/* decode channel description */
- LOGP(DRR, LOGL_INFO, "IMMEDIATE ASSIGNMENT EXTENDED ");
+ LOGP(DRR, LOGL_INFO, "IMMEDIATE ASSIGNMENT EXTENDED:");
rsl_dec_chan_nr(ia->chan_desc1.chan_nr, &ch_type, &ch_subch, &ch_ts);
if (ia->chan_desc1.h0.h) {
cd1.h = 1;
gsm48_decode_chan_h1(&ia->chan_desc1, &cd1.tsc, &cd1.maio,
&cd1.hsn);
- LOGP(DRR, LOGL_INFO, "1(ra=0x%02x, "
+ LOGP(DRR, LOGL_INFO, " assignment 1 (ra=0x%02x, "
"chan_nr=0x%02x, MAIO=%u, HSN=%u, TS=%u, SS=%u, "
"TSC=%u)\n", ia->req_ref1.ra, ia->chan_desc1.chan_nr,
cd1.maio, cd1.hsn, ch_ts, ch_subch, cd1.tsc);
} else {
cd1.h = 0;
gsm48_decode_chan_h0(&ia->chan_desc1, &cd1.tsc, &cd1.arfcn);
- LOGP(DRR, LOGL_INFO, "1(ra=0x%02x, "
+ LOGP(DRR, LOGL_INFO, " assignment 1 (ra=0x%02x, "
"chan_nr=0x%02x, ARFCN=%u, TS=%u, SS=%u, TSC=%u)\n",
ia->req_ref1.ra, ia->chan_desc1.chan_nr, cd1.arfcn,
ch_ts, ch_subch, cd1.tsc);
@@ -2459,14 +2459,14 @@ static int gsm48_rr_rx_imm_ass_ext(struct osmocom_ms *ms, struct msgb *msg)
cd2.h = 1;
gsm48_decode_chan_h1(&ia->chan_desc2, &cd1.tsc, &cd1.maio,
&cd1.hsn);
- LOGP(DRR, LOGL_INFO, "2(ra=0x%02x, "
+ LOGP(DRR, LOGL_INFO, " assignment 2 (ra=0x%02x, "
"chan_nr=0x%02x, MAIO=%u, HSN=%u, TS=%u, SS=%u, "
"TSC=%u)\n", ia->req_ref2.ra, ia->chan_desc2.chan_nr,
cd2.maio, cd2.hsn, ch_ts, ch_subch, cd2.tsc);
} else {
cd2.h = 0;
gsm48_decode_chan_h0(&ia->chan_desc2, &cd2.tsc, &cd2.arfcn);
- LOGP(DRR, LOGL_INFO, "2(ra=0x%02x, "
+ LOGP(DRR, LOGL_INFO, " assignment 2 (ra=0x%02x, "
"chan_nr=0x%02x, ARFCN=%u, TS=%u, SS=%u, TSC=%u)\n",
ia->req_ref2.ra, ia->chan_desc2.chan_nr, cd2.arfcn,
ch_ts, ch_subch, cd2.tsc);
@@ -2711,8 +2711,7 @@ static int gsm48_rr_dl_est(struct osmocom_ms *ms)
#ifdef TODO
RSL_MT_ to activate channel with all the cd_now informations
#else
- rr->dm_arfcn = rr->cd_now.arfcn;
- tx_ph_dm_est_req(ms, rr->dm_arfcn, rr->cd_now.chan_nr);
+ tx_ph_dm_est_req(ms, rr->cd_now.arfcn, rr->cd_now.chan_nr);
#endif
/* start establishmnet */
@@ -2753,12 +2752,13 @@ static int gsm48_rr_rel_cnf(struct osmocom_ms *ms, struct msgb *msg)
struct gsm48_rrlayer *rr = &ms->rrlayer;
/* deactivate channel */
- LOGP(DRR, LOGL_INFO, "deactivating channel (arfcn %d)\n", rr->dm_arfcn);
+ LOGP(DRR, LOGL_INFO, "deactivating channel (arfcn %d)\n",
+ rr->cd_now.arfcn);
#ifdef TODO
release and give new arfcn
tx_ph_dm_rel_req(ms, arfcn, rr->chan_desc.chan_desc.chan_nr);
#else
- l1ctl_tx_ccch_req(ms, rr->dm_arfcn);
+ l1ctl_tx_ccch_req(ms, rr->cd_now.arfcn);
#endif
/* do nothing, because we aleady IDLE
@@ -3594,8 +3594,7 @@ static int gsm48_rr_rel_cnf_dedicated(struct osmocom_ms *ms, struct msgb *msg)
struct msgb *msg;
/* change radio to new channel */
- rr->arfcn = rr->chan_desc.chan_desc.chan_nr;
- tx_ph_dm_est_req(ms, arfcn, rr->arfcn);
+ tx_ph_dm_est_req(ms, rr->cd_now.arfcn, rr->cd_now.chan_nr);
nmsg = gsm48_l3_msgb_alloc();
if (!nmsg)
@@ -3625,8 +3624,8 @@ static int gsm48_rr_mdl_error_ind(struct osmocom_ms *ms, struct msgb *msg)
memcpy(&rr->chan_desc, &rr->chan_last, sizeof(*cd));
/* change radio to old channel */
- rr->arfcn = rr->chan_desc.chan_desc.chan_nr;
- tx_ph_dm_est_req(ms, arfcn, rr->arfcn);
+ tx_ph_dm_est_req(ms, rr->cd_now.arfcn,
+ rr->cd_now.chan_nr);
/* re-establish old link */
nmsg = gsm48_l3_msgb_alloc();
@@ -3663,8 +3662,7 @@ static void timeout_rr_t3124(void *arg)
memcpy(&rr->chan_desc, &rr->chan_last, sizeof(*cd));
/* change radio to old channel */
- rr->arfcn = rr->chan_desc.chan_desc.chan_nr;
- tx_ph_dm_est_req(ms, arfcn, rr->arfcn);
+ tx_ph_dm_est_req(ms, rr->cd_now.arfcn, rr->cd_now.chan_nr);
/* re-establish old link */
nmsg = gsm48_l3_msgb_alloc();
diff --git a/src/host/layer23/src/main.c b/src/host/layer23/src/main.c
index f970d67..ed256cf 100644
--- a/src/host/layer23/src/main.c
+++ b/src/host/layer23/src/main.c
@@ -196,19 +196,17 @@ static void handle_options(int argc, char **argv)
void sighandler(int sigset)
{
+ int rc = 0;
+
if (sigset == SIGHUP || sigset == SIGPIPE)
return;
- signal(SIGINT, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGTERM, SIG_DFL);
- signal(SIGPIPE, SIG_DFL);
-
fprintf(stderr, "Signal %d recevied.\n", sigset);
if (l23_app_exit)
- l23_app_exit(ms);
+ rc = l23_app_exit(ms);
- exit (0);
+ if (rc != -EBUSY)
+ exit (0);
}
int main(int argc, char **argv)