summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas.Eversberg <jolly@eversberg.eu>2010-09-26 21:08:53 +0000
committerAndreas.Eversberg <jolly@eversberg.eu>2010-09-26 21:08:53 +0000
commit7e4f54c4ee814a92f475ffbd2b6b55a12371dad6 (patch)
treebcf2edc360a39c48a0f4b2c427ad2e65712efb1f
parented342e16731c69cd86ea17c9d066e153819a3093 (diff)
[layer23] VTY command for changing LAI on SIM card
This speed up network selection process, because no manual network search is required to change a network.
-rw-r--r--src/host/layer23/src/mobile/subscriber.c4
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c32
2 files changed, 36 insertions, 0 deletions
diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c
index 782bece5..00d823cb 100644
--- a/src/host/layer23/src/mobile/subscriber.c
+++ b/src/host/layer23/src/mobile/subscriber.c
@@ -653,6 +653,10 @@ void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2,
struct msgb *nmsg;
uint8_t job;
+ /* skip, if no real valid SIM */
+ if (subscr->sim_type != GSM_SIM_TYPE_READER)
+ return;
+
switch (mode) {
case -1:
job = SIM_JOB_PIN1_DISABLE;
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index eda2d81f..687b7fc3 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -526,6 +526,37 @@ DEFUN(sim_unblock_pin, sim_unblock_pin_cmd, "sim unblock-pin MS_NAME PUC NEW",
return CMD_SUCCESS;
}
+DEFUN(sim_lai, sim_lai_cmd, "sim lai MS_NAME MCC MNC LAC",
+ "SIM actions\nChange LAI of SIM card\nName of MS (see \"show ms\")\n"
+ "Mobile Country Code\nMobile Network Code\nLocation Area Code")
+{
+ struct osmocom_ms *ms;
+ uint16_t mcc = gsm_input_mcc((char *)argv[1]),
+ mnc = gsm_input_mnc((char *)argv[2]),
+ lac = strtoul(argv[3], NULL, 16);
+
+ ms = get_ms(argv[0], vty);
+ if (!ms)
+ return CMD_WARNING;
+
+ if (!mcc) {
+ vty_out(vty, "Given MCC invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ if (!mnc) {
+ vty_out(vty, "Given MNC invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ ms->subscr.mcc = mcc;
+ ms->subscr.mnc = mnc;
+ ms->subscr.lac = lac;
+
+ gsm_subscr_write_loci(ms);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(network_select, network_select_cmd, "network select MS_NAME MCC MNC",
"Select ...\nSelect Network\nName of MS (see \"show ms\")\n"
"Mobile Country Code\nMobile Network Code")
@@ -1467,6 +1498,7 @@ int ms_vty_init(void)
install_element(ENABLE_NODE, &sim_enable_pin_cmd);
install_element(ENABLE_NODE, &sim_change_pin_cmd);
install_element(ENABLE_NODE, &sim_unblock_pin_cmd);
+ install_element(ENABLE_NODE, &sim_lai_cmd);
install_element(ENABLE_NODE, &network_search_cmd);
install_element(ENABLE_NODE, &network_show_cmd);
install_element(ENABLE_NODE, &network_select_cmd);