Implementing an UVC driver using the Android NDK and a raw usb connection for cameras that are not supported by the kernel

23,277

Solution 1

It is definitely possible if you are compromising on that rooted part.. I did the same project and was finally successful. Inside uvc code, you shall be opening /dev/video1 or video0 node for which by default on most of the devices there are no user permissions.

To state it simply,

It depends on 2 things :

1) When you connect the USB Camera, if the camera node is getting created or not. It should be inside /dev directory with major number 81(signifies V4l2 device)

2) For that device node you are having user permissions or not.

These are the two hurdles you will be facing.

Solution to first is not there in our hands coz it depends from vendor to vendor. Ex, Acer tab it gets created but in Samsung Galaxy it doesnt.. The reason is missing support of V4L2 or UVC modules inside the kernel.

Solution to the second one is if you are a root user you can change the permissions of the node.

It is quite a big project and should take some time if you are starting from scratch.. All the best

Solution 2

Yes, the purpose of the usb host support in more recent versions of Android userspace is to allow you to talk to USB devices which don't have kernel drivers. Conceptually it sounds a bit similar to the libusb idea, though it is not libusb.

http://developer.android.com/guide/topics/usb/host.html

It occurs to me (as pure, unverified speculation) that there might perhaps be situations where partial driver-in-kernel support for a device could interfere with attempting to talk to it directly from userspace in this manner.

Share:
23,277
Nils
Author by

Nils

Updated on July 09, 2022

Comments

  • Nils
    Nils almost 2 years

    I'm looking for a way to get UVC compartible usb cameras working on other android devices that don't have a kernel driver for those UVC cameras by default.

    I don't want to root those devices nor change their image/kernel, because usual customers should be able to use the camera later on with every tablet and without special requirements (except an app).

    Do you think it might be possible to establish a raw connection to an unknown device using Android's USB class in Android 3.1 and higher (http://developer.android.com/guide/topics/usb/host.html) or can I only use it with devices that are supported and recognized by the kernel already?

    If it would be possible, I would be interested in integrating the UVC driver using Java/NDK to get the video stream out of it. At least that's my rough idea.

    Do you think that's possible?

  • Chris Stratton
    Chris Stratton about 12 years
    This was true a few years ago, when USB host was an unofficial hack only, but it is not true today for those devices which officially have usb host capability.
  • t0mm13b
    t0mm13b about 12 years
    @Chris: Well he did state specifically 3.1 android and higher, if that is audience target then that could be a good thing, but, having said that, what kernel version is used with honeycomb or later, ICS generally tied with kernel v3. Even Sony Xperia Mini is due for ICS upgrade and will be used with kernel 2.6.32, so that's why I answered in a open ended way, not to assume all will have the latest and greatest kernel v3...
  • t0mm13b
    t0mm13b about 12 years
    Even forgot to mention I ported over AOSP ICS 4.0.3 to the Zte Blade running on 2.6.35 kernel, which limited a lot of ICS functionality in relation to USB ftw :)
  • Sandeep
    Sandeep about 12 years
    Nilis, let me know if you need some documents related to this. I can help you with them.
  • Sandeep
    Sandeep about 12 years
    Neil, you may refer to this : stackoverflow.com/questions/8963897/…