summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas.Eversberg2010-05-11 00:06:37 +0200
committerAndreas.Eversberg2010-05-11 00:06:37 +0200
commitbb08bbd1d7f710bbd3df2a0e5af87eeac1e4ed50 (patch)
tree5cc372426fe72eeafff22a9e7df5009da2cb0d44 /src
parentadd MNC of DB Systel to network list (diff)
downloadosmocom-bb08bbd1d7f710bbd3df2a0e5af87eeac1e4ed50.tar.gz
osmocom-bb08bbd1d7f710bbd3df2a0e5af87eeac1e4ed50.tar.xz
osmocom-bb08bbd1d7f710bbd3df2a0e5af87eeac1e4ed50.zip
Minor fixes and improvements to L3 and VTY.
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/vty/command.h4
-rw-r--r--src/host/layer23/src/app_mobile.c4
-rwxr-xr-xsrc/host/layer23/src/gsm322.c6
-rw-r--r--src/host/layer23/src/sysinfo.c1
-rw-r--r--src/host/layer23/src/vty/command.c10
-rw-r--r--src/host/layer23/src/vty_interface.c76
6 files changed, 87 insertions, 14 deletions
diff --git a/src/host/layer23/include/vty/command.h b/src/host/layer23/include/vty/command.h
index 03b071f..d16d9dd 100644
--- a/src/host/layer23/include/vty/command.h
+++ b/src/host/layer23/include/vty/command.h
@@ -101,12 +101,14 @@ enum node_type {
#endif
VTY_NODE, /* Vty node. */
- GSMNET_NODE,
+ MS_NODE,
+#if 0
BTS_NODE,
TRX_NODE,
TS_NODE,
SUBSCR_NODE,
MGCP_NODE,
+#endif
};
/* Node which has some commands and prompt string and configuration
diff --git a/src/host/layer23/src/app_mobile.c b/src/host/layer23/src/app_mobile.c
index 1cf62ed..089f686 100644
--- a/src/host/layer23/src/app_mobile.c
+++ b/src/host/layer23/src/app_mobile.c
@@ -87,8 +87,8 @@ static int signal_cb(unsigned int subsys, unsigned int signal,
ms = signal_data;
gsm_subscr_testcard(ms, 1, 1, "0000000000");
// ms->subscr.plmn_valid = 1;
- ms->subscr.plmn_mcc = 262;
- ms->subscr.plmn_mnc = 2;
+ ms->subscr.plmn_mcc = 1;
+ ms->subscr.plmn_mnc = 1;
ms->plmn.mode = PLMN_MODE_MANUAL;
/* start PLMN + cell selection process */
nmsg = gsm322_msgb_alloc(GSM322_EVENT_SWITCH_ON);
diff --git a/src/host/layer23/src/gsm322.c b/src/host/layer23/src/gsm322.c
index 41ec30b..efd1c34 100755
--- a/src/host/layer23/src/gsm322.c
+++ b/src/host/layer23/src/gsm322.c
@@ -1696,6 +1696,7 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
start_cs_timer(cs, ms->support.sync_to, 0);
/* Allocate/clean system information. */
+ cs->list[cs->arfcn].flags &= ~GSM322_CS_FLAG_SYSINFO;
if (cs->list[cs->arfcn].sysinfo)
memset(cs->list[cs->arfcn].sysinfo, 0,
sizeof(struct gsm48_sysinfo));
@@ -1988,7 +1989,10 @@ static int gsm322_c_camp_sysinfo_bcch(struct osmocom_ms *ms, struct msgb *msg)
/* check for barred cell */
if (gm->sysinfo == GSM48_MT_RR_SYSINFO_1) {
/* check if cell becomes barred */
- if (!subscr->acc_barr && s->cell_barr) {
+ if (!subscr->acc_barr && s->cell_barr
+ && !(cs->list[cs->arfcn].sysinfo
+ && cs->list[cs->arfcn].sysinfo->sp
+ && cs->list[cs->arfcn].sysinfo->sp_cbq)) {
LOGP(DCS, LOGL_INFO, "Cell becomes barred.\n");
trigger_resel:
/* mark cell as unscanned */
diff --git a/src/host/layer23/src/sysinfo.c b/src/host/layer23/src/sysinfo.c
index 4304df5..4e72886 100644
--- a/src/host/layer23/src/sysinfo.c
+++ b/src/host/layer23/src/sysinfo.c
@@ -99,6 +99,7 @@ int gsm48_sysinfo_dump(struct gsm48_sysinfo *s,
print(priv, " MAX_RETRANS = %d TX_INTEGER = %d re-establish = %s\n",
s->max_retrans, s->tx_integer,
(s->reest_denied) ? "denied" : "allowed");
+ todo!!
print(priv, " Cell barred = %s barred classes =",
(s->cell_barr ? "yes" : "no"));
for (i = 0; i < 16; i++) {
diff --git a/src/host/layer23/src/vty/command.c b/src/host/layer23/src/vty/command.c
index d42535d..a777ab7 100644
--- a/src/host/layer23/src/vty/command.c
+++ b/src/host/layer23/src/vty/command.c
@@ -1910,11 +1910,11 @@ enum node_type vty_go_parent(struct vty *vty)
assert(vty->node > CONFIG_NODE);
switch (vty->node) {
-#if 0
- case GSMNET_NODE:
+ case MS_NODE:
vty->node = CONFIG_NODE;
vty->index = NULL;
break;
+#if 0
case BTS_NODE:
vty->node = GSMNET_NODE;
{
@@ -2237,7 +2237,7 @@ cmd_execute_command_strict(vector vline, struct vty *vty,
}
/* Configration make from file. */
-int config_from_file(struct vty *vty, FILE * fp)
+int config_from_file(struct vty *vty, OSMOCOM_FILE * fp)
{
int ret;
vector vline;
@@ -2311,11 +2311,11 @@ DEFUN(config_exit,
config_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
{
switch (vty->node) {
-#if 0
- case GSMNET_NODE:
+ case MS_NODE:
vty->node = CONFIG_NODE;
vty->index = NULL;
break;
+#if 0
case BTS_NODE:
vty->node = GSMNET_NODE;
{
diff --git a/src/host/layer23/src/vty_interface.c b/src/host/layer23/src/vty_interface.c
index 3f508da..30b3c4e 100644
--- a/src/host/layer23/src/vty_interface.c
+++ b/src/host/layer23/src/vty_interface.c
@@ -33,6 +33,12 @@
extern struct llist_head ms_list;
+struct cmd_node ms_node = {
+ MS_NODE,
+ "%s(ms)#",
+ 1
+};
+
static void print_vty(void *priv, const char *fmt, ...)
{
char buffer[1000];
@@ -183,7 +189,7 @@ DEFUN(show_ba, show_ba_cmd, "show ba MS_NAME [mcc] [mnc]",
}
DEFUN(insert_test, insert_test_cmd, "insert testcard MS_NAME [mcc] [mnc]",
- SHOW_STR "Insert test card\n")
+ "Insert ...\nInsert test card\n")
{
struct osmocom_ms *ms;
uint16_t mcc = 1, mnc = 1;
@@ -209,7 +215,7 @@ DEFUN(insert_test, insert_test_cmd, "insert testcard MS_NAME [mcc] [mnc]",
}
DEFUN(remove_sim, remove_sim_cmd, "remove sim MS_NAME",
- SHOW_STR "Insert test card\n")
+ "Remove ...\nRemove SIM card\n")
{
struct osmocom_ms *ms;
@@ -227,20 +233,80 @@ DEFUN(remove_sim, remove_sim_cmd, "remove sim MS_NAME",
return CMD_SUCCESS;
}
+/* per MS config */
+DEFUN(cfg_ms, cfg_ms_cmd, "ms MS_NAME",
+ "Select a mobile station to configure\n")
+{
+ struct osmocom_ms *ms;
+
+ ms = get_ms(argv[0], vty);
+ if (!ms)
+ return CMD_WARNING;
+
+ vty->index = ms;
+ vty->node = MS_NODE;
+
+ return CMD_SUCCESS;
+}
+
+static void config_write_ms_single(struct vty *vty, struct osmocom_ms *ms)
+{
+ vty_out(vty, " ms %s%s", ms->name, VTY_NEWLINE);
+ vty_out(vty, " network-selection-mode %s%s", (ms->plmn.mode
+ == PLMN_MODE_AUTO) ? "auto" : "manual", VTY_NEWLINE);
+}
+
+static int config_write_ms(struct vty *vty)
+{
+ struct osmocom_ms *ms;
+
+ llist_for_each_entry(ms, &ms_list, entity)
+ config_write_ms_single(vty, ms);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_mode, cfg_ms_mode_cmd, "network-selection-mode (auto|manual)",
+ "Set network selection mode\n")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct msgb *nmsg;
+
+ if (argv[0][0] == 'a')
+ nmsg = gsm322_msgb_alloc(GSM322_EVENT_SEL_AUTO);
+ else
+ nmsg = gsm322_msgb_alloc(GSM322_EVENT_SEL_MANUAL);
+ if (!nmsg)
+ return CMD_WARNING;
+ gsm322_plmn_sendmsg(ms, nmsg);
+
+ return CMD_SUCCESS;
+}
+
int ms_vty_init(void)
{
cmd_init(1);
vty_init();
install_element(VIEW_NODE, &show_ms_cmd);
- install_element(VIEW_NODE, &show_support_cmd);
+ install_element(ENABLE_NODE, &show_ms_cmd);
install_element(VIEW_NODE, &show_subscr_cmd);
+ install_element(ENABLE_NODE, &show_support_cmd);
+ install_element(VIEW_NODE, &show_support_cmd);
+ install_element(ENABLE_NODE, &show_cell_cmd);
install_element(VIEW_NODE, &show_cell_cmd);
+ install_element(ENABLE_NODE, &show_cell_si_cmd);
install_element(VIEW_NODE, &show_cell_si_cmd);
+ install_element(ENABLE_NODE, &show_ba_cmd);
install_element(VIEW_NODE, &show_ba_cmd);
- install_element(VIEW_NODE, &insert_test_cmd);
- install_element(VIEW_NODE, &remove_sim_cmd);
+ install_element(ENABLE_NODE, &insert_test_cmd);
+ install_element(ENABLE_NODE, &remove_sim_cmd);
+
+ install_element(CONFIG_NODE, &cfg_ms_cmd);
+ install_node(&ms_node, config_write_ms);
+ install_default(MS_NODE);
+ install_element(MS_NODE, &cfg_ms_mode_cmd);
return 0;
}