Skip to content

Experiments to enable camera features on Exynos devices and make GCam work

Notifications You must be signed in to change notification settings

TBM13/Samsung-Camera-Experiments

Repository files navigation

Samsung Camera Experiments

patch_lib.py

A Python script that automatically patches the 32-bit and 64-bit camera libraries of Exynos devices to enable different features.
Requires Python 3.10 or higher. May not work with Python 3.12+ since the capstone module requires distutils which was deprecated on that version.

The libraries are located at /vendor/lib/libexynoscamera3.so and /vendor/lib64/libexynoscamera3.so.
If the script fails to patch yours, open an issue and attach them, specifying your device model and Android version.

Note

  • The camera lib of old devices (those that launched with Android 8.1 or lower) seems to be very different so they may never be supported.

Features

The following camera features can be enabled/modified:

Warning

  • Enabling a capability or feature doesn't mean it will work as expected. It's up to you to test them.

Capabilities

Hardware Level

Usage

usage: patch_lib.py [-h] [-hw {0,1,2,3,4}]
                    [-cap {2,4,8,16,32,64,128,256,512,1024,2048} [{2,4,8,16,32,64,128,256,512,1024,2048} ...]]
                    [--model MODEL] [--android-version ANDROID_VERSION] [--version VERSION]
                    camera_lib camera_lib_64

positional arguments:
  camera_lib            Path of the 32-bit libexynoscamera3.so
  camera_lib_64         Path of the 64-bit libexynoscamera3.so

options:
  -h, --help            show this help message and exit

Lib Modifications:
  -hw {0,1,2,3,4}       The hardware level that will be set
  -cap {2,4,8,16,32,64,128,256,512,1024,2048} [{2,4,8,16,32,64,128,256,512,1024,2048} ...]
                        The capabilities that will be enabled, separated by spaces

Magisk Module:
  If all these settings are provided, a Magisk module with both patched libs will be created

  --model MODEL         The device model (e.g. Galaxy A20)
  --android-version ANDROID_VERSION
                        The Android version (e.g. 11)
  --version VERSION     The module version (e.g. 1)

Example

python3 ./patch_lib.py libexynoscamera3.so libexynoscamera3_64.so -cap 16 will enable the RAW capability. This should be enough to make GCam work.

python3 ./patch_lib.py libexynoscamera3.so libexynoscamera3_64.so -hw 1 -cap 16 will enable the RAW capability and set the hardware level to FULL.

GCam tests after enabling the RAW capability

Note: If you test this on a device not listed here or you have any issue/weird behaviour, please let me know.

All tests were done using BSG's GCam 8.1, as it seems to be the most stable one on Exynos devices.

Device Name SoC GCam Works? Details / Issues
Galaxy A12 Nacho (A12s) Exynos 850 X
Android 11Android 13
FreezesLags/freezes. Back cam doesn't save pics and front cam sometimes does
Galaxy A20 Exynos 7884
Android 10Android 11
FreezesMay freeze & reboot while using GCam
Galaxy A20e Exynos 7884
Android 10Android 11
FreezesMay freeze & reboot while using GCam
Galaxy A30 Exynos 7904
Android 10Android 11
FreezesMay freeze & reboot while using GCam
Galaxy A30s Exynos 7904 ?
Android 10Android 11
FreezesUntested
Galaxy A40 Exynos 7904 Partially
Android 11
Front cam pics unusable due to bad resolution. It's possible to fix, need to investigate how
Galaxy A50s Exynos 9611 Partially
Android 11
Photos have pink tint. Changing black level doesn't help
Galaxy A51 Exynos 9611 Partially
Android 11
Photos have pink tint. Changing black level doesn't help
Galaxy F62 Exynos 9825 Partially
Android 11
Issues with the front camera
Galaxy M31 Exynos 9611 Partially
Android 11
Photos have pink tint. Changing black level doesn't help
Galaxy M31s Exynos 9611 Partially
Android 12
Photos have pink tint. Changing black level doesn't help