Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize external USB camera with Android

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to achieve an external USB camera in Android". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve an external USB camera in Android".

Realize

The system must support android.hardware.usb.host

Declaration that host needs to be added under / system/etc/permissions

In addition, the UVC device kernel for Kernel must be enabled.

+ CONFIG_USB_VIDEO_CLASS=y

+ CONFIG_MEDIA_USB_SUPPORT=y

To enable the external camera provider in the appropriate device breakdown version to add the necessary SELinux permissions, external camera configuration, and external camera provider dependencies, complete the following steps:

Add external camera profile and external camera library to device.mk.

+ PRODUCT_PACKAGES + = android.hardware.camera.provider@2.4-impl

+ PRODUCT_PACKAGES + = android.hardware.camera.provider@2.4-external-service

+ PRODUCT_COPY_FILES + =

+ device/manufacturerX/productY/external_camera_config.xml:$ (TARGET_COPY_OUT_VENDOR) / etc/external_camera_config.xml

Add the external camera provider name to the device Treble HAL inventory.

Android.hardware.camera.provider

Passthrough

2.4

ICameraProvider

Legacy/0

+ external/0

(optional) if the device is running in Treble pass-through mode, update sepolicy so that cameraserver can access the UVC camera.

+ # for external camera

+ allow cameraserver device:dir r_dir_perms

+ allow cameraserver video_device:dir r_dir_perms

+ allow cameraserver video_device:chr_file rw_file_perms

Example of external_camera_config.xml

0 1

You can customize the external camera provider by modifying the external_camera_config.xml file. Specifically, the customer can customize the following parameters:

Exclude video nodes for internal cameras

Supported picture size and frame rate limit

Number of Inflight buffers (tradeoff between stutter and memory)

In addition to these parameters, you can add your own parameters or develop your own configuration.

Thank you for your reading. the above is the content of "how to achieve an external USB camera in Android". After the study of this article, I believe you have a deeper understanding of how to implement an external USB camera in Android, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report