[Bug 318187] Re: get_cam_image(): len != img->bufsize, just letting you know

chunky chunky at icculus.org
Sat Dec 26 23:28:41 UTC 2009


Some comments and thoughts after spending some time trying to debug:

1) What I suspect is the core problem:

Around line 88 of camera.c, the following ioctl is called:
ioctl(cam->dev, VIDIOCGMBUF, &cam->vid_mbuf)

Putting an appropriate perror() in if it fails shows this: ioctl
(VIDIOCGMBUF): Invalid argument

&cam->vid_mbuf is a valid pointer at that point in the code, and I'm not
surely sure what else might cause that error. If that ioctl doesn't
work, then the code flow is to just silently continue, and use read(2)
instead of mmap'd space to grab the actual images. It seems to me that
this is the core problem. "Best" usage of v4l2 [as I understand it] is
to mmap stuff.


2) Info about the somewhat fluffy error message that started this thread:

The error is spat out that people report here, is misleading [at best].

The current flow of the code is [around ll125-135]:
len = read(stuff)
if(len != expected_len) { print_that_error_that_you_see_in_this_thread };
if(len < 0) { silently_return_NULL }

Which throws in the catastrophic-failure-mode with the helpfully-
warning-users-of-dodgy-hardware-mode, and leaves no way to tell them
apart.


I have modified it thus:
if(0 > len) {
  perror("read error in get_cam_image");
  return NULL;
} else if(len != img->bufsize) {
  printf("get_cam_image(): len(%i) != img->bufsize(%i), just letting you know\n", len, img->bufsize);   
}

And now I see the following [instead of the error in this thread]:
read error in get_cam_image: No such device


I'm using Ubuntu 9.04 on an ARMv5 processor [on a SheevaPlug]. According to dmesg, Linux thinks my hardware is this:
uvcvideo: Found UVC 1.00 device VF0415 Live! Cam Vid. IM Ultra (041e:4071)
input: VF0415 Live! Cam Vid. IM Ultra as /devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/input/input0
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)

This matches the label on the box it came in.


I'll continue looking, but I think I've hit the capacity of my understanding of v4l2. If anyone knows why the VIDIOCGMBUF ioctl might fail like this, that's probably the closest thing to a magical bugfix. On the other hand, even without the correct mmap, I'd think that read(2) should work, and that returning an error may be the indicator a smart person needs to figure out why it's actually broken.

Gary (-;

-- 
get_cam_image(): len != img->bufsize, just letting you know
https://bugs.launchpad.net/bugs/318187
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list