USB webcam works with USB host port but not USB OTG port

Hi,

I've connected a USB webcam (based on the GSPCA OV534) to the Beagle,
and successfully captured images using OpenCV with the webcam
connected to the USB host port. The USB messages upon connection are:

[ 181.331817] usb 1-2.1: new high speed USB device using ehci-omap
and address 4
[ 181.473510] usb 1-2.1: configuration #1 chosen from 1 choice
[ 182.050323] Linux video capture interface: v2.00
[ 182.075134] gspca: main v2.4.0 registered
[ 182.089141] gspca: probing 1415:2000
[ 182.108306] ov534: sensor is ov7721
[ 182.155181] ov534: frame_rate: 30
[ 182.159484] gspca: probe ok
[ 182.162475] usbcore: registered new interface driver ov534
[ 182.173675] ov534: registered

Connecting to the USB OTG port, the driver doesn't seem to load
correctly, and my program has "select timeout" errors followed by a
segmentation fault. Behavior for another capture utility in w3cam is
similar. The USB messages when the camera is connected to the OTG
port are different:

[ 181.331817] usb 1-2.1: new high speed USB device using ehci-omap
and address 4
[ 181.473510] usb 1-2.1: configuration #1 chosen from 1 choice
[ 182.050323] Linux video capture interface: v2.00
[ 182.075134] gspca: main v2.4.0 registered
[ 182.089141] gspca: probing 1415:2000
[ 182.108306] ov534: sensor is ov7721
[ 182.155181] ov534: frame_rate: 30
[ 182.159484] gspca: probe ok
[ 182.162475] usbcore: registered new interface driver ov534
[ 182.173675] ov534: registered

I'd like to get this camera working on a B5 revision board which
doesn't have a USB host port. I'm running Angstrom, with 2.6.29r44
kernel built using open embedded tools (2.6.28 doesn't support this
camera). In both cases the camera is connected to a Logitec USB hub,
so this doesn't seem to be a factor.

Any ideas on how to get this camera going with the OTG port?

You can make it work on OTG port.
Now here I want some observations.
Is your HUB self powered(idealy to work with Cam it should be…) ?
Just boot the board and connect the Hub to OTG port with mini A cable after complete booting of kernel.
That should enumerate it and it should work.
If u connect the same thing b4 kernel boots it might not work.
For that you need to change kernel config of OTG as permanent host mode which is by default HOST+Peripheral.

Regards,
Omkar

Thanks Omkar.

Yes, the hub is self powered (the Beagle gives errors otherwise as the
camera requests too much current).

Unfortunately the Beagle doesn't recognize the hub if I connect it
after boot (this happens also with another different hub).

You can try one more thing…
You need to configure kernel options for USB OTG.
Device Drivers → USB devices → 343x… → USB OTG options.

You can find 3 options if you select above.

  1. USB Host 2. OTG 3. Host and OTG.

By default option 3 is selected in kernel defconfig as it is required to support device as OTG as well as host.
But if your purpose is to use it just as host you can select option 1 and recompile kernel.

This thing worked for me even with crappiest HUB.

Regards,
Omkar

I built a new kernel with the USB host option configured. No errors
are generated when the camera is plugged in:

[ 161.197937] usb 1-1.1: new high speed USB device using musb_hdrc
and address 5
[ 161.317810] usb 1-1.1: configuration #1 chosen from 1 choice
[ 161.324401] gspca: probing 1415:2000
[ 161.346282] ov534: sensor is ov7721
[ 161.396850] ov534: frame_rate: 30
[ 161.415527] gspca: probe ok

but attempts to capture from it still fail.

Thanks for the suggestion though - anything else to try?

Cheers,

Tim

Actually it should not fail.
Please check with your capture application.
Is there any device opening related issue or check for other errors also.

Regards,
Omkar

I've tested with two different capture programs, both of which work
fine with the USB host port.

vidcat (included with the w3cam software) simply freezes with no error
messages displayed.

OpenCV gives the following messages:

[ 1407.189056] ov534: frame_rate: 30
select timeout
select timeout
Segmentation fault

(select timeout is shown twice, as the software attempts to capture 2
frames)

I've tried this again on a B5 Beagle, and am seeing the following
additional kernel messages between the "select timeout" and
segmentation fault":

dma_free_coherent: bad page in kernel page table

This is repeated 8 times...