public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* "no such device" when calling read()
@ 2008-03-02 22:32 Janosch Peters
  0 siblings, 0 replies; only message in thread
From: Janosch Peters @ 2008-03-02 22:32 UTC (permalink / raw)
  To: video4linux-list

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:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-02 23:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-02 22:32 "no such device" when calling read() Janosch Peters

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox