yoloserv/modules/fjpalmvein/C/fjpalmvein-main/drivertest.c
2023-06-01 17:02:01 -03:00

36 lines
772 B
C

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "fjveincam.h"
#define DEVICE_PATH "/dev/usb/fjveincam0"
int main() {
struct fjveincam_info info;
int status = 0;
int fd = open(DEVICE_PATH, O_RDWR);
if (fd < 0) {
printf("Failed to open USB device %s", DEVICE_PATH);
return -1;
}
printf("Open USB device OK with magic number %d\n", USB_FJVEINCAM_IOCTL_CHECK);
// Call the function in the kernel module
status = ioctl(fd, 33, &info);
if (status < 0) {
perror("ioctl");
printf("Failed to call function in kernel module with IOCTL %d code %d\n",USB_FJVEINCAM_IOCTL_CHECK,status);
close(fd);
return -1;
}
close(fd);
return 0;
}