a simple tool to poke the new device
This commit is contained in:
parent
0f95375712
commit
26d1d42080
1 changed files with 27 additions and 0 deletions
27
helloctl/hellctl.c
Normal file
27
helloctl/hellctl.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
Loading…
Reference in a new issue