[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-video
Subject: V4l1-compat SAA7134 EBUSY issue.
From: Rob Kramer <robk () starhub ! net ! sg>
Date: 2005-12-21 14:36:16
Message-ID: 200512212236.16343.robk () starhub ! net ! sg
[Download RAW message or body]
Hi there,
If I run the test program below on my FC4 standard kernel (2.6.14-1.1653_FC4)
with saa7134, I get the following output:
[root@epia ~]# ./testcapture
Capture 1
Capture 2
VIDIOCGMBUF, errno: 16, Device or resource busy
It seems this is because the videobuf is still in streaming mode. Is my test
supposed to work at all, i.e. should I be able to do a VIDIOCGMBUF after
VIDIOCSYNC? If I cheat and insert a v4l2 VIDIOC_STREAMOFF after the CSYNC, it
works (but the legacy application I'm working on is v4l1).
Has anyone here seen this before?
Cheers!
Rob
testcapture.c (never mind all the leaks etc.)
---------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
#include <linux/videodev.h>
void die (char *s)
{
printf ("%s, errno: %d, %s\n", s, errno, strerror (errno));
exit (1);
}
void testCapture (int fd)
{
int frame = 0;
unsigned char *buffer;
struct video_mbuf vmbuf;
struct video_mmap vmmap;
if (ioctl (fd, VIDIOCGMBUF, &vmbuf) < 0)
die ("VIDIOCGMBUF");
buffer = mmap (0, vmbuf.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
vmmap.width = 200;
vmmap.height = 200;
vmmap.format = 7;
vmmap.frame = frame;
if (ioctl (fd, VIDIOCMCAPTURE, &vmmap) < 0)
die ("VIDIOCMCAPTURE");
if (ioctl (fd, VIDIOCSYNC, &frame) < 0)
die ("VIDIOCSYNC");
munmap (buffer, vmbuf.size);
}
int main (char **argv, int argc)
{
int fd = open ("/dev/video0", O_RDWR);
printf ("Capture 1\n");
testCapture (fd);
printf ("Capture 2\n");
testCapture (fd);
close (fd);
return 0;
}
--
I explode like a bomb. No-one is spared.
My power is my mass times the speed of light squared.
- MC Hawking
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic