FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/rftablechk.c @ 752:c79aaed75bd8
compile-fc-batt: allow possible third field in source lines
Battery tables maintained in the fc-battery-conf repository will now
have a third field added, defining thresholds for the battery bars icon,
and there will be a new utility to compile them into the new
/etc/batterytab2 file read by the FC Tourmaline version of our
FCHG driver. For backward compatibility with the original Magnetite
version of FCHG, compile-fc-batt remains the tool for compiling the
original /etc/batterytab file format, and it needs to ignore the
newly added third field in battery table sources.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Nov 2020 20:37:55 +0000 |
parents | bc23c1cd30ae |
children |
rev | line source |
---|---|
123
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the function that checks if the table format |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * and rftw index match. |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "localtypes.h" |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "l1tm.h" |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "exitcodes.h" |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 static struct table_match { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 int index; |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 char *format; |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 } matchlist[] = { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 {RX_AGC_TABLE, "agc-table"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 {AFC_PARAMS, "afcparams"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 {RX_AGC_GLOBAL_PARAMS, "agc-global-params"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 {RX_IL_2_AGC_MAX, "il2agc"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 {RX_IL_2_AGC_PWR, "il2agc"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 {RX_IL_2_AGC_AV, "il2agc"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 {TX_LEVELS, "tx-levels"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 {TX_CAL_CHAN, "tx-calchan"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 {TX_CAL_TEMP, "tx-caltemp"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 {RX_CAL_CHAN, "rx-calchan"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 {RX_CAL_TEMP, "rx-caltemp"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 {RX_AGC_PARAMS, "rx-agc-params"}, |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 {0, 0} |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 }; |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 rftw_index_format_check(index, format) |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 char *format; |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 struct table_match *tp; |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 if (!strcmp(format, "raw")) |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 return(0); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 for (tp = matchlist; tp->index; tp++) { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 if (tp->index == index) { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 if (!strcmp(format, tp->format)) |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 return(0); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 printf("error: read table of type %s, expected %s\n", |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 format, tp->format); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 return(ERROR_USAGE); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 } |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 } |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return(0); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |