}
int vty_reading = 0;
+static int hide_default = 0;
static void vty_restart(struct vty *vty, struct osmocom_ms *ms)
{
vty_out(vty, " cell selection state: %s",
cs_state_names[ms->cellsel.state]);
if (ms->rrlayer.state == GSM48_RR_ST_IDLE && ms->cellsel.selected)
- vty_out(vty, " (ARFCN %d)", ms->cellsel.sel_arfcn);
+ vty_out(vty, " (ARFCN %s)",
+ gsm_print_arfcn(ms->cellsel.sel_arfcn));
vty_out(vty, "%s", VTY_NEWLINE);
vty_out(vty, " radio ressource layer state: %s%s",
gsm48_rr_state_names[ms->rrlayer.state], VTY_NEWLINE);
return CMD_SUCCESS;
}
-DEFUN(show_cell_si, show_cell_si_cmd, "show cell MS_NAME <0-1023>",
+DEFUN(show_cell_si, show_cell_si_cmd, "show cell MS_NAME <0-1023> [pcs]",
SHOW_STR "Display information about received cell\n"
- "Name of MS (see \"show ms\")\nRadio frequency number")
+ "Name of MS (see \"show ms\")\nRadio frequency number\n"
+ "Given frequency is PCS band (1900) rather than DCS band.")
{
struct osmocom_ms *ms;
- int i;
struct gsm48_sysinfo *s;
+ uint16_t arfcn = atoi(argv[1]);
ms = get_ms(argv[0], vty);
if (!ms)
return CMD_WARNING;
- i = atoi(argv[1]);
- if (i < 0 || i > 1023) {
- vty_out(vty, "Given ARFCN '%s' not in range (0..1023)%s",
- argv[1], VTY_NEWLINE);
- return CMD_WARNING;
+ if (argc > 2) {
+ if (arfcn < 512 || arfcn > 810) {
+ vty_out(vty, "Given ARFCN not in PCS band%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ arfcn |= ARFCN_PCS;
}
- s = ms->cellsel.list[i].sysinfo;
+
+ s = ms->cellsel.list[arfcn2index(arfcn)].sysinfo;
if (!s) {
vty_out(vty, "Given ARFCN '%s' has no sysinfo available%s",
argv[1], VTY_NEWLINE);
return CMD_SUCCESS;
}
- gsm48_sysinfo_dump(s, i, print_vty, vty);
+ gsm48_sysinfo_dump(s, arfcn, print_vty, vty, ms->settings.freq_map);
return CMD_SUCCESS;
}
return CMD_SUCCESS;
}
+DEFUN(cfg_hide_default, cfg_hide_default_cmd, "hide-default",
+ "Hide most default values in config to make it more compact")
+{
+ hide_default = 1;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_hide_default, cfg_no_hide_default_cmd, "no hide-default",
+ NO_STR "Show default values in config")
+{
+ hide_default = 0;
+
+ return CMD_SUCCESS;
+}
+
/* per MS config */
DEFUN(cfg_ms, cfg_ms_cmd, "ms MS_NAME",
"Select a mobile station to configure\nName of MS (see \"show ms\")")
#define SUP_WRITE(item, cmd) \
if (sup->item) \
- vty_out(vty, " %s%s%s", (set->item) ? "" : "no ", cmd, \
- VTY_NEWLINE);
+ if (!hide_default || !set->item) \
+ vty_out(vty, " %s%s%s", (set->item) ? "" : "no ", \
+ cmd, VTY_NEWLINE);
static void config_write_ms(struct vty *vty, struct osmocom_ms *ms)
{
vty_out(vty, " imei-random %d%s", set->imei_random,
VTY_NEWLINE);
else
- vty_out(vty, " imei-fixed%s", VTY_NEWLINE);
+ if (!hide_default)
+ vty_out(vty, " imei-fixed%s", VTY_NEWLINE);
if (set->emergency_imsi[0])
vty_out(vty, " emergency-imsi %s%s", set->emergency_imsi,
VTY_NEWLINE);
else
- vty_out(vty, " no emergency-imsi%s", VTY_NEWLINE);
- vty_out(vty, " %scall-waiting%s", (set->cw) ? "" : "no ", VTY_NEWLINE);
- vty_out(vty, " %sauto-answer%s", (set->auto_answer) ? "" : "no ",
- VTY_NEWLINE);
- vty_out(vty, " %sclip%s", (set->clip) ? "" : "no ", VTY_NEWLINE);
- vty_out(vty, " %sclir%s", (set->clir) ? "" : "no ", VTY_NEWLINE);
+ if (!hide_default)
+ vty_out(vty, " no emergency-imsi%s", VTY_NEWLINE);
+ if (!hide_default || set->cw)
+ vty_out(vty, " %scall-waiting%s", (set->cw) ? "" : "no ",
+ VTY_NEWLINE);
+ if (!hide_default || set->auto_answer)
+ vty_out(vty, " %sauto-answer%s",
+ (set->auto_answer) ? "" : "no ", VTY_NEWLINE);
+ if (!hide_default || set->clip)
+ vty_out(vty, " %sclip%s", (set->clip) ? "" : "no ",
+ VTY_NEWLINE);
+ if (!hide_default || set->clir)
+ vty_out(vty, " %sclir%s", (set->clir) ? "" : "no ",
+ VTY_NEWLINE);
if (set->alter_tx_power)
if (set->alter_tx_power_value)
vty_out(vty, " tx-power %d%s",
else
vty_out(vty, " tx-power full%s", VTY_NEWLINE);
else
- vty_out(vty, " tx-power auto%s", VTY_NEWLINE);
+ if (!hide_default)
+ vty_out(vty, " tx-power auto%s", VTY_NEWLINE);
if (set->alter_delay)
vty_out(vty, " simulated-delay %d%s", set->alter_delay,
VTY_NEWLINE);
else
- vty_out(vty, " no simulated-delay%s", VTY_NEWLINE);
+ if (!hide_default)
+ vty_out(vty, " no simulated-delay%s", VTY_NEWLINE);
if (set->stick)
- vty_out(vty, " stick %d%s", set->stick_arfcn,
+ vty_out(vty, " stick %d%s%s", set->stick_arfcn & 1023,
+ (set->stick_arfcn & ARFCN_PCS) ? " pcs" : "",
VTY_NEWLINE);
else
- vty_out(vty, " no stick%s", VTY_NEWLINE);
- if (set->no_lupd)
- vty_out(vty, " no location-updating%s", VTY_NEWLINE);
- else
- vty_out(vty, " location-updating%s", VTY_NEWLINE);
+ if (!hide_default)
+ vty_out(vty, " no stick%s", VTY_NEWLINE);
+ if (!hide_default || set->no_lupd)
+ vty_out(vty, " %slocation-updating%s",
+ (set->no_lupd) ? "no " : "", VTY_NEWLINE);
if (set->full_v1 || set->full_v2 || set->full_v3) {
/* mandatory anyway */
vty_out(vty, " codec full-speed%s%s",
else
vty_out(vty, " no codec half-speed%s", VTY_NEWLINE);
}
- if (llist_empty(&set->abbrev))
- vty_out(vty, " no abbrev%s", VTY_NEWLINE);
- else {
+ if (llist_empty(&set->abbrev)) {
+ if (!hide_default)
+ vty_out(vty, " no abbrev%s", VTY_NEWLINE);
+ } else {
llist_for_each_entry(abbrev, &set->abbrev, list)
vty_out(vty, " abbrev %s %s%s%s%s", abbrev->abbrev,
abbrev->number, (abbrev->name[0]) ? " " : "",
SUP_WRITE(p_gsm, "p-gsm");
SUP_WRITE(e_gsm, "e-gsm");
SUP_WRITE(r_gsm, "r-gsm");
+ SUP_WRITE(pcs, "gsm-850");
+ SUP_WRITE(gsm_480, "gsm-480");
+ SUP_WRITE(gsm_450, "gsm-450");
SUP_WRITE(dcs, "dcs");
- vty_out(vty, " class-900 %d%s", set->class_900, VTY_NEWLINE);
- vty_out(vty, " class-dcs %d%s", set->class_dcs, VTY_NEWLINE);
- switch (set->ch_cap) {
- case GSM_CAP_SDCCH:
- vty_out(vty, " channel-capability sdcch%s", VTY_NEWLINE);
- break;
- case GSM_CAP_SDCCH_TCHF:
- vty_out(vty, " channel-capability sdcch+tchf%s", VTY_NEWLINE);
- break;
- case GSM_CAP_SDCCH_TCHF_TCHH:
- vty_out(vty, " channel-capability sdcch+tchf+tchh%s",
- VTY_NEWLINE);
- break;
+ SUP_WRITE(pcs, "pcs");
+ if (sup->r_gsm || sup->e_gsm || sup->p_gsm)
+ if (!hide_default || sup->class_900 != set->class_900)
+ vty_out(vty, " class-900 %d%s", set->class_900,
+ VTY_NEWLINE);
+ if (sup->gsm_850)
+ if (!hide_default || sup->class_850 != set->class_850)
+ vty_out(vty, " class-850 %d%s", set->class_850,
+ VTY_NEWLINE);
+ if (sup->gsm_480 || sup->gsm_450)
+ if (!hide_default || sup->class_400 != set->class_400)
+ vty_out(vty, " class-400 %d%s", set->class_400,
+ VTY_NEWLINE);
+ if (sup->dcs)
+ if (!hide_default || sup->class_dcs != set->class_dcs)
+ vty_out(vty, " class-dcs %d%s", set->class_dcs,
+ VTY_NEWLINE);
+ if (sup->pcs)
+ if (!hide_default || sup->class_pcs != set->class_pcs)
+ vty_out(vty, " class-pcs %d%s", set->class_pcs,
+ VTY_NEWLINE);
+ if (!hide_default || sup->ch_cap != set->ch_cap) {
+ switch (set->ch_cap) {
+ case GSM_CAP_SDCCH:
+ vty_out(vty, " channel-capability sdcch%s",
+ VTY_NEWLINE);
+ break;
+ case GSM_CAP_SDCCH_TCHF:
+ vty_out(vty, " channel-capability sdcch+tchf%s",
+ VTY_NEWLINE);
+ break;
+ case GSM_CAP_SDCCH_TCHF_TCHH:
+ vty_out(vty, " channel-capability sdcch+tchf+tchh%s",
+ VTY_NEWLINE);
+ break;
+ }
}
SUP_WRITE(full_v1, "full-speech-v1");
SUP_WRITE(full_v2, "full-speech-v2");
SUP_WRITE(full_v3, "full-speech-v3");
SUP_WRITE(half_v1, "half-speech-v1");
SUP_WRITE(half_v3, "half-speech-v3");
- vty_out(vty, " min-rxlev %d%s", set->min_rxlev_db, VTY_NEWLINE);
- vty_out(vty, " dsc-max %d%s", set->dsc_max, VTY_NEWLINE);
+ if (!hide_default || sup->min_rxlev_db != set->min_rxlev_db)
+ vty_out(vty, " min-rxlev %d%s", set->min_rxlev_db,
+ VTY_NEWLINE);
+ if (!hide_default || sup->dsc_max != set->dsc_max)
+ vty_out(vty, " dsc-max %d%s", set->dsc_max, VTY_NEWLINE);
vty_out(vty, " exit%s", VTY_NEWLINE);
vty_out(vty, " test-sim%s", VTY_NEWLINE);
vty_out(vty, " imsi %s%s", set->test_imsi, VTY_NEWLINE);
switch (set->test_ki_type) {
case GSM_SIM_KEY_XOR:
- vty_out(vty, " ki xor %s%s", osmo_hexdump(set->test_ki, 12),
- VTY_NEWLINE);
+ vty_out(vty, " ki xor %s%s",
+ osmo_hexdump(set->test_ki, 12), VTY_NEWLINE);
break;
case GSM_SIM_KEY_COMP128:
- vty_out(vty, " ki comp128 %s%s", osmo_hexdump(set->test_ki, 16),
- VTY_NEWLINE);
+ vty_out(vty, " ki comp128 %s%s",
+ osmo_hexdump(set->test_ki, 16), VTY_NEWLINE);
break;
}
- vty_out(vty, " %sbarred-access%s", (set->test_barr) ? "" : "no ",
- VTY_NEWLINE);
+ if (!hide_default || set->test_barr)
+ vty_out(vty, " %sbarred-access%s",
+ (set->test_barr) ? "" : "no ", VTY_NEWLINE);
if (set->test_rplmn_valid) {
vty_out(vty, " rplmn %s %s",
gsm_print_mcc(set->test_rplmn_mcc),
vty_out(vty, " 0x%08x", set->test_tmsi);
vty_out(vty, "%s", VTY_NEWLINE);
} else
- vty_out(vty, " no rplmn%s", VTY_NEWLINE);
- vty_out(vty, " hplmn-search %s%s", (set->test_always) ? "everywhere"
- : "foreign-country", VTY_NEWLINE);
+ if (!hide_default)
+ vty_out(vty, " no rplmn%s", VTY_NEWLINE);
+ if (!hide_default || set->test_always)
+ vty_out(vty, " hplmn-search %s%s",
+ (set->test_always) ? "everywhere" : "foreign-country",
+ VTY_NEWLINE);
vty_out(vty, " exit%s", VTY_NEWLINE);
+ /* no shutdown must be written to config, because shutdown is default */
vty_out(vty, " %sshutdown%s", (ms->shutdown) ? "" : "no ",
VTY_NEWLINE);
vty_out(vty, "exit%s", VTY_NEWLINE);
vty_out(vty, "%sgps enable%s", (g.enable) ? "" : "no ", VTY_NEWLINE);
vty_out(vty, "!%s", VTY_NEWLINE);
+ vty_out(vty, "%shide-default%s", (hide_default) ? "": "no ",
+ VTY_NEWLINE);
+ vty_out(vty, "!%s", VTY_NEWLINE);
+
llist_for_each_entry(ms, &ms_list, entity)
config_write_ms(vty, ms);
return CMD_SUCCESS;
}
-DEFUN(cfg_ms_stick, cfg_ms_stick_cmd, "stick <0-1023>",
- "Stick to the given cell\nARFCN of the cell to stick to")
+DEFUN(cfg_ms_stick, cfg_ms_stick_cmd, "stick <0-1023> [pcs]",
+ "Stick to the given cell\nARFCN of the cell to stick to\n"
+ "Given frequency is PCS band (1900) rather than DCS band.")
{
struct osmocom_ms *ms = vty->index;
struct gsm_settings *set = &ms->settings;
+ uint16_t arfcn = atoi(argv[0]);
+ if (argc > 1) {
+ if (arfcn < 512 || arfcn > 810) {
+ vty_out(vty, "Given ARFCN not in PCS band%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ arfcn |= ARFCN_PCS;
+ }
set->stick = 1;
- set->stick_arfcn = atoi(argv[0]);
+ set->stick_arfcn = arfcn;
return CMD_SUCCESS;
}
"R-GSM (850)", 1);
SUP_EN(cfg_ms_sup_dcs, cfg_ms_sup_dcs_cmd, dcs, "dcs", "DCS (1800)", 0);
SUP_DI(cfg_ms_sup_no_dcs, cfg_ms_sup_no_dcs_cmd, dcs, "dcs", "DCS (1800)", 0);
+SUP_EN(cfg_ms_sup_gsm_850, cfg_ms_sup_gsm_850_cmd, gsm_850, "gsm-850",
+ "GSM 850", 0);
+SUP_DI(cfg_ms_sup_no_gsm_850, cfg_ms_sup_no_gsm_850_cmd, gsm_850, "gsm-850",
+ "GSM 850", 0);
+SUP_EN(cfg_ms_sup_pcs, cfg_ms_sup_pcs_cmd, pcs, "pcs", "PCS (1900)", 0);
+SUP_DI(cfg_ms_sup_no_pcs, cfg_ms_sup_no_pcs_cmd, pcs, "pcs", "PCS (1900)", 0);
+SUP_EN(cfg_ms_sup_gsm_480, cfg_ms_sup_gsm_480_cmd, gsm_480, "gsm-480",
+ "GSM 480", 0);
+SUP_DI(cfg_ms_sup_no_gsm_480, cfg_ms_sup_no_gsm_480_cmd, gsm_480, "gsm-480",
+ "GSM 480", 0);
+SUP_EN(cfg_ms_sup_gsm_450, cfg_ms_sup_gsm_450_cmd, gsm_450, "gsm-450",
+ "GSM 450", 0);
+SUP_DI(cfg_ms_sup_no_gsm_450, cfg_ms_sup_no_gsm_450_cmd, gsm_450, "gsm-450",
+ "GSM 450", 0);
DEFUN(cfg_ms_sup_class_900, cfg_ms_sup_class_900_cmd, "class-900 (1|2|3|4|5)",
- "Select power class for GSM 850/900\n"
+ "Select power class for GSM 900\n"
"20 Watts\n"
"8 Watts\n"
"5 Watts\n"
set->class_900 = atoi(argv[0]);
if (set->class_900 < sup->class_900 && !vty_reading)
- vty_out(vty, "You selected an higher class than supported "
+ vty_out(vty, "Note: You selected a higher class than supported "
+ " by hardware!%s", VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_sup_class_850, cfg_ms_sup_class_850_cmd, "class-850 (1|2|3|4|5)",
+ "Select power class for GSM 850\n"
+ "20 Watts\n"
+ "8 Watts\n"
+ "5 Watts\n"
+ "2 Watts\n"
+ "0.8 Watts")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+ struct gsm_support *sup = &ms->support;
+
+ set->class_850 = atoi(argv[0]);
+
+ if (set->class_850 < sup->class_850 && !vty_reading)
+ vty_out(vty, "Note: You selected a higher class than supported "
+ " by hardware!%s", VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_sup_class_400, cfg_ms_sup_class_400_cmd, "class-400 (1|2|3|4|5)",
+ "Select power class for GSM 400 (480 and 450)\n"
+ "20 Watts\n"
+ "8 Watts\n"
+ "5 Watts\n"
+ "2 Watts\n"
+ "0.8 Watts")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+ struct gsm_support *sup = &ms->support;
+
+ set->class_400 = atoi(argv[0]);
+
+ if (set->class_400 < sup->class_400 && !vty_reading)
+ vty_out(vty, "Note: You selected a higher class than supported "
" by hardware!%s", VTY_NEWLINE);
return CMD_SUCCESS;
if (((set->class_dcs + 1) & 3) < ((sup->class_dcs + 1) & 3)
&& !vty_reading)
- vty_out(vty, "You selected an higher class than supported "
+ vty_out(vty, "Note: You selected a higher class than supported "
+ " by hardware!%s", VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_sup_class_pcs, cfg_ms_sup_class_pcs_cmd, "class-pcs (1|2|3)",
+ "Select power class for PCS 1900\n"
+ "1 Watt\n"
+ "0.25 Watts\n"
+ "4 Watts")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+ struct gsm_support *sup = &ms->support;
+
+ set->class_pcs = atoi(argv[0]);
+
+ if (((set->class_pcs + 1) & 3) < ((sup->class_pcs + 1) & 3)
+ && !vty_reading)
+ vty_out(vty, "Note: You selected a higher class than supported "
" by hardware!%s", VTY_NEWLINE);
return CMD_SUCCESS;
install_element(CONFIG_NODE, &cfg_gps_enable_cmd);
install_element(CONFIG_NODE, &cfg_no_gps_enable_cmd);
+ install_element(CONFIG_NODE, &cfg_hide_default_cmd);
+ install_element(CONFIG_NODE, &cfg_no_hide_default_cmd);
+
install_element(CONFIG_NODE, &cfg_ms_cmd);
install_element(CONFIG_NODE, &cfg_ms_create_cmd);
install_element(CONFIG_NODE, &cfg_ms_rename_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_no_r_gsm_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_dcs_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_no_dcs_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_gsm_850_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_no_gsm_850_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_pcs_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_no_pcs_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_gsm_480_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_no_gsm_480_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_gsm_450_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_no_gsm_450_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_class_900_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_class_dcs_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_class_850_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_class_pcs_cmd);
+ install_element(SUPPORT_NODE, &cfg_ms_sup_class_400_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_ch_cap_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_full_v1_cmd);
install_element(SUPPORT_NODE, &cfg_ms_sup_no_full_v1_cmd);