jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <string.h> |
| 4 | #include <sys/types.h> |
| 5 | #include <sys/stat.h> |
| 6 | #include <fcntl.h> |
| 7 | #include <errno.h> |
| 8 | #include <pthread.h> |
jb.qi | e7aac6d | 2023-12-28 01:32:19 -0800 | [diff] [blame] | 9 | #include <unistd.h> |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 10 | #include <cutils/uevent.h> |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 11 | |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 12 | #include <lynq_autosuspend.h> |
| 13 | #include "lynq-qser-autosuspend.h" |
| 14 | #include "liblog/lynq_deflog.h" |
jb.qi | 422ee11 | 2023-11-21 03:04:03 -0800 | [diff] [blame] | 15 | #include "sc_mnet_whitelist.h" |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | extern int lynq_autosleep_enable(void); |
| 23 | extern int lynq_autosleep_disable(void); |
| 24 | extern int release_wake_lock(char *name); |
| 25 | extern int acquire_wake_lock(int lock, char *name); |
| 26 | |
| 27 | #define USER_LOG_TAG "LYNQ_QSER_AUTOSUSPEND" |
| 28 | #define FILE_LOCK_TABLE "/tmp/.lock_table" |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 29 | #define UEVENT_MSG_LEN 128 |
| 30 | |
jb.qi | e7aac6d | 2023-12-28 01:32:19 -0800 | [diff] [blame] | 31 | int device_fd; |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 32 | |
| 33 | struct dtr_uevent { |
| 34 | const char *action; |
| 35 | const char *path; |
| 36 | const char *subsystem; |
| 37 | const char *usbevent; |
| 38 | }; |
| 39 | |
| 40 | static void parse_event(const char *msg, struct dtr_uevent *dtr_uevent); |
| 41 | |
| 42 | |
| 43 | qser_lpm_Handler_t g_lpm_handler = NULL; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 44 | |
| 45 | |
| 46 | LOCK_TABLE lock_status; |
| 47 | |
| 48 | |
| 49 | int file_fd; |
| 50 | int first_run = 0; |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 51 | pthread_t thid; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 52 | |
| 53 | |
| 54 | int lock_table_init(void) |
| 55 | { |
| 56 | int ret; |
| 57 | int err; |
| 58 | |
| 59 | file_fd = open(FILE_LOCK_TABLE, O_RDWR| O_CREAT,0777); |
| 60 | if(file_fd < 0) |
| 61 | { |
| 62 | err = errno; |
| 63 | LYINFLOG("Error open lock_table file:%s\n", strerror(errno)); |
| 64 | return -err; |
| 65 | } |
| 66 | memset(&lock_status, 0, sizeof(lock_status)); |
| 67 | ret = write(file_fd, (char*)&lock_status, sizeof(lock_status)); |
| 68 | if(ret <= 0) |
| 69 | { |
| 70 | LYINFLOG("write fail\n"); |
| 71 | close(file_fd); |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 72 | return E_WRITE; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 73 | } |
| 74 | sync(); |
| 75 | close(file_fd); |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | int read_lock_table(void) |
| 81 | { |
| 82 | int err; |
| 83 | int ret; |
| 84 | int i; |
| 85 | LYLOGSET(LOG_INFO); |
| 86 | LYLOGEINIT(USER_LOG_TAG); |
| 87 | |
| 88 | if(access(FILE_LOCK_TABLE,0) < 0) |
| 89 | { |
| 90 | ret = lock_table_init(); |
| 91 | if(ret < 0) |
| 92 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 93 | return E_READ; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 94 | } |
| 95 | } |
| 96 | |
| 97 | file_fd = open(FILE_LOCK_TABLE,O_RDWR); |
| 98 | if(file_fd < 0) |
| 99 | { |
| 100 | err = errno; |
| 101 | LYINFLOG("Error open lock_table file:%s\n", strerror(errno)); |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 102 | return E_READ; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | memset(&lock_status, 0, sizeof(lock_status)); |
| 106 | lseek(file_fd,0,SEEK_SET); |
| 107 | ret = read(file_fd,(unsigned char *)&lock_status,sizeof(lock_status)); |
| 108 | LYINFLOG("read ret=%d\n", ret); |
| 109 | if(ret <= 0) |
| 110 | { |
| 111 | close(file_fd); |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 112 | return E_READ; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | for(i=0;i<MAX_LOCK_NUM;i++) |
| 116 | { |
| 117 | if(strlen(lock_status.lock_name[i]) != 0) |
| 118 | { |
| 119 | LYINFLOG("fd: %d lock_name:%s strlen:%d\n", i, lock_status.lock_name[i], strlen(lock_status.lock_name[i])); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | close(file_fd); |
| 124 | return 0; |
| 125 | } |
| 126 | |
| 127 | |
| 128 | int save_lock_table(void) |
| 129 | { |
| 130 | int err; |
| 131 | int ret; |
| 132 | file_fd = open(FILE_LOCK_TABLE,O_RDWR); |
| 133 | if(file_fd < 0) |
| 134 | { |
| 135 | err = errno; |
| 136 | LYINFLOG("Error open lock_table file:%s\n", strerror(errno)); |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 137 | return E_WRITE; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 138 | } |
| 139 | LYINFLOG("write lock_name[0]: %s\n", lock_status.lock_name[0]); |
| 140 | ret = write(file_fd, (unsigned char *)&lock_status, sizeof(lock_status)); |
| 141 | LYINFLOG("write ret=%d\n", ret); |
| 142 | if(ret <= 0) |
| 143 | { |
| 144 | LYINFLOG("write fail\n"); |
| 145 | close(file_fd); |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 146 | return E_WRITE; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 147 | } |
| 148 | sync(); |
| 149 | close(file_fd); |
| 150 | |
| 151 | return 0; |
| 152 | } |
| 153 | |
| 154 | |
| 155 | int check_lock(char *name) |
| 156 | { |
| 157 | int j; |
| 158 | int num; |
| 159 | for(j=0;j<MAX_LOCK_NUM;j++) |
| 160 | { |
| 161 | if(strcmp(lock_status.lock_name[j], name) == 0) |
| 162 | { |
| 163 | num = j; |
| 164 | break; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | if(j < MAX_LOCK_NUM) |
| 169 | { |
| 170 | return num; |
| 171 | } |
| 172 | |
| 173 | return -1; |
| 174 | } |
| 175 | |
| 176 | |
| 177 | int add_lock(char *name) |
| 178 | { |
| 179 | int ret; |
| 180 | int i = 0; |
| 181 | int num; |
| 182 | int check_flag; |
| 183 | |
| 184 | LYINFLOG("name:%s\n", name); |
| 185 | ret = read_lock_table(); |
| 186 | LYINFLOG("read_lock_table ret = %d\n", ret); |
| 187 | if(ret <0) |
| 188 | { |
| 189 | return ret; |
| 190 | } |
| 191 | |
| 192 | check_flag = check_lock(name); |
| 193 | |
| 194 | if(check_flag < 0) |
| 195 | { |
| 196 | for(i=0;i<MAX_LOCK_NUM;i++) |
| 197 | { |
| 198 | if(strlen(lock_status.lock_name[i]) == 0) |
| 199 | { |
| 200 | strcpy(lock_status.lock_name[i], name); |
| 201 | LYINFLOG("lock_name[%d] %s\n", i, lock_status.lock_name[i]); |
| 202 | break; |
| 203 | } |
| 204 | } |
| 205 | if(i == MAX_LOCK_NUM) |
| 206 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 207 | return E_TABLE_FULL; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 208 | } |
| 209 | else |
| 210 | { |
| 211 | num = i; |
| 212 | } |
| 213 | } |
| 214 | else |
| 215 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 216 | return E_LOCK_EXIST; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | LYINFLOG("num = %d\n", num); |
| 220 | ret = save_lock_table(); |
| 221 | if(ret < 0) |
| 222 | { |
| 223 | return ret; |
| 224 | } |
| 225 | return num; |
| 226 | } |
| 227 | |
| 228 | int delete_lock(int fd) |
| 229 | { |
| 230 | int ret; |
| 231 | int i; |
| 232 | ret = read_lock_table(); |
| 233 | memset(lock_status.lock_name[fd], 0, sizeof(lock_status.lock_name[fd])); |
| 234 | ret = save_lock_table(); |
| 235 | return ret; |
| 236 | } |
| 237 | |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 238 | static void parse_event(const char *msg, struct dtr_uevent *dtr_uevent) |
| 239 | { |
| 240 | dtr_uevent->action = ""; |
| 241 | dtr_uevent->path = ""; |
| 242 | dtr_uevent->subsystem = ""; |
| 243 | dtr_uevent->usbevent = ""; |
| 244 | |
| 245 | while (*msg) { |
| 246 | if (!strncmp(msg, "ACTION=", 7)) |
| 247 | { |
| 248 | msg += 7; |
| 249 | dtr_uevent->action = msg; |
| 250 | } |
| 251 | else if (!strncmp(msg, "DEVPATH=", 8)) |
| 252 | { |
| 253 | msg += 8; |
| 254 | dtr_uevent->path = msg; |
| 255 | } |
| 256 | else if (!strncmp(msg, "SUBSYSTEM=", 10)) |
| 257 | { |
| 258 | msg += 10; |
| 259 | dtr_uevent->subsystem = msg; |
| 260 | } |
| 261 | else if (!strncmp(msg, "USBEVENT=", 9)) { |
| 262 | msg += 9; |
| 263 | dtr_uevent->usbevent = msg; |
| 264 | } |
| 265 | |
| 266 | while(*msg++); |
| 267 | } |
| 268 | |
| 269 | LYINFLOG("event { '%s', '%s', '%s', '%s'}\n", |
| 270 | dtr_uevent->action, dtr_uevent->path, dtr_uevent->subsystem,dtr_uevent->usbevent); |
| 271 | } |
| 272 | |
| 273 | |
| 274 | |
| 275 | void *check_dtr(void * arg) |
| 276 | { |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 277 | qser_lpm_edge_t lpm_edge; |
| 278 | char msg[UEVENT_MSG_LEN+2]; |
| 279 | struct dtr_uevent dtr_uevent; |
| 280 | int n; |
| 281 | int i; |
| 282 | |
| 283 | device_fd = uevent_open_socket(4*UEVENT_MSG_LEN, true); |
| 284 | if(device_fd < 0) |
| 285 | { |
| 286 | LYERRLOG("uevent_open_socket fail\n"); |
| 287 | return -1; |
| 288 | } |
| 289 | while(1) |
| 290 | { |
| 291 | n = uevent_kernel_multicast_recv(device_fd, msg, UEVENT_MSG_LEN); |
| 292 | msg[n] = '\0'; |
| 293 | msg[n+1] = '\0'; |
| 294 | parse_event(msg, &dtr_uevent); |
jb.qi | e7aac6d | 2023-12-28 01:32:19 -0800 | [diff] [blame] | 295 | if((!strcmp(dtr_uevent.subsystem, "xp2xp"))) |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 296 | { |
jb.qi | e7aac6d | 2023-12-28 01:32:19 -0800 | [diff] [blame] | 297 | if(!strcmp(dtr_uevent.action, "online")) |
| 298 | { |
| 299 | lpm_edge =E_QL_LPM_FALLING; |
| 300 | } |
| 301 | else |
| 302 | { |
| 303 | lpm_edge =E_QL_LPM_RISING; |
| 304 | } |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 305 | g_lpm_handler(lpm_edge); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 313 | int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg) |
| 314 | { |
| 315 | int ret; |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 316 | int num; |
| 317 | |
| 318 | g_lpm_handler = qser_lpm_handler; |
| 319 | ret = pthread_create(&thid,NULL,check_dtr,NULL); |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 320 | if(ret != 0) |
| 321 | { |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 322 | LYERRLOG("restart service fail"); |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 323 | } |
| 324 | return ret; |
| 325 | } |
| 326 | |
| 327 | |
| 328 | int qser_lpm_deinit(void) |
| 329 | { |
| 330 | int ret; |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 331 | ret = pthread_cancel(thid); |
jb.qi | e7aac6d | 2023-12-28 01:32:19 -0800 | [diff] [blame] | 332 | close(device_fd); |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 333 | if(!ret) |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 334 | { |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 335 | LYERRLOG("pthread cancel success, lpm deinit success\n"); |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 336 | } |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 337 | else |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 338 | { |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 339 | LYERRLOG("pthread cancel fail, lpm deinit fail\n"); |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 340 | } |
jb.qi | fbef514 | 2023-12-18 00:49:10 -0800 | [diff] [blame] | 341 | return ret; |
| 342 | |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 343 | } |
| 344 | |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 345 | |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 346 | int qser_autosuspend_enable(char enable) |
| 347 | { |
| 348 | int ret; |
| 349 | if(enable == '0') |
| 350 | { |
| 351 | ret = lynq_autosleep_disable(); |
| 352 | |
| 353 | } |
| 354 | else if(enable == '1') |
| 355 | { |
| 356 | ret = lynq_autosleep_enable(); |
| 357 | } |
| 358 | else |
| 359 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 360 | return E_INPUT_ERROR; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 361 | |
| 362 | } |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 363 | if(ret >= 0) |
| 364 | { |
| 365 | ret = 0; |
| 366 | } |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 367 | return ret; |
| 368 | |
| 369 | } |
| 370 | |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 371 | |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 372 | int qser_wakelock_create(const char *name, size_t len) |
| 373 | { |
| 374 | int ret; |
| 375 | if(name == NULL) |
| 376 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 377 | return E_INPUT_ERROR; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 378 | } |
| 379 | LYINFLOG("%s\n", name); |
| 380 | ret = add_lock(name); |
| 381 | return ret; |
| 382 | } |
| 383 | |
| 384 | int qser_wakelock_lock(int fd) |
| 385 | { |
| 386 | |
| 387 | int ret; |
| 388 | if(fd < 0 || fd >= MAX_LOCK_NUM) |
| 389 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 390 | return E_INPUT_ERROR; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 391 | } |
| 392 | ret = read_lock_table(); |
| 393 | ret = acquire_wake_lock( 0, lock_status.lock_name[fd]); |
jb.qi | 68fe778 | 2023-09-18 20:40:58 -0700 | [diff] [blame] | 394 | if(ret > 0) |
| 395 | { |
| 396 | ret = 0; |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | ret = -1; |
| 401 | } |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 402 | return ret; |
| 403 | } |
| 404 | |
| 405 | int qser_wakelock_unlock(int fd) |
| 406 | { |
| 407 | int ret; |
| 408 | if(fd < 0 || fd >= MAX_LOCK_NUM) |
| 409 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 410 | return E_INPUT_ERROR; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 411 | } |
| 412 | ret = read_lock_table(); |
| 413 | if(strlen(lock_status.lock_name[fd]) == 0) |
| 414 | { |
| 415 | LYINFLOG("%d is null\n", fd); |
| 416 | return -1; |
| 417 | } |
| 418 | ret = release_wake_lock(lock_status.lock_name[fd]); |
jb.qi | 68fe778 | 2023-09-18 20:40:58 -0700 | [diff] [blame] | 419 | if(ret > 0) |
| 420 | { |
| 421 | ret = 0; |
| 422 | } |
| 423 | else |
| 424 | { |
| 425 | ret = -1; |
| 426 | } |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 427 | return ret; |
| 428 | } |
| 429 | |
| 430 | int qser_wakelock_destroy(int fd) |
| 431 | { |
| 432 | int ret; |
| 433 | if(fd < 0 || fd >= MAX_LOCK_NUM) |
| 434 | { |
jb.qi | aa241cf | 2023-09-18 18:35:00 -0700 | [diff] [blame] | 435 | return E_INPUT_ERROR; |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 436 | } |
jb.qi | 5221035 | 2023-09-19 23:29:09 -0700 | [diff] [blame] | 437 | ret = qser_wakelock_unlock(fd); |
| 438 | if(ret) |
| 439 | { |
| 440 | LYINFLOG("unlock is fail\n"); |
| 441 | return ret; |
| 442 | } |
| 443 | |
jb.qi | 422ee11 | 2023-11-21 03:04:03 -0800 | [diff] [blame] | 444 | ret = delete_lock(fd); |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 445 | return ret; |
| 446 | } |
| 447 | |
jb.qi | 422ee11 | 2023-11-21 03:04:03 -0800 | [diff] [blame] | 448 | int qser_whitelist_add(int id) |
| 449 | { |
| 450 | int ret; |
| 451 | if(sc_mnet_whitelist_init() != 0) |
| 452 | { |
| 453 | LYINFLOG("sc_mnet_whitelist_init failed.\n"); |
| 454 | return -1; |
| 455 | } |
| 456 | |
| 457 | ret = sc_mnet_whitelist_add(id); |
| 458 | LYINFLOG("sc_mnet_whitelist_add ret %d.\n", ret); |
| 459 | |
| 460 | sc_mnet_whitelist_deinit(); |
| 461 | return ret; |
| 462 | |
| 463 | } |
| 464 | |
| 465 | int qser_whitelist_del(int id) |
| 466 | { |
| 467 | int ret; |
| 468 | if(sc_mnet_whitelist_init() != 0) |
| 469 | { |
| 470 | LYINFLOG("sc_mnet_whitelist_init failed.\n"); |
| 471 | return -1; |
| 472 | } |
| 473 | |
| 474 | ret = sc_mnet_whitelist_del(id); |
| 475 | LYINFLOG("qser_whitelist_del ret %d.\n", ret); |
| 476 | |
| 477 | sc_mnet_whitelist_deinit(); |
| 478 | return ret; |
| 479 | |
| 480 | } |
| 481 | |
| 482 | int qser_whitelist_get(char* whitelist) |
| 483 | { |
| 484 | int ret; |
| 485 | if(sc_mnet_whitelist_init() != 0) |
| 486 | { |
| 487 | LYINFLOG("sc_mnet_whitelist_init failed.\n"); |
| 488 | return -1; |
| 489 | } |
| 490 | |
| 491 | whitelist = sc_mnet_whitelist_get(); |
| 492 | if(NULL != whitelist) |
| 493 | { |
| 494 | LYINFLOG("sc_mnet_whitelist_get :%s\n",whitelist); |
| 495 | ret = 0; |
| 496 | } |
| 497 | else |
| 498 | { |
| 499 | LYINFLOG("sc_mnet_whitelist_get empty\n"); |
| 500 | ret = -1; |
| 501 | } |
| 502 | sc_mnet_whitelist_deinit(); |
| 503 | return ret; |
| 504 | } |
| 505 | |
| 506 | int qser_whitelist_clear(void) |
| 507 | { |
| 508 | int ret; |
| 509 | if(sc_mnet_whitelist_init() != 0) |
| 510 | { |
| 511 | LYINFLOG("sc_mnet_whitelist_init failed.\n"); |
| 512 | return -1; |
| 513 | } |
| 514 | ret = sc_mnet_whitelist_clear(); |
| 515 | LYINFLOG("sc_mnet_whitelist_clear ret %d\n", ret); |
| 516 | sc_mnet_whitelist_deinit(); |
| 517 | return ret; |
| 518 | |
| 519 | } |
| 520 | |
| 521 | |
you.chen | 21c62b7 | 2023-09-08 09:41:11 +0800 | [diff] [blame] | 522 | DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_AUTOSUSPEND) |
| 523 | |
jb.qi | 3a8298c | 2023-09-07 04:48:51 -0700 | [diff] [blame] | 524 | #ifdef __cplusplus |
| 525 | } |
| 526 | #endif |
| 527 | |
| 528 | |
| 529 | |