From 26d1d420808007b9d2fb2d883d35d7ea840045d9 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 2 Oct 2014 22:26:28 -0400 Subject: [PATCH] a simple tool to poke the new device --- helloctl/hellctl.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 helloctl/hellctl.c diff --git a/helloctl/hellctl.c b/helloctl/hellctl.c new file mode 100644 index 0000000..480c3d4 --- /dev/null +++ b/helloctl/hellctl.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#define HELLOCTL "/dev/helloctl" + +int main(int argc, char ** argv) { + int fd = -1; + fd = open(HELLOCTL, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Could not open %s\n", HELLOCTL); + _exit(1); + } + + int ret; + if (ret = ioctl(fd, 1, 1) < 0) { + fprintf(stderr, "ioctl failed with: %s\n", strerror(ret)); + goto done; + } +done: + close(fd); +}