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.
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.
- These three are automatically enabled by the library if the Hardware Level is set to FULL:
- MANUAL_SENSOR and READ_SENSOR_SETTINGS (2)
- MANUAL_POST_PROCESSING (4)
- BURST_CAPTURE (8)
- If this is disabled, GCam doesn't work and shows a black screen in photo mode. Enabling it is enough to make it work on some devices
- RAW (16)
- Others
- ZSL (Zero Shutter Lag) and Private Reprocessing (32)
- This one causes issues on the A20, A20e and A30 since ZSL doesn't work in them. You can use this app to check if it works on your device.
- YUV Reprocessing (64)
- Depth Output (128)
- Constrained High Speed Video (256)
- Motion Tracking (512)
- Logical Multi Camera (1024)
- Secure Image Data (2048)
- ZSL (Zero Shutter Lag) and Private Reprocessing (32)
- 0 (LIMITED)
- 1 (FULL)
- 2 (LEGACY)
- 3 (LEVEL_3)
- The lib doesn't seem to expect this level, so it will probably behave like LIMITED
- 4 (EXTERNAL)
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} ...]]
[--skip-depth] [--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
--skip-depth Skips modifications on cameras with the "Depth Output" capability. Recommended if your device
has a depth camera since the lib can crash if you enable RAW on them, for example.
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)
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.
If Android doesn't show show any cameras, this means the camera lib crashed:
- Can happen if your device has a depth camera, try patching with
--skip-depth
. - Someone has reported that they had to move the lib to
/vendor/lib64/hw/
. Try it if you see something likedlopen failed: library "libexynoscamera3.so" not found
in the logcat.
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 |
|
||||
Galaxy A20 | Exynos 7884 | ✓ |
|
||||
Galaxy A20e | Exynos 7884 | ✓ |
|
||||
Galaxy A30 | Exynos 7904 | ✓ |
|
||||
Galaxy A30s | Exynos 7904 | ? |
|
||||
Galaxy A40 | Exynos 7904 | Partially |
|
||||
Galaxy A50s | Exynos 9611 | Partially |
|
||||
Galaxy A51 | Exynos 9611 | Partially |
|
||||
Galaxy F62 | Exynos 9825 | Partially |
|
||||
Galaxy M31 | Exynos 9611 | Partially |
|
||||
Galaxy M31s | Exynos 9611 | Partially |
|