"no such device" when calling read()
Hi!
I just started learning v4l2. Im trying to write a small program which captures one frame and then terminates. The ioctl calls are all working, but when I call read() it fails, telling me that there is "no such device". Although I just used this very file descriptor to do the ioctl stuff. It is no I guess I'm missing something important. Any help is appreciated.
Im using a QuickCam for Notebooks (the current model). I already checked, that this cam supports the read() I/O. The output of the code beneath is:
---- output ------
Device sucessfuly opened.read(): No such device
----------------------
---- code ------------------------------------------- int main()
{
int fd = open("/dev/video0",O_RDWR);
if( fd == -1 ) {
// error message here
}
else {
cout << "Device sucessfuly opened." << endl;
}
// save one image and exit
int mb = 1048576;
char* buf = new char[mb]; // 1MB
ssize_t bytesRead = read(fd, buf, mb); if (-1 == bytesRead ) {
perror ("read()");
exit (EXIT_FAILURE); }
}
-------------------------------------------------------------
The file descriptor looks like this:
---------
crw-rw---- 1 root video 81, 0 2008-03-02 23:10 video0
---------
I am in the video group. I even ran the program as root.
cheers,
Janosch
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list