blob: c86f922154e1f895461cd3a545cb5e1343870cc9 [file] [log] [blame]
b.liu15f456b2024-10-31 20:16:06 +08001#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <errno.h>
5#include <sys/socket.h>
6#include <sys/un.h>
7#include <netinet/in.h>
8#include <pthread.h>
9#include <sys/epoll.h>
10#include <fcntl.h>
11#include <signal.h>
12
13#include "mbtk_type.h"
14#include "mbtk_ril.h"
15#include "atchannel.h"
16#include "at_tok.h"
17#include "mbtk_utils.h"
18#include "ril_info.h"
19
20static mbtk_ecall_mode_type_enum ecall_mode = MBTK_ECALL_MODE_TYPE_EU;
21
22void ril_rsp_pack_send(int fd, int ril_id, int msg_index, const void* data, int data_len);
23
b.liueea595d2024-11-05 19:52:10 +080024static int cfg_ecalldata_get(mbtk_ecall_cfg_item_enum type, uint32 *value, int *cme_err)
25{
26 ATResponse *response = NULL;
27 char *tmp_ptr = NULL;
28 int tmp_int;
29 char cmd[100] = {0};
30 int err = 0;
31
32 snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d", type);
33 err = at_send_command_singleline(cmd, "*ECALLDATA:", &response);
34
35 if (err < 0 || response->success == 0 || !response->p_intermediates){
36 *cme_err = at_get_cme_error(response);
37 goto exit;
38 }
39
40 char *line = response->p_intermediates->line;
41 err = at_tok_start(&line);
42 if (err < 0)
43 {
44 goto exit;
45 }
46
47 err = at_tok_nextint(&line, &tmp_int);
48 if (err < 0)
49 {
50 goto exit;
51 }
52
53 err = at_tok_nextint(&line, &tmp_int);
54 if (err < 0)
55 {
56 goto exit;
57 }
58
59 err = at_tok_nextint(&line, &tmp_int);
60 if (err < 0)
61 {
62 goto exit;
63 }
64
65 *value = (uint32)(tmp_int * 20); // ms
66
67 goto exit;
68exit:
69 at_response_free(response);
70 return err;
71}
72
73static int cfg_ecalldata_set(mbtk_ecall_cfg_item_enum type, uint32 value, int *cme_err)
74{
75 ATResponse *response = NULL;
76 char cmd[100] = {0};
77 int err = 0;
78
79 snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d,%d", type, value / 20);
80 err = at_send_command(cmd, &response);
81 if (err < 0 || response->success == 0){
82 *cme_err = at_get_cme_error(response);
83 goto exit;
84 }
85
86 goto exit;
87exit:
88 at_response_free(response);
89 return err;
90}
91
92static int cfg_ecalltimer_set(const char* type, uint32 value, int *cme_err)
93{
94 ATResponse *response = NULL;
95 char cmd[100] = {0};
96 int err = 0;
97
98 snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=%s,%d", type, value);
99 err = at_send_command(cmd, &response);
100 if (err < 0 || response->success == 0){
101 *cme_err = at_get_cme_error(response);
102 goto exit;
103 }
104
105 goto exit;
106exit:
107 at_response_free(response);
108 return err;
109}
110
b.liu15f456b2024-10-31 20:16:06 +0800111static int req_ecall_msdcfg(mbtk_ecall_msd_cfg_info_t *cfg_info, int *cme_err)
112{
113 ATResponse *response = NULL;
114 char cmd[1024] = {0};
115 sprintf(cmd, "AT*ECALLMSDCFG=%d,\"%s\",0", cfg_info->item_type, cfg_info->data);
116 int err = at_send_command(cmd, &response);
117 if (err < 0 || response->success == 0){
118 *cme_err = at_get_cme_error(response);
119 goto exit;
120 }
121
122exit:
123 at_response_free(response);
124 return err;
125}
126
127static int req_ecall_msdgen(int *cme_err)
128{
129 ATResponse *response = NULL;
130 int err = at_send_command("AT*ECALLMSDGEN", &response);
131 if (err < 0 || response->success == 0){
132 *cme_err = at_get_cme_error(response);
133 goto exit;
134 }
135
136exit:
137 at_response_free(response);
138 return err;
139}
140
141static int req_ecall_msd_set(const uint8 *msd, int *cme_err)
142{
143 ATResponse *response = NULL;
144 char cmd[1024] = {0};
145 sprintf(cmd, "AT*ECALLMSD=\"%s\"", msd);
146 int err = at_send_command(cmd, &response);
147 if (err < 0 || response->success == 0){
148 *cme_err = at_get_cme_error(response);
149 goto exit;
150 }
151
152exit:
153 at_response_free(response);
154 return err;
155}
156
157static int req_ecall_msd_get(uint8 *msd, int *cme_err)
158{
159 ATResponse *response = NULL;
160 char *tmp_ptr = NULL;
161 int err = at_send_command_singleline("AT*ECALLMSD?", "*ECALLMSD:", &response);
162
163 if (err < 0 || response->success == 0 || !response->p_intermediates){
164 *cme_err = at_get_cme_error(response);
165 goto exit;
166 }
167
168 char *line = response->p_intermediates->line;
169 err = at_tok_start(&line);
170 if (err < 0)
171 {
172 goto exit;
173 }
174
175 err = at_tok_nextstr(&line, &tmp_ptr);
176 if (err < 0)
177 {
178 goto exit;
179 }
180
181 if(tmp_ptr && strlen(tmp_ptr) > 0) {
182 memcpy(msd, tmp_ptr, strlen(tmp_ptr));
183 }
184
185 goto exit;
186exit:
187 at_response_free(response);
188 return err;
189}
190
191static int req_ecall_push(int *cme_err)
192{
193 ATResponse *response = NULL;
194 int err = at_send_command("AT*ECALLPUSH", &response);
195 if (err < 0 || response->success == 0){
196 *cme_err = at_get_cme_error(response);
197 goto exit;
198 }
199
200exit:
201 at_response_free(response);
202 return err;
203}
204
205/*
206AT*ECALLONLY?
207*ECALLONLY: 0,0,18981911691,18981911691
208
209OK
210
211*/
212static int req_ecall_only_get(mbtk_ecall_only_info_t *only_info, int *cme_err)
213{
214 ATResponse *response = NULL;
215 char *tmp_ptr = NULL;
216 int tmp_int;
217 int err = at_send_command_singleline("AT*ECALLONLY?", "*ECALLONLY:", &response);
218
219 if (err < 0 || response->success == 0 || !response->p_intermediates){
220 *cme_err = at_get_cme_error(response);
221 goto exit;
222 }
223
224 char *line = response->p_intermediates->line;
225 err = at_tok_start(&line);
226 if (err < 0)
227 {
228 goto exit;
229 }
230
231 err = at_tok_nextint(&line, &tmp_int);
232 if (err < 0)
233 {
234 goto exit;
235 }
236 only_info->active = (mbtk_ecall_only_type_enum)tmp_int;
237
238 err = at_tok_nextint(&line, &tmp_int);
239 if (err < 0)
240 {
241 goto exit;
242 }
243 only_info->sim_type = (mbtk_ecall_sim_type_enum)tmp_int;
244
245 err = at_tok_nextstr(&line, &tmp_ptr);
246 if (err < 0)
247 {
248 goto exit;
249 }
250
251 if(tmp_ptr && strlen(tmp_ptr) > 0) {
252 memcpy(only_info->test_num, tmp_ptr, strlen(tmp_ptr));
253 }
254
255 err = at_tok_nextstr(&line, &tmp_ptr);
256 if (err < 0)
257 {
258 goto exit;
259 }
260
261 if(tmp_ptr && strlen(tmp_ptr) > 0) {
262 memcpy(only_info->reconfig_num, tmp_ptr, strlen(tmp_ptr));
263 }
264
265 goto exit;
266exit:
267 at_response_free(response);
268 return err;
269}
270
271/*
272AT*ECALLONLY?
273*ECALLONLY: 0,0,18981911691,18981911691
274
275OK
276
277*/
278static int req_ecall_only_set(const mbtk_ecall_only_info_t *only_info, int *cme_err)
279{
280 ATResponse *response = NULL;
281 char cmd[1024] = {0};
282 sprintf(cmd, "AT*ECALLONLY=%d,%s,%s", only_info->active,only_info->test_num,only_info->reconfig_num);
283 int err = at_send_command(cmd, &response);
284 if (err < 0 || response->success == 0){
285 *cme_err = at_get_cme_error(response);
286 goto exit;
287 }
288
289exit:
290 at_response_free(response);
291 return err;
292}
293
294/*
295AT*ECALLREG=0/1
296
297*/
298static int req_ecall_reg_set(uint8 reg, int *cme_err)
299{
300 ATResponse *response = NULL;
301 char cmd[30] = {0};
302 sprintf(cmd, "AT*ECALLREG=%d", reg);
303 int err = at_send_command(cmd, &response);
304 if (err < 0 || response->success == 0){
305 *cme_err = at_get_cme_error(response);
306 goto exit;
307 }
308
309exit:
310 at_response_free(response);
311 return err;
312}
313
314/*
315AT+CECALL?
316+CECALL: 4
317
318OK
319
320*/
321static int req_ecall_dial_state_get(mbtk_ecall_dial_type_enum *type, int *cme_err)
322{
323 ATResponse *response = NULL;
324 int tmp_int;
325 int err = at_send_command_singleline("AT+CECALL?", "+CECALL:", &response);
326
327 if (err < 0 || response->success == 0 || !response->p_intermediates){
328 *cme_err = at_get_cme_error(response);
329 goto exit;
330 }
331
332 char *line = response->p_intermediates->line;
333 err = at_tok_start(&line);
334 if (err < 0)
335 {
336 goto exit;
337 }
338
339 err = at_tok_nextint(&line, &tmp_int);
340 if (err < 0)
341 {
342 goto exit;
343 }
344 *type = (mbtk_ecall_dial_type_enum)tmp_int;
345
346 goto exit;
347exit:
348 at_response_free(response);
349 return err;
350}
351
352/*
353AT+CECALL=<ecalltype>
354OK
355*/
356static int req_ecall_dial_start(mbtk_ecall_dial_type_enum type, int *cme_err)
357{
358 ATResponse *response = NULL;
359 char cmd[1024] = {0};
360 sprintf(cmd, "AT+CECALL=%d", type);
361 int err = at_send_command(cmd, &response);
362 if (err < 0 || response->success == 0){
363 *cme_err = at_get_cme_error(response);
364 goto exit;
365 }
366
367exit:
368 at_response_free(response);
369 return err;
370}
371
372
373/*
374AT*ECALLMODE?
375*ECALLMODE: "ERA"
376
377OK
378
379*/
380static int req_ecall_mode_get(mbtk_ecall_mode_type_enum *mode, int *cme_err)
381{
382 ATResponse *response = NULL;
383 char *tmp_ptr = NULL;
384 int err = at_send_command_singleline("AT*ECALLMODE?", "*ECALLMODE:", &response);
385
386 if (err < 0 || response->success == 0 || !response->p_intermediates){
387 *cme_err = at_get_cme_error(response);
388 goto exit;
389 }
390
391 char *line = response->p_intermediates->line;
392 err = at_tok_start(&line);
393 if (err < 0)
394 {
395 goto exit;
396 }
397
398 err = at_tok_nextstr(&line, &tmp_ptr);
399 if (err < 0)
400 {
401 goto exit;
402 }
403
404 if(tmp_ptr && strlen(tmp_ptr) > 0) {
405 if(strcmp(tmp_ptr, "ERA") == 0) {
406 *mode = MBTK_ECALL_MODE_TYPE_ERA;
407 } else {
408 *mode = MBTK_ECALL_MODE_TYPE_EU;
409 }
410
411 ecall_mode = *mode;
412 } else {
413 err = -1;
414 }
415
416 goto exit;
417exit:
418 at_response_free(response);
419 return err;
420}
421
422/*
423AT*ECALLMODE="ERA"
424OK
425
426*/
427static int req_ecall_mode_set(mbtk_ecall_mode_type_enum mode, int *cme_err)
428{
429 ATResponse *response = NULL;
430 char cmd[1024] = {0};
431 if(mode == MBTK_ECALL_MODE_TYPE_EU) {
432 sprintf(cmd, "AT*ECALLMODE=\"EU\"");
433 } else {
434 sprintf(cmd, "AT*ECALLMODE=\"ERA\"");
435 }
436 int err = at_send_command(cmd, &response);
437 if (err < 0 || response->success == 0){
438 *cme_err = at_get_cme_error(response);
439 goto exit;
440 }
441
442 ecall_mode = mode;
443
444exit:
445 at_response_free(response);
446 return err;
447}
448
449/*
450AT*ECALLDATA=5,2
451*ECALLDATA: 5,2,250
452
453OK
454
455AT*ECALLTIMER?
456*ECALLTIMER: ERA mode, callback timer: 1200s, dial setup timer: 30s, NAD deregister timer: 7200s, cleardown timer: 3600s, redial attempts count: 10, redial wait timer: 30s, smsprocess: 1, SMS resend timer: 3600s, sms msd send count: 10.
457
458OK
459
460*/
b.liueea595d2024-11-05 19:52:10 +0800461static int req_ecall_cfg_get(uint32 type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
b.liu15f456b2024-10-31 20:16:06 +0800462{
463 ATResponse *response = NULL;
464 char *tmp_ptr = NULL;
465 int tmp_int;
b.liu15f456b2024-10-31 20:16:06 +0800466 int err = 0;
467
468 cfg->type = type;
b.liu15f456b2024-10-31 20:16:06 +0800469
b.liueea595d2024-11-05 19:52:10 +0800470 if(type & MBTK_ECALL_CFG_T3) {
471 if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T3, &(cfg->data[MBTK_ECALL_CFG_ITEM_T3]), cme_err)
472 || *cme_err != MBTK_RIL_ERR_CME_NON)
473 {
474 goto exit;
475 }
b.liu15f456b2024-10-31 20:16:06 +0800476 }
477
b.liueea595d2024-11-05 19:52:10 +0800478 if(type & MBTK_ECALL_CFG_T5) {
479 if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T5, &(cfg->data[MBTK_ECALL_CFG_ITEM_T5]), cme_err)
480 || *cme_err != MBTK_RIL_ERR_CME_NON)
481 {
482 goto exit;
483 }
b.liu15f456b2024-10-31 20:16:06 +0800484 }
485
b.liueea595d2024-11-05 19:52:10 +0800486 if(type & MBTK_ECALL_CFG_T6) {
487 if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T6, &(cfg->data[MBTK_ECALL_CFG_ITEM_T6]), cme_err)
488 || *cme_err != MBTK_RIL_ERR_CME_NON)
489 {
490 goto exit;
491 }
b.liu15f456b2024-10-31 20:16:06 +0800492 }
493
b.liueea595d2024-11-05 19:52:10 +0800494 if(type & MBTK_ECALL_CFG_T7) {
495 if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T7, &(cfg->data[MBTK_ECALL_CFG_ITEM_T7]), cme_err)
496 || *cme_err != MBTK_RIL_ERR_CME_NON)
497 {
498 goto exit;
499 }
500 }
501
502 if(type & MBTK_ECALL_CFG_TH) {
503 if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_TH, &(cfg->data[MBTK_ECALL_CFG_ITEM_TH]), cme_err)
504 || *cme_err != MBTK_RIL_ERR_CME_NON)
505 {
506 goto exit;
507 }
508 }
509
510 if(type & (MBTK_ECALL_CFG_TIMER_CALLBACK | MBTK_ECALL_CFG_TIMER_CLEARDOWN | MBTK_ECALL_CFG_TIMER_DEREG
511 | MBTK_ECALL_CFG_TIMER_DIAL | MBTK_ECALL_CFG_TIMER_REDIAL | MBTK_ECALL_CFG_TIMER_SMS
512 | MBTK_ECALL_CFG_REDIALCNT | MBTK_ECALL_CFG_SMSPROCESS | MBTK_ECALL_CFG_SMSMSDCNT)) {
513 err = at_send_command_singleline("AT*ECALLTIMER?", "*ECALLTIMER:", &response);
514 if (err < 0 || response->success == 0 || !response->p_intermediates){
515 *cme_err = at_get_cme_error(response);
516 goto exit;
517 }
518
519 char *line = response->p_intermediates->line;
520 err = at_tok_start(&line);
b.liu15f456b2024-10-31 20:16:06 +0800521 if (err < 0)
522 {
523 goto exit;
524 }
525
b.liu15f456b2024-10-31 20:16:06 +0800526 // *ECALLTIMER: ERA mode, callback timer: 1200s,
527 // dial setup timer: 30s, NAD deregister timer: 7200s,
528 // cleardown timer: 3600s, redial attempts count: 10,
529 // redial wait timer: 30s, smsprocess: 1, SMS resend timer: 3600s,
530 // sms msd send count: 10.
531
532 if(strstr(line, "ERA mode") != NULL) {
533 ecall_mode = MBTK_ECALL_MODE_TYPE_ERA;
534 } else {
535 ecall_mode = MBTK_ECALL_MODE_TYPE_EU;
536 }
537
b.liueea595d2024-11-05 19:52:10 +0800538 if(type & MBTK_ECALL_CFG_TIMER_CALLBACK)
b.liu15f456b2024-10-31 20:16:06 +0800539 {
b.liueea595d2024-11-05 19:52:10 +0800540 if((tmp_ptr = strstr(line, "callback timer: ")) != NULL) {
541 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] = (uint32)atoi(tmp_ptr + 16); // s
542 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] *= 1000; // s -> ms
b.liu15f456b2024-10-31 20:16:06 +0800543 }
b.liueea595d2024-11-05 19:52:10 +0800544 }
545
546 if(type & MBTK_ECALL_CFG_TIMER_CLEARDOWN)
547 {
548 if((tmp_ptr = strstr(line, "cleardown timer: ")) != NULL) {
549 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] = (uint32)atoi(tmp_ptr + 17); // s
550 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] *= 1000; // s -> ms
b.liu15f456b2024-10-31 20:16:06 +0800551 }
b.liueea595d2024-11-05 19:52:10 +0800552 }
553
554 if(type & MBTK_ECALL_CFG_TIMER_DEREG)
555 {
556 if((tmp_ptr = strstr(line, "deregister timer: ")) != NULL) {
557 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] = (uint32)atoi(tmp_ptr + 18); // s
558 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] *= 1000; // s -> ms
b.liu15f456b2024-10-31 20:16:06 +0800559 }
b.liueea595d2024-11-05 19:52:10 +0800560 }
561
562 if(type & MBTK_ECALL_CFG_TIMER_DIAL)
563 {
564 if((tmp_ptr = strstr(line, "dial setup timer: ")) != NULL) {
565 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] = (uint32)atoi(tmp_ptr + 18); // s
566 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] *= 1000; // s -> ms
b.liu15f456b2024-10-31 20:16:06 +0800567 }
b.liueea595d2024-11-05 19:52:10 +0800568 }
569
570 if(type & MBTK_ECALL_CFG_TIMER_REDIAL)
571 {
572 if((tmp_ptr = strstr(line, "redial wait timer: ")) != NULL) {
573 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] = (uint32)atoi(tmp_ptr + 19); // s
574 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] *= 1000; // s -> ms
b.liu15f456b2024-10-31 20:16:06 +0800575 }
b.liueea595d2024-11-05 19:52:10 +0800576 }
577
578 if(type & MBTK_ECALL_CFG_TIMER_SMS)
579 {
580 if((tmp_ptr = strstr(line, "SMS resend timer: ")) != NULL) {
581 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] = (uint32)atoi(tmp_ptr + 18);
582 cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] *= 1000; // s -> ms
b.liu15f456b2024-10-31 20:16:06 +0800583 }
b.liueea595d2024-11-05 19:52:10 +0800584 }
585
586 if(type & MBTK_ECALL_CFG_REDIALCNT)
587 {
588 if((tmp_ptr = strstr(line, "redial attempts count: ")) != NULL) {
589 cfg->data[MBTK_ECALL_CFG_ITEM_REDIALCNT] = (uint32)atoi(tmp_ptr + 23);
b.liu15f456b2024-10-31 20:16:06 +0800590 }
b.liueea595d2024-11-05 19:52:10 +0800591 }
592
593 if(type & MBTK_ECALL_CFG_SMSPROCESS)
594 {
595 if((tmp_ptr = strstr(line, "smsprocess: ")) != NULL) {
596 cfg->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS] = (uint32)atoi(tmp_ptr + 12);
b.liu15f456b2024-10-31 20:16:06 +0800597 }
b.liueea595d2024-11-05 19:52:10 +0800598 }
599
600 if(type & MBTK_ECALL_CFG_SMSMSDCNT)
601 {
602 if((tmp_ptr = strstr(line, "sms msd send count: ")) != NULL) {
603 cfg->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT] = (uint32)atoi(tmp_ptr + 20);
b.liu15f456b2024-10-31 20:16:06 +0800604 }
b.liu15f456b2024-10-31 20:16:06 +0800605 }
606 }
607
608 goto exit;
609exit:
610 at_response_free(response);
611 return err;
612}
613
614/*
615AT*ECALLDATA=5,2,250
616OK
617
618AT*ECALLTIMER=dereg,300
619OK
620*/
621static int req_ecall_cfg_set(const mbtk_ecall_cfg_info_t *cfg_info, int *cme_err)
622{
b.liu15f456b2024-10-31 20:16:06 +0800623 int err = 0;
b.liu15f456b2024-10-31 20:16:06 +0800624 if(ecall_mode == MBTK_ECALL_MODE_TYPE_EU) {
b.liueea595d2024-11-05 19:52:10 +0800625 if((cfg_info->type & MBTK_ECALL_CFG_TIMER_REDIAL)
626 || (cfg_info->type & MBTK_ECALL_CFG_TIMER_SMS)
627 || (cfg_info->type & MBTK_ECALL_CFG_REDIALCNT)
628 || (cfg_info->type & MBTK_ECALL_CFG_SMSPROCESS)
629 || (cfg_info->type & MBTK_ECALL_CFG_SMSMSDCNT)){
b.liu15f456b2024-10-31 20:16:06 +0800630 LOGW("No support for EU.");
631 return -1;
632 }
633 }
634
b.liueea595d2024-11-05 19:52:10 +0800635 if(cfg_info->type & MBTK_ECALL_CFG_T3) {
636 if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T3, cfg_info->data[MBTK_ECALL_CFG_ITEM_T3], cme_err)
637 || *cme_err != MBTK_RIL_ERR_CME_NON)
b.liu15f456b2024-10-31 20:16:06 +0800638 {
b.liu15f456b2024-10-31 20:16:06 +0800639 goto exit;
b.liueea595d2024-11-05 19:52:10 +0800640 }
b.liu15f456b2024-10-31 20:16:06 +0800641 }
642
b.liueea595d2024-11-05 19:52:10 +0800643 if(cfg_info->type & MBTK_ECALL_CFG_T5) {
644 if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T5, cfg_info->data[MBTK_ECALL_CFG_ITEM_T5], cme_err)
645 || *cme_err != MBTK_RIL_ERR_CME_NON)
646 {
647 goto exit;
648 }
649 }
650
651 if(cfg_info->type & MBTK_ECALL_CFG_T6) {
652 if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T6, cfg_info->data[MBTK_ECALL_CFG_ITEM_T6], cme_err)
653 || *cme_err != MBTK_RIL_ERR_CME_NON)
654 {
655 goto exit;
656 }
657 }
658
659 if(cfg_info->type & MBTK_ECALL_CFG_T7) {
660 if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T7, cfg_info->data[MBTK_ECALL_CFG_ITEM_T7], cme_err)
661 || *cme_err != MBTK_RIL_ERR_CME_NON)
662 {
663 goto exit;
664 }
665 }
666
667 if(cfg_info->type & MBTK_ECALL_CFG_TH) {
668 if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_TH, cfg_info->data[MBTK_ECALL_CFG_ITEM_TH], cme_err)
669 || *cme_err != MBTK_RIL_ERR_CME_NON)
670 {
671 goto exit;
672 }
673 }
674
675 if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CALLBACK)
676 {
677 if(cfg_ecalltimer_set("callback", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] / 1000, cme_err)
678 || *cme_err != MBTK_RIL_ERR_CME_NON) {
679 goto exit;
680 }
681 }
682 if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CLEARDOWN)
683 {
684 if(cfg_ecalltimer_set("cleardown", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] / 1000, cme_err)
685 || *cme_err != MBTK_RIL_ERR_CME_NON) {
686 goto exit;
687 }
688 }
689 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_DEREG)
690 {
691 if(cfg_ecalltimer_set("dereg", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] / 1000, cme_err)
692 || *cme_err != MBTK_RIL_ERR_CME_NON) {
693 goto exit;
694 }
695 }
696 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_DIAL)
697 {
698 if(cfg_ecalltimer_set("dial", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] / 1000, cme_err)
699 || *cme_err != MBTK_RIL_ERR_CME_NON) {
700 goto exit;
701 }
702 }
703 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_REDIAL)
704 {
705 if(cfg_ecalltimer_set("redialtmr", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] / 1000, cme_err)
706 || *cme_err != MBTK_RIL_ERR_CME_NON) {
707 goto exit;
708 }
709 }
710 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_SMS)
711 {
712 if(cfg_ecalltimer_set("sms", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] / 1000, cme_err)
713 || *cme_err != MBTK_RIL_ERR_CME_NON) {
714 goto exit;
715 }
716 }
717 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_REDIALCNT)
718 {
719 if(cfg_ecalltimer_set("redialcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_REDIALCNT], cme_err)
720 || *cme_err != MBTK_RIL_ERR_CME_NON) {
721 goto exit;
722 }
723 }
724 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_SMSPROCESS)
725 {
726 if(cfg_ecalltimer_set("smsprocess", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS], cme_err)
727 || *cme_err != MBTK_RIL_ERR_CME_NON) {
728 goto exit;
729 }
730 }
731 if(cfg_info->type & MBTK_ECALL_CFG_ITEM_SMSMSDCNT)
732 {
733 if(cfg_ecalltimer_set("smsmsdcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT], cme_err)
734 || *cme_err != MBTK_RIL_ERR_CME_NON) {
735 goto exit;
736 }
b.liu15f456b2024-10-31 20:16:06 +0800737 }
738
739exit:
b.liu15f456b2024-10-31 20:16:06 +0800740 return err;
741}
742
743/*
744AT*ECALLMUTESPK=1
745OK
746
747*/
748static int req_ecall_spkmute_set(int mute, int *cme_err)
749{
750 ATResponse *response = NULL;
751 char cmd[100] = {0};
752 sprintf(cmd, "AT*ECALLMUTESPK=%d", mute);
753 int err = at_send_command(cmd, &response);
754 if (err < 0 || response->success == 0){
755 *cme_err = at_get_cme_error(response);
756 goto exit;
757 }
758
759exit:
760 at_response_free(response);
761 return err;
762}
763
764
765/*
766AT*ECALLSMSNUM?
767*ECALLSMSNUM: "18981991452"
768
769OK
770
771*/
772static int req_ecall_sms_num_get(uint8 *number, int *cme_err)
773{
774 ATResponse *response = NULL;
775 char *tmp_ptr = NULL;
776 int err = at_send_command_singleline("AT*ECALLSMSNUM?", "*ECALLSMSNUM:", &response);
777
778 if (err < 0 || response->success == 0 || !response->p_intermediates){
779 *cme_err = at_get_cme_error(response);
780 goto exit;
781 }
782
783 char *line = response->p_intermediates->line;
784 err = at_tok_start(&line);
785 if (err < 0)
786 {
787 goto exit;
788 }
789
790 err = at_tok_nextstr(&line, &tmp_ptr);
791 if (err < 0)
792 {
793 goto exit;
794 }
795
796 if(tmp_ptr && strlen(tmp_ptr) > 0) {
797 memcpy(number, tmp_ptr, strlen(tmp_ptr));
798 }
799
800 goto exit;
801exit:
802 at_response_free(response);
803 return err;
804}
805
806/*
807AT*ECALLSMSNUM=18981991452
808OK
809
810*/
811static int req_ecall_sms_num_set(const uint8 *number, int *cme_err)
812{
813 ATResponse *response = NULL;
814 char cmd[100] = {0};
815 sprintf(cmd, "AT*ECALLSMSNUM=%s", number);
816 int err = at_send_command(cmd, &response);
817 if (err < 0 || response->success == 0){
818 *cme_err = at_get_cme_error(response);
819 goto exit;
820 }
821
822exit:
823 at_response_free(response);
824 return err;
825}
826
827/*
828AT*AUDGAIN=8,1 // Set Rx voice gain = 8dB
829OK
830
831*/
832static int req_ecall_gain_set(mbtk_ecall_gain_info_t *gain, int *cme_err)
833{
834 ATResponse *response = NULL;
835 char cmd[100] = {0};
836 sprintf(cmd, "AT*AUDGAIN=%d,%d", gain->gain, gain->mode);
837 int err = at_send_command(cmd, &response);
838 if (err < 0 || response->success == 0){
839 *cme_err = at_get_cme_error(response);
840 goto exit;
841 }
842
843exit:
844 at_response_free(response);
845 return err;
846}
847
848//void net_list_free(void *data);
849// Return MBTK_INFO_ERR_SUCCESS,will call pack_error_send() to send RSP.
850// Otherwise, do not call pack_error_send().
851mbtk_ril_err_enum ecall_pack_req_process(sock_cli_info_t* cli_info, ril_msg_pack_info_t* pack)
852{
853 mbtk_ril_err_enum err = MBTK_RIL_ERR_SUCCESS;
854 int cme_err = MBTK_RIL_ERR_CME_NON;
855 switch(pack->msg_id)
856 {
857 case RIL_MSG_ID_ECALL_MSDCFG: // mbtk_ecall_msd_cfg_info_t
858 {
859 if(pack->data_len == 0 || pack->data == NULL)
860 {
861 err = MBTK_RIL_ERR_UNSUPPORTED;
862 }
863 else // Set
864 {
865 mbtk_ecall_msd_cfg_info_t *cfg_info = (mbtk_ecall_msd_cfg_info_t*)(pack->data);
866 if(req_ecall_msdcfg(cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
867 {
868 if(cme_err != MBTK_RIL_ERR_CME_NON) {
869 err = MBTK_RIL_ERR_CME + cme_err;
870 } else {
871 err = MBTK_RIL_ERR_UNKNOWN;
872 }
873 LOG("AT*ECALLMSDCFG fail.");
874 }
875 else
876 {
877 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
878 }
879 }
880 break;
881 }
882 case RIL_MSG_ID_ECALL_MSDGEN:
883 {
884 if(pack->data_len == 0 || pack->data == NULL)
885 {
886 if(req_ecall_msdgen(&cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
887 {
888 if(cme_err != MBTK_RIL_ERR_CME_NON) {
889 err = MBTK_RIL_ERR_CME + cme_err;
890 } else {
891 err = MBTK_RIL_ERR_UNKNOWN;
892 }
893 LOG("AT*ECALLMSDGEN fail.");
894 }
895 else
896 {
897 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
898 }
899 }
900 else // Set
901 {
902 err = MBTK_RIL_ERR_UNSUPPORTED;
903 }
904 break;
905 }
906 case RIL_MSG_ID_ECALL_MSD: // uint8[]
907 {
908 uint8 msd[MBTK_ECALL_MSD_LEN_MAX];
909 memset(msd, 0, sizeof(msd));
910 if(pack->data_len == 0 || pack->data == NULL)
911 {
912 if(req_ecall_msd_get(msd, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
913 {
914 if(cme_err != MBTK_RIL_ERR_CME_NON) {
915 err = MBTK_RIL_ERR_CME + cme_err;
916 } else {
917 err = MBTK_RIL_ERR_UNKNOWN;
918 }
919 LOG("Get MSD fail.");
920 }
921 else
922 {
923 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, msd, strlen(msd));
924 }
925 }
926 else // Set
927 {
928 memcpy(msd, pack->data, pack->data_len);
929 if(req_ecall_msd_set(msd, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
930 {
931 if(cme_err != MBTK_RIL_ERR_CME_NON) {
932 err = MBTK_RIL_ERR_CME + cme_err;
933 } else {
934 err = MBTK_RIL_ERR_UNKNOWN;
935 }
936 LOG("AT*ECALLMSD fail.");
937 }
938 else
939 {
940 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
941 }
942 }
943 break;
944 }
945 case RIL_MSG_ID_ECALL_PUSH:
946 {
947 if(pack->data_len == 0 || pack->data == NULL)
948 {
949 if(req_ecall_push(&cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
950 {
951 if(cme_err != MBTK_RIL_ERR_CME_NON) {
952 err = MBTK_RIL_ERR_CME + cme_err;
953 } else {
954 err = MBTK_RIL_ERR_UNKNOWN;
955 }
956 LOG("AT*ECALLPUSH fail.");
957 }
958 else
959 {
960 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
961 }
962 }
963 else // Set
964 {
965 err = MBTK_RIL_ERR_UNSUPPORTED;
966 }
967 break;
968 }
969 case RIL_MSG_ID_ECALL_ONLY: // mbtk_ecall_only_info_t
970 {
971 if(pack->data_len == 0 || pack->data == NULL)
972 {
973 mbtk_ecall_only_info_t only_info;
974 memset(&only_info, 0, sizeof(mbtk_ecall_only_info_t));
975 if(req_ecall_only_get(&only_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
976 {
977 if(cme_err != MBTK_RIL_ERR_CME_NON) {
978 err = MBTK_RIL_ERR_CME + cme_err;
979 } else {
980 err = MBTK_RIL_ERR_UNKNOWN;
981 }
982 LOG("Get ecall only mode fail.");
983 }
984 else
985 {
986 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, &only_info, sizeof(mbtk_ecall_only_info_t));
987 }
988 }
989 else // Set
990 {
991 mbtk_ecall_only_info_t *only_info = (mbtk_ecall_only_info_t*)(pack->data);
992 if(req_ecall_only_set(only_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
993 {
994 if(cme_err != MBTK_RIL_ERR_CME_NON) {
995 err = MBTK_RIL_ERR_CME + cme_err;
996 } else {
997 err = MBTK_RIL_ERR_UNKNOWN;
998 }
999 LOG("AT*ECALLONLY fail.");
1000 }
1001 else
1002 {
1003 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1004 }
1005 }
1006 break;
1007 }
1008 case RIL_MSG_ID_ECALL_REG: // reg <uint8>
1009 {
1010 if(pack->data_len == 0 || pack->data == NULL)
1011 {
1012 err = MBTK_RIL_ERR_UNSUPPORTED;
1013 }
1014 else
1015 {
1016 uint8 reg = pack->data[0];
1017 if(req_ecall_reg_set(reg, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1018 {
1019 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1020 err = MBTK_RIL_ERR_CME + cme_err;
1021 } else {
1022 err = MBTK_RIL_ERR_UNKNOWN;
1023 }
1024 LOG("ecall reg(%d) fail.", reg);
1025 }
1026 else
1027 {
1028 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1029 }
1030 }
1031 break;
1032 }
1033 case RIL_MSG_ID_ECALL_DIAL: // mbtk_ecall_dial_type_enum
1034 {
1035 if(pack->data_len == 0 || pack->data == NULL)
1036 {
1037 mbtk_ecall_dial_type_enum type;
1038 if(req_ecall_dial_state_get(&type, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1039 {
1040 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1041 err = MBTK_RIL_ERR_CME + cme_err;
1042 } else {
1043 err = MBTK_RIL_ERR_UNKNOWN;
1044 }
1045 LOG("Get ecall type fail.");
1046 }
1047 else
1048 {
1049 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, &type, sizeof(uint8));
1050 }
1051 }
1052 else
1053 {
1054 mbtk_ecall_dial_type_enum type = (mbtk_ecall_dial_type_enum)pack->data[0];
1055 if(req_ecall_dial_start(type, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1056 {
1057 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1058 err = MBTK_RIL_ERR_CME + cme_err;
1059 } else {
1060 err = MBTK_RIL_ERR_UNKNOWN;
1061 }
1062 LOG("Start ecall %d fail.", type);
1063 }
1064 else
1065 {
1066 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1067 }
1068 }
1069 break;
1070 }
1071 case RIL_MSG_ID_ECALL_MODE: // mbtk_ecall_cfg_item_enum / mbtk_ecall_cfg_info_t
1072 {
1073 if(pack->data_len == 0 || pack->data == NULL)
1074 {
1075 mbtk_ecall_mode_type_enum mode;
1076 if(req_ecall_mode_get(&mode, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1077 {
1078 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1079 err = MBTK_RIL_ERR_CME + cme_err;
1080 } else {
1081 err = MBTK_RIL_ERR_UNKNOWN;
1082 }
1083 LOG("Get ecall mode fail.");
1084 }
1085 else
1086 {
1087 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, &mode, sizeof(uint8));
1088 }
1089 }
1090 else
1091 {
1092 mbtk_ecall_mode_type_enum mode = (mbtk_ecall_mode_type_enum)pack->data[0];
1093 if(req_ecall_mode_set(mode, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1094 {
1095 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1096 err = MBTK_RIL_ERR_CME + cme_err;
1097 } else {
1098 err = MBTK_RIL_ERR_UNKNOWN;
1099 }
1100 LOG("Set ecall mode %d fail.", mode);
1101 }
1102 else
1103 {
1104 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1105 }
1106 }
1107 break;
1108 }
1109 case RIL_MSG_ID_ECALL_CFG: // mbtk_ecall_cfg_item_enum / mbtk_ecall_cfg_info_t
1110 {
1111 if(pack->data_len == 0 || pack->data == NULL)
1112 {
1113 err = MBTK_RIL_ERR_UNSUPPORTED;
1114 }
1115 else
1116 {
1117 if(pack->data_len == sizeof(mbtk_ecall_cfg_info_t)) { // Set
1118 mbtk_ecall_cfg_info_t *cfg_info = (mbtk_ecall_cfg_info_t*)pack->data;
1119 if(req_ecall_cfg_set(cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1120 {
1121 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1122 err = MBTK_RIL_ERR_CME + cme_err;
1123 } else {
1124 err = MBTK_RIL_ERR_UNKNOWN;
1125 }
b.liueea595d2024-11-05 19:52:10 +08001126 LOG("Set ecall config[%x] fail.", cfg_info->type);
b.liu15f456b2024-10-31 20:16:06 +08001127 }
1128 else
1129 {
1130 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1131 }
1132 } else { // Get
1133 mbtk_ecall_cfg_info_t cfg_info;
1134 memset(&cfg_info, 0, sizeof(mbtk_ecall_cfg_info_t));
b.liueea595d2024-11-05 19:52:10 +08001135 uint32 *type = (uint32*)(pack->data);
1136 if(req_ecall_cfg_get(*type, &cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
b.liu15f456b2024-10-31 20:16:06 +08001137 {
1138 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1139 err = MBTK_RIL_ERR_CME + cme_err;
1140 } else {
1141 err = MBTK_RIL_ERR_UNKNOWN;
1142 }
b.liueea595d2024-11-05 19:52:10 +08001143 LOG("Get ecall config[%x] fail.", *type);
b.liu15f456b2024-10-31 20:16:06 +08001144 }
1145 else
1146 {
1147 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, &cfg_info, sizeof(mbtk_ecall_cfg_info_t));
1148 }
1149 }
1150 }
1151 break;
1152 }
1153 case RIL_MSG_ID_ECALL_SMS_NUM: // uint8[]
1154 {
1155 uint8 number[RIL_MAX_NUMBER_LEN];
1156 memset(number, 0, sizeof(number));
1157 if(pack->data_len == 0 || pack->data == NULL)
1158 {
1159 if(req_ecall_sms_num_get(number, &cme_err) || strlen(number) == 0 || cme_err != MBTK_RIL_ERR_CME_NON)
1160 {
1161 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1162 err = MBTK_RIL_ERR_CME + cme_err;
1163 } else {
1164 err = MBTK_RIL_ERR_UNKNOWN;
1165 }
1166 LOG("Get ecall sms number fail.");
1167 }
1168 else
1169 {
1170 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, number, strlen(number));
1171 }
1172 }
1173 else // Set
1174 {
1175 memcpy(number, pack->data, pack->data_len);
1176 if(req_ecall_sms_num_set(number, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1177 {
1178 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1179 err = MBTK_RIL_ERR_CME + cme_err;
1180 } else {
1181 err = MBTK_RIL_ERR_UNKNOWN;
1182 }
1183 LOG("Set ecall sms number fail.");
1184 }
1185 else
1186 {
1187 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1188 }
1189 }
1190 break;
1191 }
1192 case RIL_MSG_ID_ECALL_MUTESPK:
1193 {
1194 if(pack->data_len == 0 || pack->data == NULL)
1195 {
1196 err = MBTK_RIL_ERR_UNSUPPORTED;
1197 }
1198 else // Set mute state.
1199 {
1200 uint8 mute = pack->data[0];
1201 if(pack->data_len != sizeof(uint8) || (mute != 0 && mute != 1))
1202 {
1203 err = MBTK_RIL_ERR_REQ_PARAMETER;
1204 LOG("Set spk mute parameter error.");
1205 break;
1206 }
1207
1208 if(req_ecall_spkmute_set(mute, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1209 {
1210 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1211 err = MBTK_RIL_ERR_CME + cme_err;
1212 } else {
1213 err = MBTK_RIL_ERR_UNKNOWN;
1214 }
1215 LOG("Set spk mute state fail.");
1216 }
1217 else
1218 {
1219 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1220 }
1221 }
1222 break;
1223 }
1224 case RIL_MSG_ID_ECALL_DSP_GAIN: // mbtk_ecall_gain_info_t
1225 {
1226 if(pack->data_len == 0 || pack->data == NULL)
1227 {
1228 err = MBTK_RIL_ERR_UNSUPPORTED;
1229 }
1230 else // Set
1231 {
1232 mbtk_ecall_gain_info_t *gain_info = (mbtk_ecall_gain_info_t *)pack->data;
1233 if(req_ecall_gain_set(gain_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
1234 {
1235 if(cme_err != MBTK_RIL_ERR_CME_NON) {
1236 err = MBTK_RIL_ERR_CME + cme_err;
1237 } else {
1238 err = MBTK_RIL_ERR_UNKNOWN;
1239 }
1240 LOGE("Set ecall gain fail.");
1241 }
1242 else
1243 {
1244 ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
1245 }
1246 }
1247 break;
1248 }
1249 default:
1250 {
1251 err = MBTK_RIL_ERR_REQ_UNKNOWN;
1252 LOG("Unknown request : %s", id2str(pack->msg_id));
1253 break;
1254 }
1255 }
1256
1257 return err;
1258}
1259
1260
1261