FreeCalypso > hg > freecalypso-tools
changeset 120:12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 Feb 2017 08:02:22 +0000 |
parents | 6ce20d48e9ee |
children | 4070847293a9 |
files | rvinterf/tmsh/l1cmd.c |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/tmsh/l1cmd.c Sat Feb 18 07:54:38 2017 +0000 +++ b/rvinterf/tmsh/l1cmd.c Sat Feb 18 08:02:22 2017 +0000 @@ -198,13 +198,27 @@ return(0); } +static struct kwtab rf_param_arg[] = { + {"bcch-arfcn", BCCH_ARFCN}, + {"tch-arfcn", TCH_ARFCN}, + {"mon-arfcn", MON_ARFCN}, + {"pdtch-arfcn", PDTCH_ARFCN}, + {"std-band", STD_BAND_FLAG}, + {"afc-enable", AFC_ENA_FLAG}, + {"afc-dac-val", AFC_DAC_VALUE}, + {"init-afc-dac", INITIAL_AFC_DAC}, + {"multislot-class", MULTISLOT_CLASS}, + {0, 0} +}; + cmd_rfpw2(argc, argv) char **argv; { u16 index, value; u_char cmdpkt[7]; - index = strtoul(argv[1], 0, 0); + if (keyword_or_num(argv[1], rf_param_arg, &index)) + return(ERROR_USAGE); value = strtol(argv[2], 0, 0); cmdpkt[1] = RF_PARAM_WRITE; cmdpkt[2] = index; @@ -222,7 +236,8 @@ u8 val1, val2; u_char cmdpkt[7]; - index = strtoul(argv[1], 0, 0); + if (keyword_or_num(argv[1], rf_param_arg, &index)) + return(ERROR_USAGE); val1 = strtoul(argv[2], 0, 0); val2 = strtoul(argv[3], 0, 0); cmdpkt[1] = RF_PARAM_WRITE; @@ -254,7 +269,8 @@ u16 index; u_char cmdpkt[5]; - index = strtoul(argv[1], 0, 0); + if (keyword_or_num(argv[1], rf_param_arg, &index)) + return(ERROR_USAGE); cmdpkt[1] = RF_PARAM_READ; cmdpkt[2] = index; cmdpkt[3] = index >> 8;