blob: 2f448b956f9630938463d0e894e95734ec528d2c [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001#include <stdlib.h>
2#include <stdio.h>
3#include <string.h>
4#include <sys/ioctl.h>
5#include <fcntl.h>
6#include <getopt.h>
7#include "ac_ioctl.h"
8
9int SetAcEntry(struct ac_args *opt, unsigned int cmd)
10{
11 int fd;
12
13 fd = open("/dev/"AC_DEVNAME, O_RDONLY);
14 if (fd < 0)
15 {
16 printf("Open %s pseudo device failed\n","/dev/"AC_DEVNAME);
17 return AC_FAIL;
18 }
19
20 if(ioctl(fd, cmd, opt)<0) {
21 printf("AC_API: ioctl error\n");
22 close(fd);
23 return AC_FAIL;
24 }
25
26 close(fd);
27 return AC_SUCCESS;
28}
29
30
31int GetAcEntry(struct ac_args *opt, unsigned int cmd)
32{
33 int fd;
34
35 fd = open("/dev/"AC_DEVNAME, O_RDONLY);
36 if (fd < 0)
37 {
38 printf("Open %s pseudo device failed\n","/dev/"AC_DEVNAME);
39 return AC_FAIL;
40 }
41
42 if(ioctl(fd, cmd, opt)<0) {
43 printf("AC_API: ioctl error\n");
44 close(fd);
45 return AC_FAIL;
46 }
47
48 close(fd);
49 return AC_SUCCESS;
50}