Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 308
Nils Avatar asked Oct 07 '22 22:10

Nils


2 Answers

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

like image 82
Sandeep Avatar answered Oct 12 '22 12:10

Sandeep


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.

like image 43
Chris Stratton Avatar answered Oct 12 '22 12:10

Chris Stratton