Issues with USB Webcam Support


#1

Greetings,

We have been trying to get USB Webcams to work on the 410C – so far without much success. Out of the box, we found that the shipping Linux kernel does not have enabled support for USB cameras, so we enabled USB drivers and recompiled the kernel.

We then tried two different webcams, and the result is the same: Although the USB Webcam is identified in syslog/dmesg, any retrieved images are corrupted and non-usable. We usually see just a few scan lines of noise, and the rest of the image is black.

The fact that we tried two different webcams suggests that the problem is not (merely) a problem with the drivers, but perhaps something deeper in the kernel…

Does anyone have any insights? Could this be an issue with 64-bit linux and/or memory or serial access?

Best regards,
Patryk


Brain Corporation: Computer vision and machine learning for robotics.


#2

hi

are you trying with Android or Ubuntu/Linaro image? They both use very different kernel, so we need to know.

thanks


#3

hi,

with the Ubuntu/linux release, once I enable the MEDIA_USB and the appropriate USB camera drivers, it’s working fine for me. I am using the following command to test in X window:

gst-launch-1.0 v4l2src ! glimagesink

(with following packages installed gstreamer1.0-tools and gstreamer1.0-plugins-bad)

I can see clear/good pictures fromt he camera.

For the record, i am using this USB camera:

root@linaro-alip:~# v4l2-ctl -D
Driver Info (not using libv4l2):
	Driver name   : gspca_zc3xx
	Card type     : USB Camera (046d:08da)
	Bus info      : usb-78d9000.ehci-1.1
	Driver version: 4.0.0
	Capabilities  : 0x85200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x05200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format

#4

Thanks for the reply, ndec – and great news that you got a USB Webcam to work. The ones I had tried were the Logitech 310C, the Sony Playstation EYE, and an ASUS PrimeSense. I’ll proceed and see if I can find other cameras that work.

Best regards,
Patryk


Brain Corporation: Computer vision and machine learning for robotics.


#5

Patryk,

I wouldn’t expect the camera model to make too much differences… Can you show the output of

$ v4l2-ctl -D

for each of the camera you have?

I suppose they work fine on your PC, right? How do you test on the board? Have you tried the Gst pipeline I am using?

Maybe you can do one test:

  1. connect the camera on the DB410x
  2. run GST_DEBUG_DUMP_DOT_DIR=/tmp gst-launch-1.0 v4l2src ! glimagesink
  3. share on pastebin the content of /tmp/_PAUSE_PLAYING.dot file

thanks


#6

Hello ndec,

Will provide the output below. They work fine on a PC. I’m trying the gst pipeline you are using.

Here is the output for the first camera, the Logitech 310C.

Driver Info (not using libv4l2):
	Driver name   : uvcvideo
	Card type     : UVC Camera (046d:0825)
	Bus info      : usb-78d9000.ehci-1.2
	Driver version: 4.0.0
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format

In /tmp there was no _PAUSE_PLAYING.dot file, but there were a couple of other files which I’m including in case they are helpful:

*PAUSED_READY.dot: http://pastebin.com/TNgQzQR7
*READY_PAUSED.dot: http://pastebin.com/QckqETyh

(There were also many *-gst-launch.warning.dot files, let me know if you think those would be informative.)

Thank you,
Patryk


#7

ndec,

Would you mind posting your working kernel config? Maybe there’s something we are missing, we could do a diff here.

Thanks,
Patryk


#8

i used the following defconfig patch:

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 4839f4f…f6a72a1 100644
— a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -142,6 +142,10 @@ CONFIG_REGULATOR_QCOM_SPMI=y
CONFIG_REGULATOR_RPM_SMD=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_MEDIA_USB_SUPPORT=y
+CONFIG_USB_VIDEO_CLASS=y
+CONFIG_USB_GSPCA=y
+CONFIG_USB_GSPCA_ZC3XX=y
CONFIG_MSM_VIDC_V4L2=y
CONFIG_DRM=y
CONFIG_DRM_I2C_ADV7511=y


#9

Can you tell me the model of your webcam so we can try to replicate the working setup?

We had these same configuration options enabled in our kernel. I also tried applying just your patch to defconfig, but still no luck getting our webcams to work.

Here is the output of syslog for your reference.


[... connect the webcam ...]

Jun 30 00:31:51 linaro-alip kernel: [   45.695462] usb 1-1.2: new high-speed USB device number 6 using msm_hsusb_host
Jun 30 00:31:52 linaro-alip kernel: [   45.914754] usb 1-1.2: New USB device found, idVendor=046d, idProduct=09a4
Jun 30 00:31:52 linaro-alip kernel: [   45.914852] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=2
Jun 30 00:31:52 linaro-alip kernel: [   45.914873] usb 1-1.2: SerialNumber: 8722E510
Jun 30 00:31:52 linaro-alip kernel: [   45.917605] usb 1-1.2: no of_node; not parsing pinctrl DT
Jun 30 00:31:52 linaro-alip kernel: [   45.918662] uvcvideo 1-1.2:1.0: no of_node; not parsing pinctrl DT
Jun 30 00:31:52 linaro-alip kernel: [   45.918857] uvcvideo: Found UVC 1.00 device <unnamed> (046d:09a4)
Jun 30 00:31:52 linaro-alip kernel: [   45.952788] input: UVC Camera (046d:09a4) as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.2/1-1.2:1.0/input/input2
Jun 30 00:31:52 linaro-alip mtp-probe: checking bus 1, device 6: "/sys/devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.2"
Jun 30 00:31:52 linaro-alip mtp-probe: bus: 1, device: 6 was not an MTP device

linaro@linaro-alip:~$ gst-launch-1.0 v4l2src ! glimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Got context from element 'glimagesink0': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0";
Setting pipeline to PLAYING ...
New clock: GstSystemClock

[... no video appears ...]

Jun 30 00:31:57 linaro-alip kernel: [   51.245309] msm_vidc: info: Opening video instance: ffffffc035f7a000, 1
Jun 30 00:31:57 linaro-alip kernel: [   51.247625] msm_vidc:  err: State 17 not recognized
Jun 30 00:31:57 linaro-alip kernel: [   51.247638] msm_vidc:  err: Failed to move from state: 16 to 13
Jun 30 00:31:57 linaro-alip kernel: [   51.247646] msm_vidc:  err: Failed to move inst: ffffffc035f7a000 to release res done
Jun 30 00:31:57 linaro-alip kernel: [   51.247657] msm_vidc: warn: Failed in msm_v4l2_close for release output buffers
Jun 30 00:31:57 linaro-alip kernel: [   51.247822] msm_vidc: info: Closed video instance: ffffffc035f7a000
Jun 30 00:31:57 linaro-alip kernel: [   51.247866] msm_vidc: info: Opening video instance: ffffffc035f7a000, 0
Jun 30 00:31:57 linaro-alip kernel: [   51.249155] msm_vidc:  err: State 17 not recognized
Jun 30 00:31:57 linaro-alip kernel: [   51.249165] msm_vidc:  err: Failed to move from state: 16 to 13
Jun 30 00:31:57 linaro-alip kernel: [   51.249172] msm_vidc:  err: Failed to move inst: ffffffc035f7a000 to release res done
Jun 30 00:31:57 linaro-alip kernel: [   51.249183] msm_vidc: warn: Failed in msm_v4l2_close for release output buffers
Jun 30 00:31:57 linaro-alip kernel: [   51.249382] msm_vidc: info: Closed video instance: ffffffc035f7a000
Jun 30 00:31:57 linaro-alip kernel: [   51.385150] usb 1-1.2: reset high-speed USB device number 6 using msm_hsusb_host

^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:02.657027655
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...


#10

@bclaurent, I don’t have the camera with me now (and won’t until Thursday). it is a very old webcam that I had in a box… it won’t be easy to buy it today i suspect.

i did notice some issues/traces with the msm_vidc too. while these are real issues, that didn’t impact the camera… but maybe we should try to disable MSM_VIDC to see if that makes a difference. can you recompile your kernel without CONFIG_MSM_VIDC_V4L2 (it’s in device drivers/multimedia). without this driver you will only have /dev/video0 device, and not the other /dev/videoxx.

does that make any difference?


#11

Unfortunately, although compiling without CONFIG_MSM_VIDC_V4L2 removes the errors in syslog, there is still no glimagesink window appearing with the camera image. (The glimagesink window does appear with the test pattern gltestsrc.)

In the meantime, we will continue to try finding compatible webcams.

Thanks,
Patryk

Brain Corporation: Computer vision and machine learning for robotics.


#12

[SOLVED]

The issue appears to be with the bandwidth requirements of newer USB Webcams. By requesting a lower resolution and/or framerate, we were able to get them to work under Linux on the 410C.

For example, the following command works:


gst-launch-1.0 v4l2src | video/x-raw,width=320,height=240,framerate=30/1 ! videoconvert ! glimagesink

If you want a 640x480 image, you can slow down the frame rate to, e.g., framerate=10/1, and that works as well.

Best regards,
Patryk

Brain Corporation: Computer vision and machine learning for robotics.


#13

I cannot get the v4l2-ctl command to execute. Is there a way to install or enable without rebuilding the kernel?

Thanks,

Sean


#14

@bclaurent: ok, thanks. this still looks suspicious, might need to investigate further, but you are unblocked for now i guess

@snowbird: what do you mean, what error do you have? v4l2-ctl is part of v4l-utils package on debian/ubuntu, did you install it?


#15

Is there no way to access a webcam from the stock linux image? Must you recompile the kernel to access the webcam?

When I run v4l2-ctl, the response is:

Failed to open /dev/video0: No such file or directory

@ndec Thanks, that worked.

Sean


#16

@snowbird: right, USB camera support is not compiled in the 15.06 release… it’s a bug, and it will be fixed in the next release ( in ~2 weeks from now).


#17

Hi Patryk,

I am facing the same issue with a uvcvideo camera. However, I could not compile the boot image. I followed the procedure mentioned at https://github.com/96boards/documentation/wiki/Dragonboard-410c-Boot-Image and tried to boot using fastboot but the board did not come up (blank screen). I just built the boot image and not boot modules. Can you please share your procedure for building the Kernel.

Thanks,
Puneet


#18

Hi Puneet,

I think the instructions on the wiki have some errors. How did you make the the boot image? Here is what I do:


export cmdline="root=/dev/disk/by-partlabel/rootfs rw rootwait console=tty0 console=ttyMSM0,115200n8 text"

mkbootimg --kernel build-${ARCH}/arch/arm64/boot/Image \
          --ramdisk ../initrd.img-4.0.0-linaro-lt-qcom \
          --output boot-db410c.img \
          --dt dt.img \
          --pagesize 2048 \
          --base 0x8000000 \
          --cmdline "$cmdline"

I have found that it’s important to have “text” at the end of the cmdline. Did you put “text” there?

Best,
Patryk

Brain Corporation: Computer vision and machine learning for robotics.


#19

as i just said on another post, adding ‘text’ shouldn’t fix anything if you are using the current release. In fact ‘text’ should just be ignored completely with images based on Ubuntu 15.04.

@Puneet: can you please post the commands you run to rebuilt your kernel and create your boot images, with as much detail as possible?

I had tried the instructions from wiki when I wrote them originally. but i will try again to see if something’s missing.


#20

Thanks Patryk, ndec. I followed instructions ditto on https://github.com/96boards/documentation/wiki/Dragonboard-410c-Boot-Image. While creating boot image I gave the following command:
export cmdline="root=/dev/ram0 rw rootwait console=ttyMSM0,115200n8"
I suppose I need to give this (?):
export cmdline=“root=/dev/disk/by-partlabel/userdata rw rootwait console=ttyMSM0,115200n8”

Also, the path http://snapshots.linaro.org/ubuntu/pre-built/snapdragon-arm64/17/initrd.img-4.0.0-linaro-lt-qcom
is not valid. I downloaded the same from
http://builds.96boards.org/releases/dragonboard410c/linaro/ubuntu/latest