blob: 2ba3d3589cdcbd41c89330e3f08ab634ee6cb810 [file] [log] [blame]
b.liu8583dce2024-04-03 13:30:08 +08001#include <stdio.h>
2#include <stdlib.h>
3#include <sys/types.h>
4#include <sys/stat.h>
5#include <fcntl.h>
6#include <string.h>
7#include <unistd.h>
8#include <pthread.h>
9#include <sys/socket.h>
10#include <semaphore.h>
11#include <linux/netlink.h>
12
13#include <lynq/lynq-qser-usb.h>
14
15sem_t usbplug_sem;
16void do_get_adb_state(int nargs, char **argv)
17{
18
19 int ret = 0;
20
21 ret = qser_get_usb_usermode_adb_state();
22 if (ret < 0)
23 {
24 printf("get adb state fail,ret:%d \n", ret);
25 return;
26 }
27
28 printf("adb state:%d, %s\n", ret, ((ret == 0) ? "off" : "on"));
29}
30
31void do_get_net_state(int nargs, char **argv)
32{
33
34 int ret = 0;
35
36 ret = qser_get_usb_usermode_net_state();
37 if (ret < 0)
38 {
39 printf("get net state fail,ret:%d \n", ret);
40 return;
41 }
42
43 printf("net state:%d, %s\n", ret, ((ret == 0) ? "off" : "on"));
44}
45
46int main(int argc, char *argv[])
47{
48 sem_init(&usbplug_sem, 0, 0);
49 do_get_adb_state(argc, argv);
50 do_get_net_state(argc, argv);
51 sem_post(&usbplug_sem);
52 return 0;
53}