blob: 914efd65102596f59747b11662399d0d42cc1250 [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_ufi.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
160#ifndef FOTA_DISABLE
161void fota_dm_entry(char *arg)
162{
163 fota_dm_main(0,NULL);
164}
165#endif
166
167int main(int argc, char *argv[])
168{
169 int ret = 0;
170 /* nvserver */
171 pthread_t nvserver_thread_tid;
172 pthread_create(&nvserver_thread_tid, NULL, (void *)nvserver_entry, NULL);
173
174 /* zte_hotplug */
175 pthread_t zte_hotplug_thread_tid;
176 pthread_create(&zte_hotplug_thread_tid, NULL, (void *)zte_hotplug_entry, NULL);
177
178 /* zte_drv_serial_ctrl */
179 pthread_t zte_drv_serial_ctrl_thread_tid;
180 pthread_create(&zte_drv_serial_ctrl_thread_tid, NULL, (void *)zte_drv_serial_ctrl_entry, NULL);
181 if (0 == strcmp(argv[2], "amt")) {
182 ret = sc_cfg_set("ver_mode", "0");
183 if(ret < 0)
184 printf("zte_ufi set vermode fail\n");
185 else
186 sc_cfg_save();
187 printf("---set ver mode to 0\n");
188 }
189 /* zte_drv_usb_ctrl */
190 pthread_t zte_drv_usb_ctrl_thread_tid;
191
192 if (0 != strcmp(argv[2], "amt")) { //³äµç»òÕý³£¿ª»úģʽ
193 char LanEnable[10] = {0};
194 /* at_ctl */
195 pthread_t at_ctl_thread_tid;
196 pthread_create(&at_ctl_thread_tid, NULL, (void *)at_ctl_entry, argv[1]);
197 /* rtc_service */
198 pthread_t rtc_service_thread_tid;
199 pthread_create(&rtc_service_thread_tid, NULL, (void *)rtc_service_entry, NULL);
200 /* zte_mainctrl */
201 pthread_t zte_mainctrl_thread_tid;
202 pthread_create(&zte_mainctrl_thread_tid, NULL, (void *)zte_mainctrl_entry, argv[1]);
203
204 /* zte_audio_res_ctrl */
205 /*
206 pthread_t zte_audio_res_ctrl_thread_tid;
207 pthread_create(&zte_audio_res_ctrl_thread_tid, NULL, (void *)zte_audio_res_ctrl_entry, NULL);
208 */
209
210 sc_cfg_get("LanEnable", LanEnable, sizeof(LanEnable));
211 if(atoi(LanEnable) == 1) { //mifiÐÎ̬
212 /* zte_mmi */
213 pthread_t zte_mmi_thread_tid;
214 pthread_create(&zte_mmi_thread_tid, NULL, (void *)zte_mmi_entry, argv[1]);
215 }
216
217 //if(0 != strcmp(argv[1], "2")){
218 pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, NULL);
219
220 if(atoi(LanEnable) == 1) { //mifiÐÎ̬
221 /* zte_locknet */
222 //pthread_t zte_locknet_thread_tid;
223 //pthread_create(&zte_locknet_thread_tid, NULL, (void *)zte_locknet_entry, NULL);
224 /* fluxstat */
225
226
227 pthread_t fluxstat_thread_tid;
228 pthread_create(&fluxstat_thread_tid, NULL, (void *)fluxstat_entry, NULL);
229 /* sntp */
230 pthread_t sntp_thread_tid;
231 pthread_create(&sntp_thread_tid, NULL, (void *)sntp_entry, NULL);
232 /* sd_hotplug */
233 //pthread_t sd_hotplug_thread_tid;
234 //pthread_create(&sd_hotplug_thread_tid, NULL, (void *)sd_hotplug_entry, NULL);
235 //sd_hotplug_init();
236 /* sms */
237 pthread_t sms_thread_tid;
238 pthread_create(&sms_thread_tid, NULL, (void *)sms_entry, NULL);
239 /* phonebook */
240 /*
241 //NV_NEED_SUPPORT_PB
242 pthread_t phonebook_thread_tid;
243 pthread_create(&phonebook_thread_tid, NULL, (void *)phonebook_entry, NULL);
244 */
245 /* wifi_manager */
246 pthread_t wlan_thread_tid;
247 pthread_create(&wlan_thread_tid, NULL, (void *)wlan_entry, NULL);
248
249 }
250#ifndef FOTA_DISABLE
251 /* fota_dm */
252 pthread_t fota_dm_thread_tid;
253 pthread_create(&fota_dm_thread_tid, NULL, (void *)fota_dm_entry, NULL);
254#endif
255/* }else{
256 pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, "poweroff_charger");
257 }*/
258
259
260 /* zte_watchdog */
261 //pthread_t zte_watchdog_thread_tid;
262 //pthread_create(&zte_watchdog_thread_tid, NULL, (void *)zte_watchdog_entry, NULL);
263 }
264 else
265 {
266 pthread_create(&zte_drv_usb_ctrl_thread_tid, NULL, (void *)zte_drv_usb_ctrl_entry, NULL);
267 }
268
269
270 while(1)
271 {
272 sleep(20);
273 //printf("zte app test -1 \n");
274 }
275
276 return 0;
277}
278