FreeCalypso > hg > freecalypso-sw
annotate rvinterf/asyncshell/rxctl.c @ 1022:24440bc7cee8
gsm-fw/configs: gtamodem-gsmtch-{ext,int} configurations added
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Tue, 03 May 2016 13:43:31 +0000 |
parents | 820d34f3f3d7 |
children |
rev | line source |
---|---|
874
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This module contains the code for enabling and disabling the receiving |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * of various packet types via rvinterf. |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <sys/types.h> |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <ctype.h> |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <string.h> |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include <strings.h> |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include <stdlib.h> |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "pktmux.h" |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "localsock.h" |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 void |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 send_rxctl_cmd(channel, enable) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 u_char cmdbuf[2]; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 cmdbuf[0] = enable ? CLI2RVI_WANT_MUXPROTO : CLI2RVI_DROP_MUXPROTO; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 cmdbuf[1] = channel; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 send_init_command(cmdbuf, 2); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 void |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 ati_rx_control(newstate) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 static int state = 0; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 if (state == newstate) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 return; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 send_rxctl_cmd(RVT_AT_HEADER, newstate); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 state = newstate; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 void |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 gpf_rx_control(newstate) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 static int state = 0; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 if (state == newstate) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 return; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 send_rxctl_cmd(RVT_L23_HEADER, newstate); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 state = newstate; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 void |
1011
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
48 tch_rx_control(newstate) |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
49 { |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
50 static int state = 0; |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
51 |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
52 if (state == newstate) |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
53 return; |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
54 send_rxctl_cmd(RVT_TCH_HEADER, newstate); |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
55 state = newstate; |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
56 } |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
57 |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
58 void |
874
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 rxctl_user_cmd(args, enable) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 char *args; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 char *cp, *np; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 int gotsome = 0; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 for (cp = args; ; ) { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 while (isspace(*cp)) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 cp++; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 if (!*cp) { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 if (!gotsome) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 printf("error: argument required\n"); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 return; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 for (np = cp; *cp && !isspace(*cp); cp++) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 ; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 if (*cp) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 *cp++ = '\0'; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 if (!strcmp(np, "ati")) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 ati_rx_control(enable); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 else if (!strcmp(np, "gpf")) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 gpf_rx_control(enable); |
1011
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
81 else if (!strcmp(np, "tch")) |
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
876
diff
changeset
|
82 tch_rx_control(enable); |
874
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 else { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 printf("error: unknown channel \"%s\"\n", np); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 return; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 } |
876
c9f353b5d70c
rvinterf/asyncshell/rxctl.c: buglet in the implementation of dis/enable commands
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
874
diff
changeset
|
87 gotsome++; |
874
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 void |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 cmd_enable(args) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 char *args; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 rxctl_user_cmd(args, 1); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 } |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 void |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 cmd_disable(args) |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 char *args; |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 { |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 rxctl_user_cmd(args, 0); |
72d64c172d85
fc-shell: Rx control implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 } |