RB3 camera support on AOSP

Is there a plan or when can we see camera supported for RB3 on AOSP.
I’ve flashed latest AOSP from master branch and tested the USB camera which is working but what about cameras that come with RB3 Development Kit.

1 Like

Hey Asylaj,

Cameras aren’t going supported for RB3 on AOSP for the foreseeable future.

This is due to the upstream camera driver for RB3 being V4L based, and AOSP not using V4L.

So for now looks like we are stuck to only using UVC Camera’s right?

you can look at V4L2 camera HAL implementation: V4L2 Camera HALv3

But I think it’s for simple v4l2 devices, and there you may have to add some code to configure the pipeline.

@robertfoss based on this post implementation from your side on Camera ISP for dragonboard 845c has been upstreamed to Kernel 5.13. Does this mean we can have MIPI CSI camera support (cameras included in RB3) on AOSP ?

Hey Arlind,

The problem is that Android/AOSP expects the camera driver to expose the HAL3 interface for the userspace. The upstreamed driver does not expose a HAL3 interface.

Android has no support for V4L2 drivers like CAMSS unfortunately.

Well yes and no. @Loic mentioned a V4L2 HAL. Plus, Android does support external USB cameras, which use V4L2 and connects to the camera using the standard /dev/videoX file: External USB Cameras  |  Android Open Source Project – so the question is, does it enumerate the /dev/videoX devices directly? Or does it go through USB to detect the presence of the camera?

So obviously, there are enough pieces around to make something work.

I think that my link should work for non-USB cameras too. The config file specifies a list of ignored cameras, with a comment that suggests to me that it will pick up all V4L2 cameras, whether they’re connected to USB or not.

I followed that implementation mentioned by @Loic ( added those flags to device.mk) but had no results with connecting a usb camera from camera2api. There is another not finished usbcamera implementation which has a lot of TODO’s including this one in openDevice // TODO: implement usb camera device open sequence: open device nodes etc.

Use the link I provided. That one works and is supported.

I implemented this and now USB Camera is listed as regular camera, output through dumpsys media.camera is:
Screenshot from 2021-08-31 14-30-10

I have a Logitech C920 and when I open default Camera app, camera led turns on but no picture is displayed, neither on Open Camera app. I have this error in logcat repeatedly:

08-31 00:19:11.447 538 2072 E Camera3-OutputStream: getBufferLockedCommon: Stream 1: Can’t dequeue next output buffer: Invalid argument (-22)
08-31 00:19:11.447 538 2072 E Parcel : fcntl(F_DUPFD_CLOEXEC) failed in Parcel::read, i is 2, fds[i] is -1, fd_count is 3, error: Too many open files
08-31 00:19:11.447 538 2072 E Surface : dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22

Well that’s a start. Try with selinux disabled?

Well with selinux disabled is working now :grinning_face_with_smiling_eyes:
I don’t know why thought, I have permission to camera inside cameraserver.te:

allow cameraserver device:dir r_dir_perms;
allow cameraserver video_device:dir r_dir_perms;
allow cameraserver video_device:chr_file rw_file_perms;

Screenshot from 2021-08-31 15-57-50

1 Like

Could be differences between documentation (release 11) and master branch. Check through your kernel log for all relevant selinux messages and it shouldn’t be too hard to clear that up.

Also try ls -lZ /dev/video0 to show the file context, you might need to set that.