annotate rvinterf/asyncshell/tchcmd.c @ 1033:5ab737ac3ad7

TCH special feature documentation update
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 01 Jun 2016 02:06:44 +0000
parents 333015c662bc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1014
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * Commands for manipulating the experimental TCH rerouting feature
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 * of FreeCalypso GSM firmware
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 */
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <sys/types.h>
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdio.h>
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <strings.h>
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <stdlib.h>
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "pktmux.h"
1026
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
12 #include "limits.h"
1014
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 #include "tch_feature.h"
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14
1026
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
15 extern u_char rvi_msg[];
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
16 extern int rvi_msg_len;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
17
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
18 static int tch_rawdump_mode;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
19
1014
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 send_tch_config_req(config)
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 {
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 u_char sendpkt[3];
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 sendpkt[0] = RVT_TCH_HEADER;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 sendpkt[1] = TCH_CONFIG_REQ;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 sendpkt[2] = config;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 /* send it! */
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 send_pkt_to_target(sendpkt, 3);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 return(0);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 }
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 cmd_tchdl_common(argc, argv)
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 char **argv;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 {
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 int config;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36
1015
9ced8e13cf91 fc-shell tch-dl command implementation: brown paper bag
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1014
diff changeset
37 if (!strcmp(argv[0], "enable") || !strcmp(argv[0], "on") ||
9ced8e13cf91 fc-shell tch-dl command implementation: brown paper bag
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1014
diff changeset
38 !strcmp(argv[0], "1"))
1014
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 config = 1;
1015
9ced8e13cf91 fc-shell tch-dl command implementation: brown paper bag
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1014
diff changeset
40 else if (!strcmp(argv[0], "disable") || !strcmp(argv[0], "off") ||
9ced8e13cf91 fc-shell tch-dl command implementation: brown paper bag
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1014
diff changeset
41 !strcmp(argv[0], "0"))
1014
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 config = 0;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 else {
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 printf("error: boolean argument required\n");
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 return(1);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 }
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 return send_tch_config_req(config);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 }
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 void
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 cmd_tchdl_interactive(argstr)
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 char *argstr;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 {
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 char *argv[2];
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 int argc, rc;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 rc = parse_interactive_command_into_argv(argstr, argv, 1, 1, &argc);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 if (rc < 0)
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 return;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 tch_rx_control(1);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 cmd_tchdl_common(argc, argv);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 }
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
64 cmd_tchdl_oneshot(argc, argv)
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
65 char **argv;
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
66 {
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
67 return cmd_tchdl_common(argc - 1, argv + 1);
0511507bf6e7 fc-shell: tch-dl control command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
68 }
1026
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
69
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
70 static void
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
71 tch_rawdump()
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
72 {
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
73 char buf[MAX_PKT_FROM_TARGET*3+5], *dp;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
74 u_char *cp, *endp;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
75
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
76 cp = rvi_msg + 2;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
77 endp = rvi_msg + rvi_msg_len;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
78 strcpy(buf, "TCH:");
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
79 dp = buf + 4;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
80 while (cp < endp) {
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
81 sprintf(dp, " %02X", *cp++);
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
82 dp += 3;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
83 }
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
84 *dp = '\0';
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
85 async_msg_output(buf);
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
86 }
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
87
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
88 void
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
89 tch_packet_rx()
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
90 {
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
91 char buf[128];
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
92
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
93 if (tch_rawdump_mode) {
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
94 tch_rawdump();
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
95 return;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
96 }
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
97 if (rvi_msg_len < 3) {
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
98 inv: async_msg_output("Error: invalid TCH packet received");
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
99 return;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
100 }
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
101 switch (rvi_msg[2]) {
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
102 case TCH_CONFIG_CONF:
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
103 if (rvi_msg_len != 4)
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
104 goto inv;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
105 if (rvi_msg[3] & 0xFE)
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
106 goto inv;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
107 sprintf(buf, "TCH_CONFIG_CONF: DL forwarding is %s",
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
108 rvi_msg[3] ? "enabled" : "disabled");
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
109 async_msg_output(buf);
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
110 return;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
111 case TCH_ULBITS_CONF:
1029
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
112 if (rvi_msg_len != 3)
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
113 goto inv;
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
114 tch_ulbits_conf();
1026
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
115 return;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
116 case TCH_DLBITS_IND:
1028
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
117 if (rvi_msg_len != 43)
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
118 goto inv;
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
119 tch_dlbits_handler();
1026
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
120 return;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
121 default:
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
122 goto inv;
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
123 }
f511bbac0efa fc-shell: beginning of TCH code expansion
Mychaela Falconia <falcon@freecalypso.org>
parents: 1015
diff changeset
124 }
1027
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
125
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
126 static void
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
127 cmd_tch_dumpraw(argc, argv)
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
128 char **argv;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
129 {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
130 if (argc < 2) {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
131 printf("error: too few arguments\n");
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
132 return;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
133 }
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
134 if (!strcmp(argv[1], "enable") || !strcmp(argv[1], "on") ||
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
135 !strcmp(argv[1], "1"))
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
136 tch_rawdump_mode = 1;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
137 else if (!strcmp(argv[1], "disable") || !strcmp(argv[1], "off") ||
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
138 !strcmp(argv[1], "0"))
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
139 tch_rawdump_mode = 0;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
140 else
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
141 printf("error: boolean argument required\n");
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
142 }
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
143
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
144 static void
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
145 cmd_tch_status(argc, argv)
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
146 char **argv;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
147 {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
148 if (argc > 1) {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
149 printf("error: too many arguments\n");
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
150 return;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
151 }
1028
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
152 show_tch_record_status();
1029
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
153 show_tch_play_status();
1027
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
154 printf("TCH raw dump mode is %s\n",
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
155 tch_rawdump_mode ? "enabled" : "disabled");
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
156 }
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
157
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
158 void
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
159 cmd_tch_dispatch(argstr)
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
160 char *argstr;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
161 {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
162 char *argv[3];
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
163 int argc, rc;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
164
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
165 rc = parse_interactive_command_into_argv(argstr, argv, 1, 2, &argc);
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
166 if (rc < 0)
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
167 return;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
168 if (!strcmp(argv[0], "dump-raw")) {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
169 cmd_tch_dumpraw(argc, argv);
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
170 return;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
171 }
1029
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
172 if (!strcmp(argv[0], "play")) {
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
173 cmd_tch_play(argc, argv);
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
174 return;
333015c662bc fc-shell: tch play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1028
diff changeset
175 }
1028
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
176 if (!strcmp(argv[0], "record")) {
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
177 cmd_tch_record(argc, argv);
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
178 return;
71bbddbcc6a1 fc-shell: tch record implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 1027
diff changeset
179 }
1027
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
180 if (!strcmp(argv[0], "status")) {
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
181 cmd_tch_status(argc, argv);
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
182 return;
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
183 }
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
184 printf("error: invalid tch subcommand\n");
1178befeda76 fc-shell: tch command framework started
Mychaela Falconia <falcon@freecalypso.org>
parents: 1026
diff changeset
185 }