blob: 537ccdfe5ffa77ac86b5c089b4544e573ab3667e [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#define _GNU_SOURCE /**/
2
3#include <string.h>
4#include <stdio.h>
5#include <stdarg.h>
6#include <stdlib.h>
7#include <time.h>
8#include <syslog.h>
9#include <unistd.h>
10#include <errno.h>
11#include <signal.h>
12#include <netdb.h>
13#include <sys/types.h>
14#include <sys/ioctl.h>
15#include <sys/socket.h>
16#include <sys/time.h>
17#include <sys/uio.h>
18#include <sys/stat.h>
19#include <fcntl.h>
20#include <sys/sysctl.h>
21#include <net/if.h>
22#include <poll.h>
23#include <stddef.h>
24#include <linux/if_packet.h>
25#include <netinet/ether.h>
26#include <netinet/if_ether.h>
27#include <arpa/inet.h>
28#include <pthread.h>
29#include <zte_mifi.h>
30#include "softap_api.h"
31
32void nvserver_entry(void)
33{
34 nvserver_main(0,NULL);
35 return;
36}
37
38void at_ctl_entry(char *arg)
39{
40 //printf("at_ctl_entry boot:%s\n", arg);
41 char *argv[2];
42 argv[0] = NULL;
43 argv[1] = arg;
44
45 at_ctl_main(2, argv);
46 return;
47}
48
49void rtc_service_entry(char *arg)
50{
51 rtc_service_main(0,NULL);
52 return;
53}
54
55void zte_mainctrl_entry(char *arg)
56{
57 if (0 == strcmp(arg, "2")) {
58 char *argv[2];
59 argv[0] = NULL;
60 argv[1] = "poweroff_charger";
61
62 zte_mainctrl_main(2, argv);
63 } else {
64 zte_mainctrl_main(0,NULL);
65 }
66
67 return;
68}
69
70void zte_hotplug_entry(char *arg)
71{
72 zte_hotplug_main(0,NULL);
73 return;
74}
75/*
76void zte_audio_res_ctrl_entry(char *arg)
77{
78 zte_audio_res_ctrl_main(0,NULL);
79 return;
80}
81*/
82void zte_drv_serial_ctrl_entry(char *arg)
83{
84 zte_drv_serial_ctrl_main();
85 return;
86}
87
88void zte_drv_usb_ctrl_entry(char *arg)
89{
90 if(arg)
91 zte_drv_usb_ctrl_main(3,NULL);
92 else
93 zte_drv_usb_ctrl_main(0,NULL);
94 return;
95}
96
97void zte_mmi_entry(char *arg)
98{
99 //printf("zte_mmi_entry boot:%s\n", arg);
100 if (0 == strcmp(arg, "2")) {
101 char *argv[2];
102 argv[0] = NULL;
103 argv[1] = "poweroff_charger";
104
105 zte_mmi_main(2, argv);
106 } else {
107 zte_mmi_main(0,NULL);
108 }
109 return;
110}
111
112void zte_locknet_entry(char *arg)
113{
114 zte_locknet_main(0,NULL);
115 //return; //klocwork
116}
117
118void zte_watchdog_entry(char *arg)
119{
120 zte_watchdog_main(0,NULL);
121 return;
122}
123
124void fluxstat_entry(char *arg)
125{
126 fluxstat_main(0,NULL);
127 return;
128}
129
130void sntp_entry(char *arg)
131{
132 sntp_main(0,NULL);
133 return;
134}
135
136void sd_hotplug_entry(char *arg)
137{
138 sd_hotplug_main(0,NULL);
139 return;
140}
141
142void sms_entry(char *arg)
143{
144 sms_main(0,NULL);
145}
146/*
147void phonebook_entry(char *arg)
148{
149 phonebook_main(0,NULL);
150 return;
151}
152*/
153
154void wlan_entry(char *arg)
155{
156 wlan_main(0,NULL);
157 return;
158}
159
160void fota_dm_entry(char *arg)
161{
162 fota_dm_main(0,NULL);
163}
164
165
166int main(int argc, char *argv[])
167{
168 int ret = 0;
169 /* nvserver */
170 pthread_t nvserver_thread_tid;
171 pthread_create(&nvserver_thread_tid, NULL, (void *)nvserver_entry, NULL);
172
173 /* zte_hotplug */
174 pthread_t zte_hotplug_thread_tid;
175 pthread_create(&zte_hotplug_thread_tid, NULL, (void *)zte_hotplug_entry, NULL);
176
177 /* zte_drv_serial_ctrl */
178 pthread_t zte_drv_serial_ctrl_thread_tid;
179 pthread_create(&zte_drv_serial_ctrl_thread_tid, NULL, (void *)zte_drv_serial_ctrl_entry, NULL);
180 if (0 == strcmp(argv[2], "amt")) {
181 ret = sc_cfg_set("ver_mode", "0");
182 if(ret < 0)
183 printf("zte_mifi set vermode fail\n");
184 else
185 sc_cfg_save();
186 printf("---set ver mode to 0\n");
187 }
188 /* zte_drv_usb_ctrl */
189 pthread_t zte_drv_usb_ctrl_thread_tid;
190
191 if (0 != strcmp(argv[2], "amt")) { //³äµç»òÕý³£¿ª»úģʽ
192 char LanEnable[10] = {0};
193 /* at_ctl */
194 pthread_t at_ctl_thread_tid;
195 pthread_create(&at_ctl_thread_tid, NULL, (void *)at_ctl_entry, argv[1]);
196 /* rtc_service */
197 pthread_t rtc_service_thread_tid;
198 pthread_create(&rtc_service_thread_tid, NULL, (void *)rtc_service_entry, NULL);
199 /* zte_mainctrl */
200 pthread_t zte_mainctrl_thread_tid;
201 pthread_create(&zte_mainctrl_thread_tid, NULL, (void *)zte_mainctrl_entry, argv[1]);
202
203 /* zte_audio_res_ctrl */
204 /*
205 pthread_t zte_audio_res_ctrl_thread_tid;
206 pthread_create(&zte_audio_res_ctrl_thread_tid, NULL, (void *)zte_audio_res_ctrl_entry, NULL);
207 */
208
209 sc_cfg_get("LanEnable", LanEnable, sizeof(LanEnable));
210 if(atoi(LanEnable) == 1) { //mifiÐÎ̬
211 /* zte_mmi */
212 pthread_t zte_mmi_thread_tid;
213 pthread_create(&zte_mmi_thread_tid, NULL, (void *)zte_mmi_entry, argv[1]);
214 }
215
216 if(0 != strcmp(argv[1], "2")){
217 pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, NULL);
218
219 if(atoi(LanEnable) == 1) { //mifiÐÎ̬
220 /* zte_locknet */
221 pthread_t zte_locknet_thread_tid;
222 pthread_create(&zte_locknet_thread_tid, NULL, (void *)zte_locknet_entry, NULL);
223 /* fluxstat */
224
225
226 pthread_t fluxstat_thread_tid;
227 pthread_create(&fluxstat_thread_tid, NULL, (void *)fluxstat_entry, NULL);
228 /* sntp */
229 pthread_t sntp_thread_tid;
230 pthread_create(&sntp_thread_tid, NULL, (void *)sntp_entry, NULL);
231 /* sd_hotplug */
232 //pthread_t sd_hotplug_thread_tid;
233 //pthread_create(&sd_hotplug_thread_tid, NULL, (void *)sd_hotplug_entry, NULL);
234 sd_hotplug_init();
235 /* sms */
236 pthread_t sms_thread_tid;
237 pthread_create(&sms_thread_tid, NULL, (void *)sms_entry, NULL);
238 /* phonebook */
239 /*
240 //NV_NEED_SUPPORT_PB
241 pthread_t phonebook_thread_tid;
242 pthread_create(&phonebook_thread_tid, NULL, (void *)phonebook_entry, NULL);
243 */
244 /* wifi_manager */
245 pthread_t wlan_thread_tid;
246 pthread_create(&wlan_thread_tid, NULL, (void *)wlan_entry, NULL);
247
248 }
249
250 /* fota_dm */
251 pthread_t fota_dm_thread_tid;
252 pthread_create(&fota_dm_thread_tid, NULL, (void *)fota_dm_entry, NULL);
253 }else{
254 pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, "poweroff_charger");
255 }
256
257
258 /* zte_watchdog */
259 pthread_t zte_watchdog_thread_tid;
260 pthread_create(&zte_watchdog_thread_tid, NULL, (void *)zte_watchdog_entry, NULL);
261 }
262 else
263 {
264 pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, NULL);
265 }
266
267
268 while(1)
269 {
270 sleep(20);
271 //printf("zte app test -1 \n");
272 }
273
274 return 0;
275}
276