Problem with v4l2 & bttv mmap returning 13 (EACCES)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hello video gurus.  I didn't see this mentioned and was hoping someone
might see a mistake I'm making.

When my v4l2 application makes a call to mmap (after successful
VIDIOC_REQBUFS and VIDIOC_QUERYBUF calls) mmap returns error,
with errno = 13 (EACCES?  - Permission Denied)) - The application
is running as root.  - I've attached my modules, dmesg output,
and a code snippet below.  Any ideas?  xawtv works fine, and
I've written applications using the v4l 1 interface on this
system (with bttv 0.7) without problems.  I'm using the slightly
older v4l2 bttv (0.8.46) because some legacy code I have didn't compile
on the newer 0.9 stuff...  (videodev(2).h differences).

Any suggestions would be greatly appreciated.  The capture
device is a hauppauge wintv.

I am running the 2.4.19 kernel with the v4l2 patch from
the "oldstuff" section, and using bttv 0.8.46.  I didn't see EACCES
in the bttv module, so I'm wondering if I've found the wrong errno and
am chasing a wild goose...

My modules installed:

Module                  Size  Used by    Not tainted
bttv                   76416   0
video-buf               8928   0  [bttv]
v4l2-common             4488   0  [bttv]
videodev                5472   2  [bttv]
i2c-algo-bit            7084   1  [bttv]
i2c-core               12768   0  [bttv i2c-algo-bit]
usbserial              17728   0  (unused)


dmesg after I have installed the bttv module:

bttv0: unloading
i2c-core.o: adapter unregistered: bt848 #0
bttv: driver version 0.8.46 loaded [v4l/v4l2]
bttv: using 8 buffers with 2080k (520 pages) each for capture
bttv: Host bridge is Silicon Integrated Systems [SiS] 730 Host
bttv: Bt8xx card found (0).
PCI: Found IRQ 5 for device 00:09.0
PCI: Sharing IRQ 5 with 00:09.1
bttv0: Bt878 (rev 2) at 00:09.0, irq: 5, latency: 64, mmio: 0xcfdfc000
bttv0: detected: Hauppauge WinTV [card=10], PCI subsystem ID is 0070:13eb
bttv0: using: BT878(Hauppauge (bt878)) [card=10,autodetected]
bttv0: risc main @ 01e30000
bttv0: Hauppauge/Voodoo msp34xx: reset line init [5]
i2c-core.o: adapter bt848 #0 registered as adapter 0.
bttv0: Hauppauge eeprom: model=61111, tuner=Philips FI1236 MK2 (2), radio=no
bttv0: using tuner=2
bttv0: i2c: checking for MSP34xx @ 0x80... found
bttv0: i2c: checking for TDA9875 @ 0xb0... not found
bttv0: i2c: checking for TDA7432 @ 0x8a... not found
bttv0: registered device video0
bttv0: registered device vbi0
bttv0: video mux: input=0 mux=2
bttv0: PLL: 28636363 => 35468950 .. ok


After my application has started:


bttv: open minor=0
bttv0: open called (video)
vbuf: mmap setup: 8 buffers, 40960 bytes each
vbuf: init kernel [10 pages]
bttv0: buffer flags: odd format: 4:2:2, packed, YUYV size: 160x120




The bit of code of interest: (From the capture library of CMVision)
  // Open the video device
  vid_fd = open(device, O_RDONLY);
  if(vid_fd == -1){
    printf("Could not open video device [%s]\n",device);
    return(false);
  }

  fmt.type = V4L2_BUF_TYPE_CAPTURE;
  err = ioctl(vid_fd, VIDIOC_G_FMT, &fmt);
  if(err){
    printf("G_FMT returned error %d\n",errno);
    return(false);
  }

  // Set video format
  fmt.fmt.pix.width = nwidth;
  fmt.fmt.pix.height = nheight;
  fmt.fmt.pix.pixelformat = nfmt;

  if(true){
    // attempt double framerate
    fmt.fmt.pix.flags = V4L2_FMT_FLAG_TOPFIELD; // |V4L2_FMT_FLAG_BOTFIELD;
    /*
    fmt.fmt.pix.flags = (fmt.fmt.pix.flags |
			 V4L2_FMT_FLAG_TOPFIELD | V4L2_FMT_FLAG_BOTFIELD) &
                         ~V4L2_FMT_FLAG_INTERLACED;
    */
  }else{
    fmt.fmt.pix.flags = fmt.fmt.pix.flags | V4L2_FMT_FLAG_INTERLACED;
  }

  err = ioctl(vid_fd, VIDIOC_S_FMT, &fmt);
  if(err){
    printf("S_FMT returned error %d\n",errno);
    perror("S_FMT:");
    return(false);
  }



  // Request mmap-able capture buffers
  req.count = STREAMBUFS;
  req.type  = V4L2_BUF_TYPE_CAPTURE;
  err = ioctl(vid_fd, VIDIOC_REQBUFS, &req);
  if(err < 0 || req.count < 1){
    printf("REQBUFS returned error %d, count %d\n",
	   errno,req.count);
    return(false);
  }

  for(i=0; i<req.count; i++){
    vimage[i].vidbuf.index = i;
    vimage[i].vidbuf.type = V4L2_BUF_TYPE_CAPTURE;
    err = ioctl(vid_fd, VIDIOC_QUERYBUF, &vimage[i].vidbuf);
    if(err < 0){
      printf("QUERYBUF returned error %d\n",errno);
      return(false);
    }


   /* This call to mmap is returning EACCES (13) */
    vimage[i].data = (char*)mmap(0, vimage[i].vidbuf.length, PROT_WRITE |
PROT_READ, MAP_SHARED, vid_fd, vimage[i].vidbuf.offset);
    if((int)vimage[i].data == -1){
      printf("mmap() returned error %d\n", errno);
      return(false);
    }
  } /* End for */









[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux