From: Janosch Peters <jp@binford3000.de>
To: video4linux-list@redhat.com
Subject: "no such device" when calling read()
Date: Sun, 02 Mar 2008 23:32:46 +0100 [thread overview]
Message-ID: <47CB2B0E.9010003@binford3000.de> (raw)
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
reply other threads:[~2008-03-02 23:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47CB2B0E.9010003@binford3000.de \
--to=jp@binford3000.de \
--cc=video4linux-list@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox