Hello Justin, Thursday, June 07, 2001, 12:36:32 AM, you wrote: JS> Hi everybody, JS> After yesterdays somewhat spirited discussion, I just could not resist, JS> and went and tried to write a V4L1 interface. The results seem quite JS> good, although I haven't tested very much. Remember to load bttv with JS> gbuffers=32 if you want it to work though. JS> By default v4l1 support will be built if you are using the standard JS> videodev.h. If you are using videodevX or Gerd's v4l2 patches, then it JS> will build v4l2 support. If you want different behaviour, you will have JS> to edit the #ifdefs at the top of NVrec.c. JS> Happy testing! Tested it with 0.8.16, still does not work :(( ... First, as I already mentioned, it does not compile with -Werror: gcc -pthread -Wall -O2 -g -Werror -o QTrec NVrec.c -ldl -lpng -lglib RTjpeg.o quicktime/libquicktime.a cc1: warnings being treated as errors In file included from NVrec.c:31: /usr/include/linux/videodev.h:942: warning: `struct file' declared inside parameter list /usr/include/linux/videodev.h:942: warning: its scope is only this definition or declaration, which is probably not what you want. /usr/include/linux/videodev.h:942: warning: `struct inode' declared inside parameter list make: *** [QTrec] Error 1 This may be caused by me doing something wrong when patching the kernel. Then, after I figured out correct sequence of actions for starting program ( that is: insert module as "modprobe bttv card=37 sloppy=1 gbuffers=32 mmap=1"; start xawtv; close xawtv ), things started to become more complicated. I received an 'invalid argument' error for adding buffer to the queue. Debugging showed that the problem is actually in failing call to mmap() twenty lines higher, which was passed by error filter: v4l1_core.c:216: cct->mmbuf = (unsigned char *)mmap(NULL, vmb.size, PROT_READ, MAP_SHARED, cct->fd, 0); if((int)(cct->bufs[0]) == -1) { perror("v4l1 core init - mmap failed"); goto error2;; } ( note that return value of mmap() is assigned to different variable than the one which is checked for -1; obviously a bug ). mmap() returns -1 and sets errno to EINVAL. Next question is, why mmap() is failing? I tried to add a couple of printk()'s to find out what happens, and this looks quite weird for me. One of the first sanity checks in bttv_mmap() ( sources of 0.8.16 ) fails. It is: if (!(vma->vm_flags & VM_SHARED)) return -EINVAL; But, if I correctly understood what happens during the mmap() syscall ( /usr/src/linux/mm/mmap.c ), VM_SHARED flag is not set for mapping areas read-only! I tried to change protection in parameters to mmap(), but only to receive 'permission denied' instead of 'invalid argument', even as root. Any ideas? Does mmap() work with 0.8.16 at all? -- Best regards, Eugene mailto:divx@xxxxxxx or sparky@xxxxxxxxxxxxxxx [Team GADGET] [Team Two Divided By Zero] NetZero Platinum No Banner Ads and Unlimited Access Sign Up Today - Only $9.95 per month! http://www.netzero.net