USB webcam support in Nougat Camera API

1.3k Views Asked by At

I am building a Nougat AOSP image for Raspberry Pi 3 following these instructions: https://github.com/tab-pi/platform_manifest. And I have a UVC-compatible USB webcam (Logitech C525) that I would like to access through Android Camera API.

So far the webcam is visible in UsbManager.getDeviceList() but Camera.getNumberOfCameras() returns 0.

I have customized the kernel so that there's a /dev/video0 appearing with the appropriate permissions when plugging the webcam:

$ adb shell ls -l /dev/video0
crw-rw---- 1 system camera 81,   0 2018-09-20 10:16 /dev/video0

I've tried to build the following HALs against my AOSP tree but they all fail:

To put it in a nutshell, how can I access a USB camera through the Android Camera API on the Raspberry Pi ?

2

There are 2 best solutions below

0
On

You can try checking the init.rc file at location /device/fsl/. And set back_camera_name uvc . While booting up it looks for the specified default camera and it fails to initialize the camera driver when the mentioned camera is missing. I was facing the same issue in technexion imx6 boards. Also you find a board specific file which in case of technexion is init.i.MX6DL.rc which specifies the back_camera parameter.

0
On

The team at my company was able to backport USB camera support from Android 9 to Android 8, but it wasn't easy and involved changes to at least five git repositories and many thousands of lines of code moved and tweaked when needed. Back porting USB camera support to Android 7 sounds like an even more difficult task.

Why not just install Android 9 on your Raspberry Pi?

Perhaps try:

https://github.com/brobwind/pie-device-brobwind-rpi3

https://konstakang.com/devices/rpi3/LineageOS16.0/