From e3a80ac2d337b92514f3246dbacb8e4ca7b62d90 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 24 Jun 2023 15:51:42 +0200 Subject: Add basic reader_linux skeleton --- reader_linux.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 reader_linux.c (limited to 'reader_linux.c') diff --git a/reader_linux.c b/reader_linux.c new file mode 100644 index 0000000..588d5f0 --- /dev/null +++ b/reader_linux.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include + +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); +} -- cgit v1.2.3