5 Replies Latest reply on Oct 20, 2016 12:52 PM by Intel Corporation

    webcam error on Edison

    JamesLeo

      Hi,

      After switch to USB host mode, I can find my uvc webcam at Edison:

      Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

      Bus 001 Device 002: ID 1c4f:3000 SiGma Micro Micro USB Web Camera

      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

       

      Also find video0 at /dev:

      # ls /dev/v*

      /dev/vcs   /dev/vcs3  /dev/vcs6   /dev/vcsa2  /dev/vcsa5        /dev/video0

      /dev/vcs1  /dev/vcs4  /dev/vcsa   /dev/vcsa3  /dev/vcsa6

      /dev/vcs2  /dev/vcs5  /dev/vcsa1  /dev/vcsa4  /dev/vga_arbiter

       

      Use dmesg command, output like this:

      /# dmesg |grep usb

      [    0.207731] usbcore: registered new interface driver usbfs

      [    0.207831] usbcore: registered new interface driver hub

      [    0.208041] usbcore: registered new device driver usb

      [    0.730194] usbcore: registered new interface driver asix

      [    0.730275] usbcore: registered new interface driver cdc_subset

      [    0.730406] usbcore: registered new interface driver cdc_ncm

      [    0.733156] usbcore: registered new interface driver cdc_acm

      [    0.733277] usbcore: registered new interface driver usb-storage

      [    0.733455] usbcore: registered new interface driver usbserial

      [    0.733537] usbcore: registered new interface driver pl2303

      [    0.733616] usbserial: USB Serial support registered for pl2303

      [    1.626898] usbcore: registered new interface driver usbhid

      [    1.626917] usbhid: USB HID core driver

      [    1.632039] usbcore: registered new interface driver snd-usb-audio

      [    5.716644] usb0: MAC 02:00:86:04:af:74

      [    5.716666] usb0: HOST MAC 2a:9a:42:05:bc:b7

      [    6.405634] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002

      [    6.405658] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1

      [    6.405679] usb usb1: Product: xHCI Host Controller

      [    6.405698] usb usb1: Manufacturer: Linux 3.10.98-poky-edison+ dwc-xhci

      [    6.405716] usb usb1: SerialNumber: dwc3-host.2

      [    6.407854] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003

      [    6.407879] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1

      [    6.407899] usb usb2: Product: xHCI Host Controller

      [    6.407918] usb usb2: Manufacturer: Linux 3.10.98-poky-edison+ dwc-xhci

      [    6.407936] usb usb2: SerialNumber: dwc3-host.2

      [    6.724779] usb 1-1: new full-speed USB device number 2 using dwc3-host

      [    6.746795] usb 1-1: New USB device found, idVendor=1c4f, idProduct=3000

      [    6.746827] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0

      [    6.746849] usb 1-1: Product: USB Web Camera

      [    6.746868] usb 1-1: Manufacturer: SiGma Micro

      [    8.096340] input: USB Web Camera as /devices/pci0000:00/0000:00:11.0/dwc3-host.2/usb1/1-1/1-1:1.0/input/input2

      [    8.096906] usbcore: registered new interface driver uvcvideo

      [    9.409566] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready

      [ 2081.888473] usb 1-1: Not enough bandwidth for altsetting 0

       

      When I try to capture picure with webcam in Eclipse (Iss), there is a error : (use V4L2)

      usb_camera_fd = open(usb_video_dev,O_RDWR);//open"/dev/ video0"

      //<--usb_camera_fd OK

      if (ioctl(usb_camera_fd,VIDIOC_QUERYCAP,video_caps) == -1)//get videodevice capability 获取设
         // 备基本信息。

          {

         perror("Couldn't get videodevice capability"); //<---error at here!
         return -1;

          }

       

      When I try with OpenCV,

      VideoCapture cap(0);//<--error message at putty

       

       

      What's going wrong?  Is this the driver problem? or a app problem?

      Is there a simple tool to test/debug webcam?

       

      If I capture a picture ,and saved like this:

      cvSaveImage("camera_cap.jpg",src);

      where is this file 'camera_cap.jpg' in Edison?  How to transfer to PC?  Use winscp?...

       

      Thanks

       

      James

        • 1. Re: webcam error on Edison
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello James,
           
          Thanks for reaching out!
           
          Since your camera seems to be recognized correctly I would guess that the issue is in the code. Nevertheless, this might still be caused by the UVC driver, which would mean that the camera is not compatible with it.
           
          First, I suggest you to check your camera compatibly with the UVC driver in http://www.ideasonboard.org/uvc/.  Let us know what you find out.
           
          Secondly, I suggest you to test your camera with a code that has been tested several times on Edison. You can try edi-cam (https://github.com/drejkim/edi-cam) I have personally tested it and if your camera is fine it should work without any issues. Let us know how it goes.
           
          So, if the above is all O.K. that would mean that in fact the issue is in the code and you will have to debug it. I'm not an expert on OpenCV, so, in order to help you with that I'd suggest you to read the following document from the Illinois Institute of Technology: http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/, I believe it might be of much help.
           
          Other thing you could try is compiling your code directly on Linux. Sometimes using Eclipse creates weird behaviors and in order to prevent this from happening you could try compiling the code on the terminal.
           
          There are several methods to transfer files from your Edison to your PC. You could try with an SD-Card, a flash drive, WinSCP as you mentioned and some others. Let me know how you are interested in sending them and I'll try to provide you a more accurate response on this.
           
          I hope this helps.
          -Peter.
           

          • 2. Re: webcam error on Edison
            JamesLeo

            Hi,Peter

            Thanks for your suggestion.

            At the beginning of camera debuggin, I can't see the output picture on Edison as on Windows.

            Accidently I found a picture on Edison after running the program!  -- why ? I don't know.

            After trying many times, I understand that this message could be ignored -- maybe the camera has no GET_DEF property.

            In fact, I tried two menthod to open this camera: V4L2 and OpenCV.

             

            Every time you open the camera, it will warnning you, but allow you to get video stream from it.

             

            Best Regards

             

            James

            • 3. Re: webcam error on Edison
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Those are good news! I'm glad to hear that you were able to make this work even if the warning message still shows up.

              If you eve have any other doubts, please don't hesitate to come back to the community. We'll try to help you in any way we can.
              -Peter.

              • 4. Re: webcam error on Edison
                xd11223

                Hello Peter,

                I got the same error, I try to use two UVC cameras. When I only insert one UVC camera, I can get the rtsp video streaming by using vlc.

                But I insert the second USV camera and using vlc to the rtsp video streaming. I cannot display it and the error message in /var/log/message shown as follow.

                 

                [  274.716180] alloc_vmap_area: 408 callbacks suppressed

                [  274.716204] vmap allocation for size 4198400 failed: use vmalloc=<size> to increase size.

                [  274.716226] vmalloc: allocation failure: 4194304 bytes

                [  274.716243] ufvsc: page allocation failure: order:0, mode:0x80d2

                [  274.716267] CPU: 1 PID: 2044 Comm: ufvsc Tainted: G           O 3.10.17-yocto-standard #4

                [  274.716755] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

                [  274.716777]  00000000 00000001 ebe0fc74 c190471a ebe0fc9c c12f5678 c1b2cbac f4c7d670

                [  274.716838]  00000000 000080d2 ebe0fcb0 c1b2f3ec ebe0fc8c 00000000 ebe0fccc c131a104

                [  274.717982]  000080d2 00000000 c1b2f3ec 00400000 ebe0fcc0 00400000 c1270ddb ffbfe000

                [  274.718041] Call Trace:

                [  274.718085]  [<c190471a>] dump_stack+0x16/0x18

                [  274.718594]  [<c12f5678>] warn_alloc_failed+0xb8/0xf0

                [  274.718632]  [<c131a104>] __vmalloc_node_range+0x194/0x210

                [  274.718665]  [<c1270ddb>] ? get_parent_ip+0xb/0x40

                [  274.718697]  [<c131a1de>] __vmalloc_node+0x5e/0x70

                [  274.719263]  [<c1671ece>] ? vb2_vmalloc_alloc+0x3e/0xc0

                [  274.719299]  [<c131a2a9>] vmalloc_user+0x39/0x50

                [  274.719327]  [<c1671ece>] ? vb2_vmalloc_alloc+0x3e/0xc0

                [  274.719354]  [<c1671ece>] vb2_vmalloc_alloc+0x3e/0xc0

                [  274.719382]  [<c1671e90>] ? vb2_vmalloc_attach_dmabuf+0x60/0x60

                [  274.719939]  [<c16700e7>] __vb2_queue_alloc+0x107/0x3d0

                [  274.719973]  [<c1907320>] ? __mutex_lock_slowpath+0x250/0x360

                [  274.720005]  [<c1674f70>] ? uvc_entity_by_id+0x40/0x40

                [  274.720032]  [<c16704fc>] __reqbufs.isra.10+0x14c/0x2b0

                [  274.720528]  [<c1670689>] vb2_reqbufs+0x29/0x30

                [  274.720606]  [<c1675265>] uvc_alloc_buffers+0x25/0x40

                [  274.720638]  [<c1676d2c>] uvc_v4l2_do_ioctl+0xd3c/0x11a0

                [  274.720667]  [<c1270ddb>] ? get_parent_ip+0xb/0x40

                [  274.720694]  [<c1270ddb>] ? get_parent_ip+0xb/0x40

                [  274.720723]  [<c131f95d>] ? kfree+0x9d/0x1c0

                [  274.721093]  [<c14da0f5>] ? __copy_to_user_ll+0x55/0x60

                [  274.721126]  [<c14da532>] ? _copy_from_user+0x42/0x70

                [  274.721157]  [<c1665975>] video_usercopy+0x2f5/0x3e0

                [  274.721186]  [<c12d6b80>] ? tracing_sched_wakeup_trace+0xc0/0xc0

                [  274.721721]  [<c15613dd>] ? add_interrupt_randomness+0x1d/0x170

                [  274.721760]  [<c16757da>] uvc_v4l2_ioctl+0x2a/0x60

                [  274.721787]  [<c1675ff0>] ? uvc_v4l2_open+0x110/0x110

                [  274.721815]  [<c166098e>] v4l2_ioctl+0x11e/0x160

                [  274.721841]  [<c1660870>] ? v4l2_open+0x100/0x100

                [  274.722578]  [<c1336686>] do_vfs_ioctl+0x306/0x550

                [  274.722616]  [<c1480cba>] ? inode_has_perm.isra.32.constprop.65+0x3a/0x50

                [  274.722644]  [<c1480d57>] ? file_has_perm+0x87/0x90

                [  274.722673]  [<c12bd8e1>] ? rcu_irq_exit+0x71/0xc0

                [  274.722700]  [<c148113b>] ? selinux_file_ioctl+0x4b/0xe0

                [  274.723020]  [<c1336930>] SyS_ioctl+0x60/0x90

                [  274.723053]  [<c190a3b8>] syscall_call+0x7/0xb

                [  274.723083]  [<c1900000>] ? remote_softirq_cpu_notify+0x8c/0x8c

                [  274.723100] Mem-Info:

                [  274.723114] DMA per-cpu:

                [  274.723130] CPU    0: hi:    0, btch:   1 usd:   0

                [  274.723145] CPU    1: hi:    0, btch:   1 usd:   0

                [  274.723613] Normal per-cpu:

                [  274.723674] CPU    0: hi:  186, btch:  31 usd:  63

                [  274.723692] CPU    1: hi:  186, btch:  31 usd:  47

                [  274.723705] HighMem per-cpu:

                [  274.723720] CPU    0: hi:   42, btch:   7 usd:  23

                [  274.723735] CPU    1: hi:   42, btch:   7 usd:  22

                [  274.723764] active_anon:49046 inactive_anon:10919 isolated_anon:0

                active_file:10013 inactive_file:23994 isolated_file:0

                unevictable:1 dirty:300 writeback:0 unstable:0

                free:111494 slab_reclaimable:3995 slab_unreclaimable:5384

                mapped:22097 shmem:11030 pagetables:562 bounce:0

                free_cma:0

                [  274.723822] DMA free:15632kB min:68kB low:84kB high:100kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15964kB managed:15888kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no

                [  274.724294] lowmem_reserve[]: 0 822 943 943

                [  274.724368] Normal free:430108kB min:3632kB low:4540kB high:5448kB active_anon:149500kB inactive_anon:30812kB active_file:21676kB inactive_file:51216kB unevictable:4kB isolated(anon):0kB isolated(file):0kB present:864248kB managed:842372kB mlocked:4kB dirty:1200kB writeback:0kB mapped:71116kB shmem:30912kB slab_reclaimable:15980kB slab_unreclaimable:21536kB kernel_stack:1368kB pagetables:2248kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no

                [  274.724384] lowmem_reserve[]: 0 0 968 968

                [  274.724442] HighMem free:236kB min:128kB low:260kB high:392kB active_anon:46684kB inactive_anon:12864kB active_file:18376kB inactive_file:44760kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:123912kB managed:123912kB mlocked:0kB dirty:0kB writeback:0kB mapped:17272kB shmem:13208kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no

                [  274.724456] lowmem_reserve[]: 0 0 0 0

                [  274.725285] DMA: 0*4kB 0*8kB 1*16kB (U) 0*32kB 2*64kB (U) 1*128kB (U) 0*256kB 0*512kB 1*1024kB (U) 1*2048kB (U) 3*4096kB (MR) = 15632kB

                [  274.725675] Normal: 1*4kB (E) 1*8kB (U) 1*16kB (U) 0*32kB 2*64kB (EM) 1*128kB (M) 3*256kB (UEM) 2*512kB (UM) 0*1024kB 1*2048kB (U) 104*4096kB (MR) = 430108kB

                [  274.726269] HighMem: 15*4kB (R) 10*8kB (R) 6*16kB (R) 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 236kB

                [  274.726417] 45036 total pagecache pages

                [  274.797284] 259327 pages RAM

                [  274.797306] 30978 pages HighMem

                [  274.797320] 13634 pages reserved

                [  274.797332] 48662 pages shared

                [  274.797343] 102245 pages non-shared

                [  274.847468] usb 1-1.3: Not enough bandwidth for new device state.

                [  274.847513] usb 1-1.3: Not enough bandwidth for altsetting 1

                 

                I try to use one UVC camera and LTE dongle at same times, it works well.

                Are there any idea about this error, or it truly the not enough bandwidth.

                • 5. Re: webcam error on Edison
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  Hello xd11223,
                   
                  Could you please let us know how you are connecting the two cameras at the same time? Are you using a USB hub?
                   
                  You mentioned the following:
                   
                  "...When I only insert one UVC camera, I can get the rtsp video streaming by using vlc…"
                   
                  Does that mean that both cameras work fine when connected separately? Or, does it mean that only one of them work correctly?
                   
                  If both cameras work correctly, I can think of two possible causes. The first would be, as the log states, that there is not enough bandwidth for the new device. The second would be that the hub might not be providing enough power to both cameras.
                   
                  In case it was the latter, I would recommend you to change to a USB hub that is powered externally to see if that helps.
                   
                  Let me know.
                  -Peter.