vcam
vcam copied to clipboard
Can't change video manually
I wrote the test.c
as below
#include <fcntl.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <unistd.h>
static char fb_path[128] = "/dev/fb1";
static int fd;
void signal_exit_handler(int sig)
{
close(fd);
exit(0);
}
int main()
{
signal(SIGINT, signal_exit_handler);
fd = open(fb_path, O_RDWR);
unsigned char rgb[3] = {10, 60, 128};
while (1) {
for (int i = 0; i < 480; i++) {
for (int j = 0; j < 640; j++) {
write(fd, rgb, sizeof(rgb));
}
}
for (int i = 0; i < 3; i++) {
rgb[i]++;
}
}
return 0;
}
after compile I enter this command
./test # terminal 1
vlc v4l2:///dev/video2 # terminal 2
but video is still the original black and white gradient picture