1

I've connected four USB webcams via well powered USB hub to RasPi2. I want to use them in openCV. So I setup a simple program, where I opened the cameras using cvCaptureFromCAM, captured a cv::Mat and saved them to file.

I find out three things: when I open more cameras at once (opening second camera before closing the first one) the V4L2 driver crashes.

When using a single camera, there's a 50% chance that the image will be corrupted like this: ![Corrupted image][1] - the image is divided into two pieces, which position is swapped and there are also artifact usualy on top of the image. However first 5 pictures taken after reboot don't suffer from this

When I display the captured image in window (which I view via SSH) the problem seems to disappear.

Cameras with hub are working with no problems with my PC. The problem occurs at any resolution.

What's wrong? How can I fix it?

EDIT: Here's the crash log from dmesg

 [ 4842.262527] WARNING: CPU: 0 PID: 5471 at fs/sysfs/group.c:219 sysfs_remove_group+0x9c/0xa8()
[ 4842.262537] sysfs group 808051e4 not found for kobject 'input13'
[ 4842.262545] Modules linked in: uvcvideo bnep bluetooth cfg80211 rfkill snd_bcm2835 snd_pcm snd_timer snd fuse evdev videobuf2_vmalloc ftdi_sio videobuf2_memops videobuf2_core v4l2_common usbserial videodev media r8712u(C) uio_pdrv_genirq uio [last unloaded: uvcvideo]
[ 4842.262642] CPU: 0 PID: 5471 Comm: RpiCameraTest Tainted: G        WC     3.18.11-v7+ #781
[ 4842.262674] [<800172bc>] (unwind_backtrace) from [<80012f7c>] (show_stack+0x20/0x24)
[ 4842.262694] [<80012f7c>] (show_stack) from [<80520970>] (dump_stack+0x98/0xd8)
[ 4842.262715] [<80520970>] (dump_stack) from [<80025618>] (warn_slowpath_common+0x7c/0xa0)
[ 4842.262734] [<80025618>] (warn_slowpath_common) from [<8002567c>] (warn_slowpath_fmt+0x40/0x48)
[ 4842.262753] [<8002567c>] (warn_slowpath_fmt) from [<801a8b38>] (sysfs_remove_group+0x9c/0xa8)
[ 4842.262773] [<801a8b38>] (sysfs_remove_group) from [<801a8b78>] (sysfs_remove_groups+0x34/0x44)
[ 4842.262794] [<801a8b78>] (sysfs_remove_groups) from [<8034a1d8>] (device_remove_attrs+0x60/0x7c)
[ 4842.262813] [<8034a1d8>] (device_remove_attrs) from [<8034abb4>] (device_del+0x100/0x1b4)
[ 4842.262835] [<8034abb4>] (device_del) from [<803e20e4>] (__input_unregister_device+0x130/0x154)
[ 4842.262856] [<803e20e4>] (__input_unregister_device) from [<803e3300>] (input_unregister_device+0x50/0x80)
[ 4842.262896] [<803e3300>] (input_unregister_device) from [<7f39efec>] (uvc_status_cleanup+0x40/0x44 [uvcvideo])
[ 4842.262931] [<7f39efec>] (uvc_status_cleanup [uvcvideo]) from [<7f3952ec>] (uvc_delete+0x1c/0x150 [uvcvideo])
[ 4842.262957] [<7f3952ec>] (uvc_delete [uvcvideo]) from [<7f395558>] (uvc_release+0x4c/0x50 [uvcvideo])
[ 4842.262997] [<7f395558>] (uvc_release [uvcvideo]) from [<7f06e830>] (v4l2_device_release+0xc8/0xf0 [videodev])
[ 4842.263031] [<7f06e830>] (v4l2_device_release [videodev]) from [<8034a338>] (device_release+0x3c/0xa0)
[ 4842.263051] [<8034a338>] (device_release) from [<802dfae0>] (kobject_cleanup+0x4c/0x7c)
[ 4842.263068] [<802dfae0>] (kobject_cleanup) from [<802df9c4>] (kobject_put+0x58/0x84)
[ 4842.263084] [<802df9c4>] (kobject_put) from [<8034a64c>] (put_device+0x24/0x28)
[ 4842.263112] [<8034a64c>] (put_device) from [<7f06e508>] (v4l2_release+0x5c/0x84 [videodev])
[ 4842.263143] [<7f06e508>] (v4l2_release [videodev]) from [<8013e448>] (__fput+0x90/0x1cc)
[ 4842.263162] [<8013e448>] (__fput) from [<8013e5fc>] (____fput+0x18/0x1c)
[ 4842.263181] [<8013e5fc>] (____fput) from [<8003e6c8>] (task_work_run+0xc0/0xf0)
[ 4842.263201] [<8003e6c8>] (task_work_run) from [<80012804>] (do_work_pending+0xd8/0xdc)
[ 4842.263219] [<80012804>] (do_work_pending) from [<8000eb18>] (work_pending+0xc/0x20)
[ 4842.263229] ---[ end trace a68e3cc8bcd55c3b ]---
[ 4842.263239] ------------[ cut here ]------------
[ 4842.263254] WARNING: CPU: 0 PID: 5471 at fs/sysfs/group.c:219 sysfs_remove_group+0x9c/0xa8()
[ 4842.263263] sysfs group 8080511c not found for kobject 'input13'
[ 4842.263270] Modules linked in: uvcvideo bnep bluetooth cfg80211 rfkill snd_bcm2835 snd_pcm snd_timer snd fuse evdev videobuf2_vmalloc ftdi_sio videobuf2_memops videobuf2_core v4l2_common usbserial videodev media r8712u(C) uio_pdrv_genirq uio [last unloaded: uvcvideo]
[ 4842.263351] CPU: 0 PID: 5471 Comm: RpiCameraTest Tainted: G        WC     3.18.11-v7+ #781
[ 4842.263371] [<800172bc>] (unwind_backtrace) from [<80012f7c>] (show_stack+0x20/0x24)
[ 4842.263387] [<80012f7c>] (show_stack) from [<80520970>] (dump_stack+0x98/0xd8)
[ 4842.263405] [<80520970>] (dump_stack) from [<80025618>] (warn_slowpath_common+0x7c/0xa0)
[ 4842.263423] [<80025618>] (warn_slowpath_common) from [<8002567c>] (warn_slowpath_fmt+0x40/0x48)
[ 4842.263442] [<8002567c>] (warn_slowpath_fmt) from [<801a8b38>] (sysfs_remove_group+0x9c/0xa8)
[ 4842.263460] [<801a8b38>] (sysfs_remove_group) from [<801a8b78>] (sysfs_remove_groups+0x34/0x44)
[ 4842.263479] [<801a8b78>] (sysfs_remove_groups) from [<8034a1d8>] (device_remove_attrs+0x60/0x7c)
[ 4842.263498] [<8034a1d8>] (device_remove_attrs) from [<8034abb4>] (device_del+0x100/0x1b4)
[ 4842.263516] [<8034abb4>] (device_del) from [<803e20e4>] (__input_unregister_device+0x130/0x154)
[ 4842.263535] [<803e20e4>] (__input_unregister_device) from [<803e3300>] (input_unregister_device+0x50/0x80)
[ 4842.263566] [<803e3300>] (input_unregister_device) from [<7f39efec>] (uvc_status_cleanup+0x40/0x44 [uvcvideo])
[ 4842.263599] [<7f39efec>] (uvc_status_cleanup [uvcvideo]) from [<7f3952ec>] (uvc_delete+0x1c/0x150 [uvcvideo])
[ 4842.263624] [<7f3952ec>] (uvc_delete [uvcvideo]) from [<7f395558>] (uvc_release+0x4c/0x50 [uvcvideo])
[ 4842.263658] [<7f395558>] (uvc_release [uvcvideo]) from [<7f06e830>] (v4l2_device_release+0xc8/0xf0 [videodev])
[ 4842.263689] [<7f06e830>] (v4l2_device_release [videodev]) from [<8034a338>] (device_release+0x3c/0xa0)
[ 4842.263706] [<8034a338>] (device_release) from [<802dfae0>] (kobject_cleanup+0x4c/0x7c)
[ 4842.263722] [<802dfae0>] (kobject_cleanup) from [<802df9c4>] (kobject_put+0x58/0x84)
[ 4842.263738] [<802df9c4>] (kobject_put) from [<8034a64c>] (put_device+0x24/0x28)
[ 4842.263766] [<8034a64c>] (put_device) from [<7f06e508>] (v4l2_release+0x5c/0x84 [videodev])
[ 4842.263795] [<7f06e508>] (v4l2_release [videodev]) from [<8013e448>] (__fput+0x90/0x1cc)
[ 4842.263813] [<8013e448>] (__fput) from [<8013e5fc>] (____fput+0x18/0x1c)
[ 4842.263831] [<8013e5fc>] (____fput) from [<8003e6c8>] (task_work_run+0xc0/0xf0)
[ 4842.263849] [<8003e6c8>] (task_work_run) from [<80012804>] (do_work_pending+0xd8/0xdc)
[ 4842.263867] [<80012804>] (do_work_pending) from [<8000eb18>] (work_pending+0xc/0x20)
[ 4842.263876] ---[ end trace a68e3cc8bcd55c3c ]---
1
  • New observation: Only the first image is damaged. When I capture two images right in sequence. It has something to do with powere states of the camera & USB bus. However I still can't open two cameras - I attached a crash log.
    – yaqwsx
    Jun 8, 2015 at 14:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.