[clug] Android and USB cameras via OTG. Any suggestions?

David Tulloh david at tulloh.id.au
Mon Oct 31 05:20:40 UTC 2016


Hi Steve,

I don't have much experience connecting USB cameras to Android via OTG.

However I have spent the last week digging right in to the guts of the USB
UVC system so I'll give this a shot. It isn't clear to me from your email
exactly where the problem lies, so I'll just highlight a few potential
areas for you to debug.


USB OTG
========
USB On-The-Go (OTG) is terrible marketing speak for a terrible idea.
Basically it is a system where a USB device transforms itself into a USB
host at run time, which allows it to talk to another USB device.

Your cheap OTG cable should be fine, it is just straight through wiring
with the id pin being pulled at one end. It is directional, you need to
make sure you have the host on the correct end. The special cable is just
required because OTG violates one of the core USB cable design principles,
that you have directionality so you can only ever connect from a host to a
device. <Side-rant>OTG only works with USB mini and micro host ports, not
the larger ones. Because if you are going to shit all over a standard, why
not do it properly.</Side-rant>

Supporting OTG for the host is not trivial, particularly the power
requirements (so not all devices bother to do it correctly, so many rants,
so little time). So you need to ensure that your host device, the tablet,
has OTG support. If you have multiple ports it will probably only be for
one port.

Your Android OS also needs kernel level support for USB OTG as well as the
various host drivers. Android 4.0 and above should be fine but your
manufacturer may have fucked it up just for fun.

The camera device powering up might just mean that you have 5V on the line.
You need to dig deeper to ensure you have OTG capability.

There are apps to help you diagnose this such as USB Host Diagnostics,
never used it myself but the screen shots look promising.


USB Video Class (UVC)
===================
The USB video interface class specification was released in 2003, so any
new device should support it.

If your camera does not support USB UVC (yes, double USB, leave me alone)
then it is because they want to restrict you to only using their software
and you are in trouble.

You stated that the camera works on your PC, I assume that it is a Linux
system and that you accessed it through the Video for Linux (V4L) system
which wraps Linux's UVC implementation. So this should all be ok.

I imagine the Android video applications are using the same interface. If
twenty of them haven't worked I strongly suspect that paying for a 21st
won't help.


Good Luck,

David

On 30 October 2016 at 20:06, steve jenkin <sjenkin at canb.auug.org.au> wrote:

> Does anyone have _experience_ in connecting a USB camera via OTG to an
> Android device?
>
> I bought a $40 USB inspection camera. It seems to work fine with a PC (as
> does my alternate test).
> Did discover there’s some sort of standard for USB video cameras {UVC?}
> and that an older camera I have doesn’t support it.
>
> Connected it to an Android 5.0.1 tablet via OTG and tried about 20 free
> apps. The vendor doesn’t offer any O/S upgrades for this device.
> The instructional videos on the Net are all along the lines of “1.. 2… 3…
> and it just works”.
>
> The OTG is some noname brand from JB HiFi, but I wouldn’t expect that to
> be a problem as it does support at least one camera.
>
> Device was mostly recognised and the hardware powered up the embedded
> light, but failed to get an image.
> Connected my alternate video camera and it sometimes worked.
>
> I came across some comments that there were camera problems with Android
> 5.1 (vs 5.0.1 of mine).
> Couldn’t quickly find any information on
>
> Wasn’t about to throw money away buying an App without knowing in advance
> it’d work.
> There doesn’t seem to be any notion of a refund on Apps :(
> [Which you’d think didn’t comply with the Australian Consumer Law that
> allows customers to change their mind within a cooling off period.]
>
> So, if you’ve got hands-on experience in connecting USB (video) camera to
> Android via OTG, could you offer me any advice?
> If there are good resources on this, I’d appreciate being pointed there -
> haven’t discovered them yet.
>
> cheers
> steve
>
> --
> Steve Jenkin, IT Systems and Design
> 0412 786 915 (+61 412 786 915)
> PO Box 48, Kippax ACT 2615, AUSTRALIA
>
> mailto:sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin
>
>
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
>


More information about the linux mailing list