bsc/nitb: Allow to set the GPRS mode through the ctrl command
Create a control command to read and modify the gprs mode. Use
the get_string_value to indicate if the value was found or not.
This is useful for the ctrl interface where I didn't want to
replicate "none", "gprs" and "egprs". Share code to verify that
a BTS supports the mode.
Related: SYS#591
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 2857494..588be26 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -2500,16 +2500,9 @@
"EGPRS (EDGE) Enabled on this BTS\n")
{
struct gsm_bts *bts = vty->index;
- enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
+ enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL);
- if (mode != BTS_GPRS_NONE &&
- !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
- vty_out(vty, "This BTS type does not support %s%s", argv[0],
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (mode == BTS_GPRS_EGPRS &&
- !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
+ if (!bts_gprs_mode_is_compat(bts, mode)) {
vty_out(vty, "This BTS type does not support %s%s", argv[0],
VTY_NEWLINE);
return CMD_WARNING;