V4L2 Camera HAL questions

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

V4L2 Camera HAL questions

satur9nine
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:

https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/

The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

satur9nine
I see that Google announced the following feature on this site: https://developer.android.com/preview/features

Android P also enables support for external USB/UVC cameras on supported deveices.

Does anyone have any more information about this statement from Google? Is this a reference to the camera/3_4 module? Does the https://android-review.googlesource.com/ contain the latest work from Google? I haven't found anything new in there about USB/UVC...

Jacob


On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in <a href="https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;">https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:

<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/

The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

Colin Cross
It is not in AOSP yet, it will be pushed to AOSP when P is released.

On Wed, Jun 13, 2018 at 10:30 AM satur9nine <[hidden email]> wrote:
I see that Google announced the following feature on this site: https://developer.android.com/preview/features

Android P also enables support for external USB/UVC cameras on supported deveices.

Does anyone have any more information about this statement from Google? Is this a reference to the camera/3_4 module? Does the https://android-review.googlesource.com/ contain the latest work from Google? I haven't found anything new in there about USB/UVC...

Jacob


On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:


The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

satur9nine
Thanks, the P Preview release notes indicate the functionality is present in the following preview:

Developer Preview 2 (Beta)
Date: May 2018
Build: PPP2.180412.013

I obtained a Google Pixel device running an even newer build PPP4.180612.004, however when plugging in several USB UVC cameras in via USB OTG the audio drivers appear to be detected based on logs, but no new /dev/video inodes appear and the camera app doesn't appear to detect any. The Camera APIs also did not show any additional cameras. I noticed that the /proc/config.gz does not contain CONFIG_USB_VIDEO_CLASS which I would presume is needed for this feature?

My device shows Kernel version 3.18.100 built on Jun 5 2018.

Is this feature only available on select preview devices?

Jacob

On Wednesday, June 13, 2018 at 10:38:51 AM UTC-7, Colin Cross wrote:
It is not in AOSP yet, it will be pushed to AOSP when P is released.

On Wed, Jun 13, 2018 at 10:30 AM satur9nine <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="j9lZ9ZqVBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">satur...@...> wrote:
I see that Google announced the following feature on this site: <a href="https://developer.android.com/preview/features" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://developer.android.com/preview/features&#39;;return true;" onclick="this.href=&#39;https://developer.android.com/preview/features&#39;;return true;">https://developer.android.com/preview/features

Android P also enables support for external USB/UVC cameras on supported deveices.

Does anyone have any more information about this statement from Google? Is this a reference to the camera/3_4 module? Does the <a href="https://android-review.googlesource.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android-review.googlesource.com/&#39;;return true;" onclick="this.href=&#39;https://android-review.googlesource.com/&#39;;return true;">https://android-review.googlesource.com/ contain the latest work from Google? I haven't found anything new in there about USB/UVC...

Jacob


On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in <a href="https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;">https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:

<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/

The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="j9lZ9ZqVBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">android-platfo...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="j9lZ9ZqVBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">android-...@googlegroups.com.
Visit this group at <a href="https://groups.google.com/group/android-platform" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/android-platform&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/android-platform&#39;;return true;">https://groups.google.com/group/android-platform.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

jayapavan1012
In reply to this post by satur9nine
how did you add that HAL to your android os? I don't have any clue. please help.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

wasim.nazir
Hi,

You can follow this to get the basic info:

Thanks

On Thu, Mar 7, 2019 at 9:20 PM <[hidden email]> wrote:
how did you add that HAL to your android os? I don't have any clue. please help.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.

This message contains confidential information and is intended only for the individual(s) named. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this mail and attached file/s is strictly prohibited. Please notify the sender immediately and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

satur9nine
In reply to this post by jayapavan1012


On Thursday, March 7, 2019 at 7:50:33 AM UTC-8, [hidden email] wrote:
how did you add that HAL to your android os? I don't have any clue. please help.

To enable the External Camera HAL on Pie you will need to make some changes to various device MK files and include a configuration. Make the following changes to your <device>.mk file:

# Android P backported camera changes do not play nicely with the Camera HAL1.
# It seems unnecessary to expose HAL1 since HAL3.2 exposes the same camera and
# is backwards compatible.
TARGET_SUPPORT_HAL1=false
#PRODUCT_PACKAGES += camera.device@1.0-impl

# Camera configuration file. Shared by passthrough/binderized camera HAL
PRODUCT_PACKAGES += camera.device@3.2-impl
PRODUCT_PACKAGES += android.hardware.camera.provider@2.4-impl
# Enable binderized camera HAL
PRODUCT_PACKAGES += android.hardware.camera.provider@2.4-service
# Enable external USB camera
PRODUCT_PACKAGES += android.hardware.camera.provider@2.4-external-service

PRODUCT_COPY_FILES += \
    device/<manufacturer>/<device>/external_camera_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/external_camera_config.xml 

Example external_camera_config.xml file included in vendor partition:

<ExternalCamera>
    <Provider>
        <ignore>
            <!-- Internal video devices to be ignored by external camera HAL -->
            <id>0</id> <!-- No leading/trailing spaces -->
        </ignore>
    </Provider>
    <!-- See ExternalCameraUtils.cpp for default values of Device configurations below -->
    <Device>
        <!-- Max JPEG buffer size in bytes-->
        <MaxJpegBufferSize bytes="3145728"/>
        <!-- Size of v4l2 buffer queue when streaming >= 30fps -->
        <!-- Larger value: more request can be cached pipeline (less janky)  -->
        <!-- Smaller value: use less memory -->
        <NumVideoBuffers count="4"/>
        <!-- Size of v4l2 buffer queue when streaming < 30fps -->
        <NumStillBuffers count="2"/>

        <!-- List of maximum fps for various output sizes -->
        <!-- Any image size smaller than the size listed in Limit row will report
            fps (as minimum frame duration) up to the fpsBound value. -->
        <FpsList>
            <!-- width/height must be increasing, fpsBound must be decreasing-->
            <Limit width="640" height="480" fpsBound="60.0"/>
            <Limit width="1280" height="720" fpsBound="60.0"/>
            <Limit width="1280" height="960" fpsBound="60.0"/>
            <Limit width="1600" height="1200" fpsBound="30.0"/>
            <Limit width="1920" height="1080" fpsBound="30.0"/>
            <Limit width="2592" height="1944" fpsBound="30.0"/>
            <!-- image size larger than the last entry will not be supported-->
        </FpsList>
    </Device>
</ExternalCamera>

In device/<manufacturer>/<device>/manifest.xml:

    <hal format="hidl">
        <name>android.hardware.camera.provider</name>
        <transport>hwbinder</transport>
        <version>2.4</version>
        <interface>
            <name>ICameraProvider</name>
            <instance>legacy/0</instance>
+           <instance>external/0</instance>
        </interface>
    </hal>


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

hjellinek
In reply to this post by satur9nine
Can anyone confirm that UVC support made it in to Android Pie?
Has anyone tested it on real shipping hardware?  What devices?

Thanks.

On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in <a href="https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;">https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:

<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/

The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/a81341b5-5acb-4953-b4dc-c8bd668617ca%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

Christy Joseph
In reply to this post by satur9nine
On Friday, June 1, 2018 at 10:56:57 PM UTC+5:30, satur9nine wrote:

> I am trying to get a USB UVC camera to appear as a normal camera by the android platform.
>
>
> This appears to be similar to what the discussion in https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.
>
>
> Google seems to have some code for this. I noticed there are the following modules in the platform:
>
>
> https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
> https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/
>
>
>
> The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...
>
>
> The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:
>
>
> Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?
>
>
> Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?
>
>
> I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?
>
>
> Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?
>
>
> Thanks,
> Jacob
Hi did you get the usb camera in android build ?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/33cbff79-33e3-400c-9005-b74282128b83%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

วิไลพร นุกูล


---------- Forwarded message ---------
จาก: Christy Joseph <[hidden email]>
Date: พ. 18 ธ.ค. 2019 22:48 น.
Subject: Re: V4L2 Camera HAL questions
To: android-platform <[hidden email]>


On Friday, June 1, 2018 at 10:56:57 PM UTC+5:30, satur9nine wrote:
> I am trying to get a USB UVC camera to appear as a normal camera by the android platform.
>
>
> This appears to be similar to what the discussion in https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.
>
>
> Google seems to have some code for this. I noticed there are the following modules in the platform:
>
>
> https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
> https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/
>
>
>
> The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...
>
>
> The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:
>
>
> Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?
>
>
> Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?
>
>
> I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?
>
>
> Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?
>
>
> Thanks,
> Jacob

Hi did you get the usb camera in android build ?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/33cbff79-33e3-400c-9005-b74282128b83%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/CAAfw_XttiQ4pagL6LODUEbbcF-2EU_pY6m7GpTjzN8-evgOnyg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

blheal...@gmail.com
In reply to this post by hjellinek
There is also Android AOSP - Supporting External USB Camera this page, which defines same thing posted here, with some more details.

We have a device with an USB HUB connected to it. The external cameras are very flaky. I have tried many different varieties of cameras, and it turns out that not all are directly supported. 

Then I found this library called https://github.com/suethan/AndroidUSBCamera based on multiple other projects. I was able to get the camera working by including this project (libuvccamera) as a dependency and using it to build my app. 2/3 cameras worked well. We used mainly generic USB UVC cameras. 

Now for our purposes, we needed the camera buffer callbacks to send video data over a video call. I am not sure how that works. 

On android 8.0 however I have a completely working implementation. I am not sure of the details, as the modifications to the source were made by my Software Architect. But it works perfectly well. Just plug in the camera and we can use it. However there is quite some work involved. 

I'm working on porting those changes over to the Android Pie, however, I am not sure whether it can be done. It looks doable, but without his guidance or support (he is not available) I am not sure I can get it.

In conclusion, I have to say, yes! I was able to successfully compile and build AOSP Pie on sdm660_64, but it doesn't work as an internal camera yet. I am working on it.



On Friday, November 1, 2019 at 12:27:01 PM UTC-4, hjellinek wrote:
Can anyone confirm that UVC support made it in to Android Pie?
Has anyone tested it on real shipping hardware?  What devices?

Thanks.

On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in <a href="https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;">https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:

<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/

The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/ccd7e9ed-527d-4ee0-806e-5f68d51f2cb1%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

blheal...@gmail.com
In reply to this post by Christy Joseph
You have to add couple of Kernel level configs, and also then enable some other services. Follow the guide here External USB Cameras

Rest of the details are really not that clear and would love to have someone explain what they did. (without screwing their NDAs of course :-) )

On Wednesday, December 18, 2019 at 10:48:34 AM UTC-5, Christy Joseph wrote:
On Friday, June 1, 2018 at 10:56:57 PM UTC+5:30, satur9nine wrote:

> I am trying to get a USB UVC camera to appear as a normal camera by the android platform.
>
>
> This appears to be similar to what the discussion in <a href="https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;">https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.
>
>
> Google seems to have some code for this. I noticed there are the following modules in the platform:
>
>
> <a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
> <a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/
>
>
>
> The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...
>
>
> The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:
>
>
> Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?
>
>
> Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?
>
>
> I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?
>
>
> Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?
>
>
> Thanks,
> Jacob

Hi did you get the usb camera in android build ?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/af766698-355f-430e-bbf0-8319c76be681%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

blheal...@gmail.com
In reply to this post by blheal...@gmail.com
Actually I stand corrected. 

UVC Camera works fine in Android 9.0. Follow the steps and add the required things. 

I was thrown a little off track because we were facing trouble with one particular camera. Now let me tell you how we got it working, and please know this is not a one fix works for all situation. It depends on your requirement and you'll need to lose some to gain some. All cameras may never work.

First things first, install YAWCAM on your PC. Then connect your camera, open yawcam and make sure your device is selected and you can see it's preview. (Note: Yawcam won't start if you have 0 webcams connected).

Next, look under Settings > Device (Device name) > Format Control > Color Space/ Compression. You can have some options or just one option of the following
  • YUV
  • YUV2
  • MJPEG
  • UVY etc.
This helps to find out what formats are supported on your device. 

Now in your AOSP USB Camera HAL, if you check, you might notice that only MJPEG or YUV might be selected. Usually YUV is supported by all cameras. However, MJPEG is not. MJPEG also allows for better resolution. (So that's gonna be a trade off). If you are using Qualcomm HAL, and have enabled all the services and the camera is still not working, then check under ~/android/hardware/qcom/camera/usbcamcore/src/QualcommUsbCamera.cpp 

I noticed that MJPEG was enabled by default, and the 4 cameras I tried, 3 of them supported MJPEG so it worked perfectly. However, we had another camera, which was more important for us than others, and turns out it only supported YUV. So I turned this setting off like so

#define JPEG_ON_USB_CAMERA      0

Notice in this piece how it chooses 

#if JPEG_ON_USB_CAMERA
   rc = initUsbCamera(camHal, camHal->pictWidth, camHal->pictHeight,
                       V4L2_PIX_FMT_MJPEG);
#else
   rc = initUsbCamera(camHal, camHal->pictWidth, camHal->pictHeight,
                       V4L2_PIX_FMT_YUYV);

So that's it people, I hope I have solved all your issues with these damn cameras and the HALs. 


On Thursday, May 14, 2020 at 10:44:18 PM UTC-4, BL Healthcare wrote:
There is also <a href="https://source.android.com/devices/camera/external-usb-cameras" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://source.android.com/devices/camera/external-usb-cameras&#39;;return true;" onclick="this.href=&#39;https://source.android.com/devices/camera/external-usb-cameras&#39;;return true;">Android AOSP - Supporting External USB Camera this page, which defines same thing posted here, with some more details.

We have a device with an USB HUB connected to it. The external cameras are very flaky. I have tried many different varieties of cameras, and it turns out that not all are directly supported. 

Then I found this library called <a href="https://github.com/suethan/AndroidUSBCamera" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fsuethan%2FAndroidUSBCamera\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmrzkqHtROgEhXABfGoqLU0HwH8w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fsuethan%2FAndroidUSBCamera\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmrzkqHtROgEhXABfGoqLU0HwH8w&#39;;return true;">https://github.com/suethan/AndroidUSBCamera based on multiple other projects. I was able to get the camera working by including this project (libuvccamera) as a dependency and using it to build my app. 2/3 cameras worked well. We used mainly generic USB UVC cameras. 

Now for our purposes, we needed the camera buffer callbacks to send video data over a video call. I am not sure how that works. 

On android 8.0 however I have a completely working implementation. I am not sure of the details, as the modifications to the source were made by my Software Architect. But it works perfectly well. Just plug in the camera and we can use it. However there is quite some work involved. 

I'm working on porting those changes over to the Android Pie, however, I am not sure whether it can be done. It looks doable, but without his guidance or support (he is not available) I am not sure I can get it.

In conclusion, I have to say, yes! I was able to successfully compile and build AOSP Pie on sdm660_64, but it doesn't work as an internal camera yet. I am working on it.



On Friday, November 1, 2019 at 12:27:01 PM UTC-4, hjellinek wrote:
Can anyone confirm that UVC support made it in to Android Pie?
Has anyone tested it on real shipping hardware?  What devices?

Thanks.

On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in <a href="https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ&#39;;return true;">https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:

<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/usbcamera/
<a href="https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;" onclick="this.href=&#39;https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/&#39;;return true;">https://android.googlesource.com/platform/hardware/libhardware/+/oreo-mr1-release/modules/camera/3_4/

The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/e5406c32-6363-48a8-8aa8-c58088d803d5%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

blheal...@gmail.com
YUV Support added in UVC Camera: interface 3.4 update
Find attached diff

On Monday, May 18, 2020 at 11:22:52 AM UTC-4 [hidden email] wrote:
Actually I stand corrected. 

UVC Camera works fine in Android 9.0. Follow the steps and add the required things. 

I was thrown a little off track because we were facing trouble with one particular camera. Now let me tell you how we got it working, and please know this is not a one fix works for all situation. It depends on your requirement and you'll need to lose some to gain some. All cameras may never work.

First things first, install YAWCAM on your PC. Then connect your camera, open yawcam and make sure your device is selected and you can see it's preview. (Note: Yawcam won't start if you have 0 webcams connected).

Next, look under Settings > Device (Device name) > Format Control > Color Space/ Compression. You can have some options or just one option of the following
  • YUV
  • YUV2
  • MJPEG
  • UVY etc.
This helps to find out what formats are supported on your device. 

Now in your AOSP USB Camera HAL, if you check, you might notice that only MJPEG or YUV might be selected. Usually YUV is supported by all cameras. However, MJPEG is not. MJPEG also allows for better resolution. (So that's gonna be a trade off). If you are using Qualcomm HAL, and have enabled all the services and the camera is still not working, then check under ~/android/hardware/qcom/camera/usbcamcore/src/QualcommUsbCamera.cpp 

I noticed that MJPEG was enabled by default, and the 4 cameras I tried, 3 of them supported MJPEG so it worked perfectly. However, we had another camera, which was more important for us than others, and turns out it only supported YUV. So I turned this setting off like so

#define JPEG_ON_USB_CAMERA      0

Notice in this piece how it chooses 

#if JPEG_ON_USB_CAMERA
   rc = initUsbCamera(camHal, camHal->pictWidth, camHal->pictHeight,
                       V4L2_PIX_FMT_MJPEG);
#else
   rc = initUsbCamera(camHal, camHal->pictWidth, camHal->pictHeight,
                       V4L2_PIX_FMT_YUYV);

So that's it people, I hope I have solved all your issues with these damn cameras and the HALs. 


On Thursday, May 14, 2020 at 10:44:18 PM UTC-4, BL Healthcare wrote:
There is also Android AOSP - Supporting External USB Camera this page, which defines same thing posted here, with some more details.

We have a device with an USB HUB connected to it. The external cameras are very flaky. I have tried many different varieties of cameras, and it turns out that not all are directly supported. 

Then I found this library called https://github.com/suethan/AndroidUSBCamera based on multiple other projects. I was able to get the camera working by including this project (libuvccamera) as a dependency and using it to build my app. 2/3 cameras worked well. We used mainly generic USB UVC cameras. 

Now for our purposes, we needed the camera buffer callbacks to send video data over a video call. I am not sure how that works. 

On android 8.0 however I have a completely working implementation. I am not sure of the details, as the modifications to the source were made by my Software Architect. But it works perfectly well. Just plug in the camera and we can use it. However there is quite some work involved. 

I'm working on porting those changes over to the Android Pie, however, I am not sure whether it can be done. It looks doable, but without his guidance or support (he is not available) I am not sure I can get it.

In conclusion, I have to say, yes! I was able to successfully compile and build AOSP Pie on sdm660_64, but it doesn't work as an internal camera yet. I am working on it.



On Friday, November 1, 2019 at 12:27:01 PM UTC-4, hjellinek wrote:
Can anyone confirm that UVC support made it in to Android Pie?
Has anyone tested it on real shipping hardware?  What devices?

Thanks.

On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:


The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/8d06598e-e239-4a3c-965c-96869a3024f4n%40googlegroups.com.

ext_cam.diff (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: V4L2 Camera HAL questions

blheal...@gmail.com
In reply to this post by blheal...@gmail.com
Find update for YUV support here: for interface 3.4

On Monday, May 18, 2020 at 11:22:52 AM UTC-4 [hidden email] wrote:
Actually I stand corrected. 

UVC Camera works fine in Android 9.0. Follow the steps and add the required things. 

I was thrown a little off track because we were facing trouble with one particular camera. Now let me tell you how we got it working, and please know this is not a one fix works for all situation. It depends on your requirement and you'll need to lose some to gain some. All cameras may never work.

First things first, install YAWCAM on your PC. Then connect your camera, open yawcam and make sure your device is selected and you can see it's preview. (Note: Yawcam won't start if you have 0 webcams connected).

Next, look under Settings > Device (Device name) > Format Control > Color Space/ Compression. You can have some options or just one option of the following
  • YUV
  • YUV2
  • MJPEG
  • UVY etc.
This helps to find out what formats are supported on your device. 

Now in your AOSP USB Camera HAL, if you check, you might notice that only MJPEG or YUV might be selected. Usually YUV is supported by all cameras. However, MJPEG is not. MJPEG also allows for better resolution. (So that's gonna be a trade off). If you are using Qualcomm HAL, and have enabled all the services and the camera is still not working, then check under ~/android/hardware/qcom/camera/usbcamcore/src/QualcommUsbCamera.cpp 

I noticed that MJPEG was enabled by default, and the 4 cameras I tried, 3 of them supported MJPEG so it worked perfectly. However, we had another camera, which was more important for us than others, and turns out it only supported YUV. So I turned this setting off like so

#define JPEG_ON_USB_CAMERA      0

Notice in this piece how it chooses 

#if JPEG_ON_USB_CAMERA
   rc = initUsbCamera(camHal, camHal->pictWidth, camHal->pictHeight,
                       V4L2_PIX_FMT_MJPEG);
#else
   rc = initUsbCamera(camHal, camHal->pictWidth, camHal->pictHeight,
                       V4L2_PIX_FMT_YUYV);

So that's it people, I hope I have solved all your issues with these damn cameras and the HALs. 


On Thursday, May 14, 2020 at 10:44:18 PM UTC-4, BL Healthcare wrote:
There is also Android AOSP - Supporting External USB Camera this page, which defines same thing posted here, with some more details.

We have a device with an USB HUB connected to it. The external cameras are very flaky. I have tried many different varieties of cameras, and it turns out that not all are directly supported. 

Then I found this library called https://github.com/suethan/AndroidUSBCamera based on multiple other projects. I was able to get the camera working by including this project (libuvccamera) as a dependency and using it to build my app. 2/3 cameras worked well. We used mainly generic USB UVC cameras. 

Now for our purposes, we needed the camera buffer callbacks to send video data over a video call. I am not sure how that works. 

On android 8.0 however I have a completely working implementation. I am not sure of the details, as the modifications to the source were made by my Software Architect. But it works perfectly well. Just plug in the camera and we can use it. However there is quite some work involved. 

I'm working on porting those changes over to the Android Pie, however, I am not sure whether it can be done. It looks doable, but without his guidance or support (he is not available) I am not sure I can get it.

In conclusion, I have to say, yes! I was able to successfully compile and build AOSP Pie on sdm660_64, but it doesn't work as an internal camera yet. I am working on it.



On Friday, November 1, 2019 at 12:27:01 PM UTC-4, hjellinek wrote:
Can anyone confirm that UVC support made it in to Android Pie?
Has anyone tested it on real shipping hardware?  What devices?

Thanks.

On Friday, June 1, 2018 at 10:26:57 AM UTC-7, satur9nine wrote:
I am trying to get a USB UVC camera to appear as a normal camera by the android platform.

This appears to be similar to what the discussion in https://groups.google.com/d/msg/android-platform/rqj2SKG7Cx4/UpbPsQRkAAAJ is about.

Google seems to have some code for this. I noticed there are the following modules in the platform:


The usbcamera project seems incomplete, for example the comment "TODO: implement usb camera device open sequence: open device nodes etc." appears in the openDevice function along with no other code. It's unclear to me why Google merges such things into the platform...

The confusingly named camera/3_4 project seems quite promising, it has quite a bit of documentation as you can see and describes itself as: "Camera HALv3 using the Video For Linux 2 (V4L2) interface". Unfortunately upon attempting to use it I see it immediately fails due to the following problem: "Invalid gralloc version 100. Only 0.3 (3) and below are supported by this HAL." So it seems my particular device does not have the old 0.3 gralloc, it has gralloc 1.0. This leads to some questions:

Has anyone gotten this 3_4 V4L2 Camera HAL working in the real world?

Anyone have a guess how hard would it be to upgrade it to support gralloc 1.0?

I already have a built-in camera via existing HAL, does android allow only a single Camera HAL? If not how do I configure two Camera HALs? If not and I want to support both simultaneously would I need some kind of wrapper HAL that merges the two into one?

Final question, does anyone know of any other alternative for an external USB camera which has an Android HAL built already?

Thanks,
Jacob

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/79eb5684-73c5-4767-af98-07d6a2e785c9n%40googlegroups.com.

ext_cam.diff (6K) Download Attachment