I lost some time trying to make this camera working using v4l2. Either Samsung driver is broken or I didn't provide some important ioctl's. I performed my tests on 2.6.28 kernel with fimc driver as .c sources and 2.6.38 kernel with already compiled binary drivers.
Enumerating capabilities returned: V4L2_CAP_VIDEO_CAPTURE and V4L2_CAP_VIDEO_OVERLAY. There are 4 possible formats:
They don't work. ioctl(VIDIOC_S_FMT) doesn't return error, but it also doesn't fill properly v4l_fmt.fmt.pix.bytesperline and v4l_fmt.fmt.pix.sizeimage. Overriding these values doesn't help. Reading frames in "mmap" mode ends with "QUERYBUF for mmap failed 22: Invalid argument". read(fd,...) doesn't work either.
Enumerating capabilities returned the same values as in capture mode. VIDIOC_G_FMT failed, but fimc sourcecode gave a hint that two formats are possible:
If FriendlyARM/qtopia can show image from the camera, then there must be some way to get these frames. Tracking cmos-camera application (it's closed source) ioctls helped a lot. I would never guess that:
I still don't know how to get better resolution than 640x512.
Anyway, if you want to capture some frames you have to:
int fd=open("/dev/video0", O_RDWR); struct v4l2_framebuffer fb; bzero(&fb,sizeof(fb)); fb.fmt.width=640; fb.fmt.height=480; fb.fmt.pixelformat=V4L2_PIX_FMT_RGB24; ioctl(fd,VIDIOC_S_FBUF,&fb); int some_int_1=1; ioctl(fd, VIDIOC_OVERLAY, &some_int_1); read(fd, buf, 640*480*3); int some_int_0; ioctl(fd, VIDIOC_OVERLAY, &some_int_0);
© KLASTER 2017