blob: 588d5f0934443e6d9e59b14be44fed77061c0f5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <stdio.h>
#include <sys/socket.h>
#include <netlink/netlink.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <linux/nfc.h>
static struct nl_sock* nl_socket = NULL;
static int genl_group = -1;
int init(){
nl_socket = nl_socket_alloc();
if(!nl_socket || genl_connect(nl_socket)){
printf("Failed to connect to netlink\n");
return 1;
}
genl_group = genl_ctrl_resolve(nl_socket, NFC_GENL_NAME);
if(genl_group < 0){
printf("Failed to resolve NFC netlink control\n");
return 1;
}
//TODO
return 1;
}
int handle(int fd){
//TODO
return 1;
}
int scan(){
//TODO
return 1;
}
static void __attribute__((destructor)) cleanup(){
nl_socket_free(nl_socket);
}
|