Hello,
I am trying to use the bufferclass driver, and it mysteriously fails, even with this simple test code:
#include <bc_cat.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
int main(void)
{
bc_buf_params_t bc_params;
int bc_fd = -1;
bc_fd = open("/dev/bc_cat", O_RDWR | O_NDELAY);
if (bc_fd == -1)
{
fprintf(stderr, "%s", "Error opening bc driver - is the bc_cat kernel module inserted?\n");
return -1;
}
bc_params.count = 1;
bc_params.width = 256;
bc_params.height = 256;
bc_params.fourcc = BC_PIX_FMT_UYVY;
bc_params.type = BC_MEMORY_MMAP;
if (ioctl(bc_fd, BCIOREQ_BUFFERS, &bc_params) != 0)
{
fprintf(stderr, "BCIOREQ_BUFFERS failed: %s\n", strerror(errno));
close(bc_fd);
return -2;
}
printf("Everything OK\n");
close(bc_fd);
return 0;
}