How to modify the libcamera3 to have USB Camera as the default front camera in Android11

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to modify the libcamera3 to have USB Camera as the default front camera in Android11

1,163 Views
YungHui
Contributor I

Hello Everyone,

  I am trying to have my USB Camera (webcam) to be the front camera on Android11. My purpose is when opening the built-in Camera app in Android, it will display the view of the USB Camera.

My hardware is using imx 8MQ evk, on its USB Type-A port connects to a USB Camera.
Now, I can see the video4 and video5 in the path of /dev when the UBS camera is plugged-in its USB Type-A port.
evk_8mq:/ # ls /dev/video*
/dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/video4 /dev/video5

I known I have to modify the part of libcamera3 to have the video device node connect with iMX Camera HAL - "android_build/vendor/nxp-opensource/imx/libcamera3".

Now, I have 2 questions on how to have the USB Camera  connect to Android Platform in HAL - libcamera3.

Q1) Where is the output .so file of libcamera3?
I've checked the Android.mk under the path, its output file name should be "camera.imx.so", right?

Q2) Where can I get more details about the settings of "camera_config_imx8mq.json"?
I found the libcamera3 reads the "camera_config_imx8mq.json" file for constructing CameraSensorMetada when doing Camera::createCamera(). These data in this json file are related to the camra_type, camera_name, orientation... etc., these info seems to be required for configuring my USB Camera as the default front camera on Android.

 

 

Labels (1)
0 Kudos
2 Replies

1,151 Views
YungHui
Contributor I

Update my survey, the current what I found as below:

- I tried to use command 'adb logcat' to catch the imx8mq evk booting-up log, at the same time, my USB camera was connected.
- Now, I can get some of CameraSensorMetadata of video4 and video5 from the output log of CameraProviderHwlImpl
- dev path:/dev/video5, video capabilities 0x84a00001, node name:uvcvideo, bus info: usb-xhci-hcd.1.auto-1.3, node name:uvcvideo,IPEVO Ziggi-HD Plus
- dev path:/dev/video4, video capabilities 0x84a00001, node name:uvcvideo, bus info: usb-xhci-hcd.1.auto-1.3, node name:uvcvideo,IPEVO Ziggi-HD Plus

01-01 00:00:23.680 344 344 I CameraProviderHwlImpl: Initialize, copy_hw 1, csc_hw 5, jpeg_hw , mplane 0, 0
01-01 00:00:23.680 344 344 I CameraProviderHwlImpl: enumSensorSet
01-01 00:00:23.680 344 344 I CameraProviderHwlImpl: matchDevNodes
01-01 00:00:23.683 344 344 I CameraProviderHwlImpl: getNodeName: dev path:/dev/video5
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: video capabilities 0x84a00001
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: getNodeName: node name:uvcvideo, bus info: usb-xhci-hcd.1.auto-1.3
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: NodeName: node name:uvcvideo,IPEVO Ziggi-HD Plus
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: getNodeName: dev path:/dev/video3
01-01 00:00:23.684 344 344 E CameraProviderHwlImpl: getNodeName open dev path:/dev/video3 failed:Device or resource busy
01-01 00:00:23.684 344 344 W CameraProviderHwlImpl: matchDevNodes: dev path /dev/video3 getNodeName failed
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: getNodeName: dev path:/dev/video1
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: video capabilities 0x84200001
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: getNodeName: node name:mx6s-csi, bus info: platform:30b80000.csi2_bridge
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: NodeName: node name:mx6s-csi,mx6s-csi
01-01 00:00:23.684 344 344 I CameraProviderHwlImpl: getNodeName: dev path:/dev/video4
01-01 00:00:23.750 344 344 I CameraProviderHwlImpl: video capabilities 0x84a00001
01-01 00:00:23.750 344 344 I CameraProviderHwlImpl: getNodeName: node name:uvcvideo, bus info: usb-xhci-hcd.1.auto-1.3
01-01 00:00:23.750 344 344 I CameraProviderHwlImpl: NodeName: node name:uvcvideo,IPEVO Ziggi-HD Plus
01-01 00:00:23.750 344 344 I CameraProviderHwlImpl: getNodeName: dev path:/dev/video2
01-01 00:00:23.751 344 344 E CameraProviderHwlImpl: getNodeName open dev path:/dev/video2 failed:Device or resource busy
01-01 00:00:23.751 344 344 W CameraProviderHwlImpl: matchDevNodes: dev path /dev/video2 getNodeName failed
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: getNodeName: dev path:/dev/video0
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: video capabilities 0x84200001
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: getNodeName: node name:mx6s-csi, bus info: platform:30a90000.csi1_bridge
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: NodeName: node name:mx6s-csi,mx6s-csi
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: matchPropertyName: index:0, target devName:mx6s-csi, devNodeName:uvcvideo,IPEVO Ziggi-HD Plus, devBusInfo:usb-xhci-hcd.1.auto-1.3, devNode:/dev/video5
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: matchPropertyName: bus info unmatch, expect platform:30b80000.csi2_bridge, actual usb-xhci-hcd.1.auto-1.3
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: matchPropertyName: index:0, target devName:mx6s-csi, devNodeName:mx6s-csi,mx6s-csi, devBusInfo:platform:30b80000.csi2_bridge, devNode:/dev/video1
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: Camera ID 0: name mx6s-csi,mx6s-csi, Facing 0, orientation 0, dev path /dev/video1
01-01 00:00:23.751 344 344 E CameraProviderHwlImpl: No such camera1 defined in camera config json.
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: Initialize, camera 0 exist 1
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: Initialize, camera 1 exist 0
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: Create: Created CameraProviderHwlImpl
01-01 00:00:23.751 344 344 E GCH_CameraProvider: Initialize: HWL doesn't support vendor buffer allocation Function not implemented(-38)
01-01 00:00:23.751 344 344 I CameraProviderHwlImpl: SetCallback

0 Kudos

1,121 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi

 

Can you provide the changes in hal and config file?

Also your camera detailed paramters in v4l2

0 Kudos