[WIP] - ICS Camera HAL for 2.6 kernel

Search This thread

~semsem~

Senior Member
Apr 26, 2010
168
55
Any news regarding updating camera video to work on N1 as well?

Thank you.
 
Last edited:

vpupkin

Senior Member
Apr 5, 2009
60
321
Hi! I'm trying to get this thing working on my Samsung Galaxy S plus (i9001).
I've successfully built camera.ariesve.so (ariesve is my board name) and put in in /system/lib/hw/ but when I try to start Camera app it does not load that module:
Code:
10:22:19.899 Verbose CameraHolder 1852  open camera 0
10:22:19.900 Error CameraService 133  Camera HAL module not loaded
10:22:19.900 Error CameraHolder 1852  fail to connect Camera
10:22:19.900 Error CameraHolder 1852  java.lang.RuntimeException: Fail to connect to camera service
10:22:19.900 Error CameraHolder 1852  	at android.hardware.Camera.native_setup(Native Method)
10:22:19.900 Error CameraHolder 1852  	at android.hardware.Camera.<init>(Camera.java:320)
10:22:19.900 Error CameraHolder 1852  	at android.hardware.Camera.open(Camera.java:280)
10:22:19.900 Error CameraHolder 1852  	at com.android.camera.CameraHolder.open(CameraHolder.java:131)
10:22:19.901 Error CameraHolder 1852  	at com.android.camera.Util.openCamera(Util.java:267)
10:22:19.901 Error CameraHolder 1852  	at com.android.camera.Camera$4.run(Camera.java:1100)
10:22:19.901 Error CameraHolder 1852  	at java.lang.Thread.run(Thread.java:856)
 

lagloose

Senior Member
Feb 11, 2008
728
2,969
Hey,

i'm one of the developers of ICS for Galaxy ACE and just trying to get camera working. Unfortunately no success yet, but perhaps you can help me...
Here's what i did:

- i used the msm7x727 camera lib from this thread: http://xdaforums.com/showthread.php?t=1624018

Seem's to me that this is a 'port' of rpmv78's solution. Due to the fact that HTC Hero and Galaxy ACE have same chipsets there should be a chance that it works.

- First try: i used proprietary libs (libcamera.so, liboemcamera.so etc.) from a (STOCK Galaxy ACE) gingerbread ROM. Result is a missing symbol in libs. Here's part of logcat during boot:

----
D/AudioHardwareInterface( 145): setMode(NORMAL)
I/AudioHardware( 145): Set master volume to 1.
I/CameraService( 145): CameraService started (pid=145)
E/HAL ( 145): load: module=/system/lib/hw/camera.msm7x27.so
E/HAL ( 145): Cannot load library: link_image[1965]: 145 could not load needed library 'libcamera.so' for 'camera.msm7x27.so' (reloc_library[1314]: 145 cannot locate '_ZN7android7Overlay5setFdEi'...
E/HAL ( 145): )
E/CameraService( 145): Could not load camera HAL module
----

Than i tried to find out where '_ZN7android7Overlay5setFdEi...' can be found. It is in libui.so (of GB ROM) and i hardly doubt that i can simply replace an ICS libui with an GB libui.

- Second try: i used proprietary camera libs from this ROM: http://xdaforums.com/showthread.php?t=1612140

Camera module and HAL loads but as soon as i start camera, i'll get:

----
V/QualcommCameraHardware( 145): openCameraHardware: call createInstance
D/QualcommCameraHardware( 145): createInstance: E
V/QualcommCameraHardware( 145): Storing the current target type as 1
V/QualcommCameraHardware( 145): constructor EX
V/QualcommCameraHardware( 145): startCamera E
D/memalloc( 453): /dev/pmem: Unmapping buffer base:0x4acc4000 size:3112960 offset:2498560
D/memalloc( 250): /dev/pmem: Freeing buffer base:0x4a408000 size:614400 offset:1884160 fd:240
D/memalloc( 250): /dev/pmem: Freeing buffer base:0x4a49e000 size:614400 offset:2498560 fd:276
D/memalloc( 250): /dev/pmem: Freeing buffer base:0x4a372000 size:614400 offset:1269760 fd:221
V/QualcommCameraHardware( 145): loading liboemcamera at 0xb000ed08
D/dalvikvm( 1034): GC_CONCURRENT freed 252K, 6% free 6747K/7175K, paused 5ms+9ms
I/mm-camera-config( 145): cam_conf fd cfgctrl.camfd:0
I/mm-camera-config( 145): Open config device node : /dev/msm_camera/config0
D/dalvikvm( 1034): GC_FOR_ALLOC freed 26K, 5% free 7010K/7367K, paused 28ms
I/ ( 145): [AWB Calibration]:ctrlfd:29
I/ ( 145): [AWB Calibration] read fuse ID fail
I/ ( 145): [AWB Calibration] cfg.fuse_id_word1:0xa94c86fd
I/ ( 145): [AWB Calibration] cfg.fuse_id_word2:0xa94c8664
I/ ( 145): [AWB Calibration] cfg.fuse_id_word3:0xa94ea124
I/ ( 145): [AWB Calibration] cfg.fuse_id_word4:0xa951db40
E/mm-camera-config( 145): config_init_ctrl: cam_conf_get_sensor_info failed!
W/ThrottleService( 250): unable to find stats for iface rmnet0
W/ActivityManager( 250): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 250): Activity idle timeout for ActivityRecord{413ff410 com.android.camera/.Camera}
D/dalvikvm( 250): GC_CONCURRENT freed 551K, 10% free 9416K/10439K, paused 12ms+8ms
I/InputDispatcher( 250): Application is not responding: AppWindowToken{41309880 token=Token{41396428 ActivityRecord{413ff410 com.android.camera/.Camera}}}. 5005.8ms since event, 5005.6ms since wait started
I/WindowManager( 250): Input event dispatching timed out sending to application AppWindowToken{41309880 token=Token{41396428 ActivityRecord{413ff410 com.android.camera/.Camera}}}
I/Process ( 250): Sending signal. PID: 1034 SIG: 3
I/dalvikvm( 1034): threadid=3: reacting to signal 3
I/dalvikvm( 1034): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 250): Sending signal. PID: 250 SIG: 3
I/dalvikvm( 250): threadid=3: reacting to signal 3
I/dalvikvm( 250): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 250): Sending signal. PID: 442 SIG: 3
I/dalvikvm( 442): threadid=3: reacting to signal 3
I/dalvikvm( 442): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 250): Sending signal. PID: 365 SIG: 3
I/dalvikvm( 365): threadid=3: reacting to signal 3
I/dalvikvm( 365): Wrote stack traces to '/data/anr/traces.txt'
D/dalvikvm( 250): GC_CONCURRENT freed 546K, 9% free 9597K/10439K, paused 4ms+9ms
D/dalvikvm( 250): GC_EXPLICIT freed 76K, 9% free 9600K/10439K, paused 6ms+8ms
E/ActivityManager( 250): ANR in com.android.camera (com.android.camera/.Camera)
E/ActivityManager( 250): Reason: keyDispatchingTimedOut
E/ActivityManager( 250): Load: 7.27 / 3.0 / 1.11
E/ActivityManager( 250): CPU usage from 12799ms to 2797ms ago:
E/ActivityManager( 250): 3.9% 250/system_server: 2.9% user + 1% kernel / faults: 83 minor
E/ActivityManager( 250): 1.7% 68/bma_wq: 0% user + 1.7% kernel
E/ActivityManager( 250): 0.5% 64/synaptics_wq: 0% user + 0.5% kernel
E/ActivityManager( 250): 0.5% 365/com.android.systemui: 0.4% user + 0.1% kernel / faults: 4 minor
E/ActivityManager( 250): 0.5% 442/com.android.phone: 0.4% user + 0.1% kernel / faults: 1 minor
E/ActivityManager( 250): 0.3% 27/ksmd: 0% user + 0.3% kernel
E/ActivityManager( 250): 0.1% 5/events/0: 0% user + 0.1% kernel
E/ActivityManager( 250): 0.1% 15/kondemand/0: 0% user + 0.1% kernel
E/ActivityManager( 250): 0% 61/file-storage: 0% user + 0% kernel
E/ActivityManager( 250): 0.1% 65/check_ic_wq: 0% user + 0.1% kernel
E/ActivityManager( 250): 0% 101/jbd2/stl13-8: 0% user + 0% kernel
E/ActivityManager( 250): 0% 139/vold: 0% user + 0% kernel / faults: 51 minor
E/ActivityManager( 250): 0% 218/logcat: 0% user + 0% kernel
E/ActivityManager( 250): 4.3% TOTAL: 2.8% user + 1.4% kernel
E/ActivityManager( 250): CPU usage from 587ms to 1122ms later with 99% awake:
E/ActivityManager( 250): 11% 250/system_server: 5.5% user + 5.5% kernel
E/ActivityManager( 250): 9.2% 318/InputDispatcher: 1.8% user + 7.4% kernel
E/ActivityManager( 250): 1.8% 252/GC: 1.8% user + 0% kernel
E/ActivityManager( 250): 1% 15/kondemand/0: 0% user + 1% kernel
E/ActivityManager( 250): 7.5% TOTAL: 7.5% user + 0% kernel
D/dalvikvm( 250): GC_FOR_ALLOC freed 323K, 10% free 9486K/10503K, paused 74ms
----

Any idea, what i could do ?

Thanks, lagloose
 

lagloose

Senior Member
Feb 11, 2008
728
2,969
Hey folks,

i know this is not Galaxy Ace Thread but meanwhile i'm a little frustrated and have no idea how to go on, so i decided to ask here if someone has an idea what i can do or try. I have camera working on Galaxy ACE with no preview. Camera seems to be initialized correctly. I can shoot pictures with stock camera but no preview...
IMO preview can't be shown because of this SIGFPE in libc which is obviously thrown through calling 'initDefaultParameters'

...
V/QualcommCameraHardware( 145): startCamera picture_sizes 0xa7758430 PICTURE_SIZE_COUNT 7
V/QualcommCameraHardware( 145): startCamera preview_sizes 0xa7758468 previewSizeCount 5
V/QualcommCameraHardware( 145): startCamera X
I/QualcommCameraHardware( 145): initDefaultParameters E
F/libc ( 145): Fatal signal 8 (SIGFPE) at 0x00000091 (code=0)
I/Process ( 309): Sending signal. PID: 1421 SIG: 3
I/dalvikvm( 1421): threadid=3: reacting to signal 3
I/dalvikvm( 1421): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 309): Sending signal. PID: 1421 SIG: 3
I/dalvikvm( 1421): threadid=3: reacting to signal 3
...

This gives followup errors so that preview is not shown. Due to the fact that i've used proprietary libcamera.so from a stock ROM i've only limited possibilities to debug... I've attached a complete logcat from starting camera app through shooting a picture and ending camera app.

Anyone who can help ? if the answer is not of general interest, reply via PM to avoid flooding this thread.
 

Attachments

  • logcat_cooper_camera.txt
    40 KB · Views: 26

championswimmer

Inactive Recognized Developer
Oct 22, 2011
5,018
8,446
New Delhi
android.championswimmer.tk
regarding this
If people have requests for other qualcomm devices after having tried the HAL included in the zip file, kindly include the following information.
1) logcat from having used the HAL module.
2) build.prop
3) libcamera.so from gingerbread ROM for the device.
4) liboemcamera.so from gingerbread ROM.

are you still interested in helping ?
i am trying to make camera work on Xperia X10 which is also qsd8k and uses 2.6.29 kernel
it has an opensource libcamera.so for gb as well as an alternate libcamera wrapper which works like this
libcamera.so > libcamerasemc.so (the libcamera present in stock rom renamed this way) > liboemcamera.so

also recently sony has released the sources for their gb libcamera recently and that can be used to compile a working gb libcamera atm

so almost everything is open source... but i'm kinda noobish when it comes to cpp and thus i need some help
 
  • Like
Reactions: paolo-red1

abhishek046

Senior Member
Apr 11, 2012
137
120
Bangalore
ARMV6

@rapmv78 Hey, I'm trying to fix the camera for cm9 & cm10 roms for the LG P690 aka LG OPTIMUS NET. Here's the logcat output that I get on initialising the camera.

I/ActivityManager( 1630): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera bnds=[0,330][80,417]} from pid 2756
I/ActivityManager( 1630): Start proc com.android.camera for activity com.android.camera/.Camera: pid=4470 uid=10032 gids={1006, 1015}
V/CameraHolder( 4470): open camera 0
E/CameraService( 1506): Camera HAL module not loaded
E/CameraHolder( 4470): fail to connect Camera
E/CameraHolder( 4470): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 4470): at android.hardware.Camera.native_setup(Native Method)
E/CameraHolder( 4470): at android.hardware.Camera.<init>(Camera.java:320)
E/CameraHolder( 4470): at android.hardware.Camera.open(Camera.java:280)
E/CameraHolder( 4470): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
E/CameraHolder( 4470): at com.android.camera.Util.openCamera(Util.java:267)
E/CameraHolder( 4470): at com.android.camera.Camera$4.run(Camera.java:1145)
E/CameraHolder( 4470): at java.lang.Thread.run(Thread.java:856)
V/camera ( 4470): surfaceChanged. w=320. h=427
I/ActivityManager( 1630): Displayed com.android.camera/.Camera: +666ms

Its evident that the HAL module is failing to load. I've tried using your HAL module but the phone gets into a bootloop. I've replaced the libcamera.so and liboemcamera.so along with your apk. My device is an armv6 one and is a msm7x27 one. Also, camera.goldfish.so and camera.msm7x27.so are the only 2 libs in both roms related to camera present in /system/lib/hw. I've tried replacing both these files with your HAL by trial and error. I also tried renaming your HAL into camera.p690.so and then using it without replacing any of the 2 files above. Results were same.

I've attached links to the build.prop, libcamera.so and liboemcamera.so. I couldn't do a logcat because with your HAL the phone doesn't get past the boot image itself! Plz help me out...........

http://www.mediafire.com/download.php?0mgkwgieagm4h7w -----> build.prop
http://www.mediafire.com/download.php?3lz4otljpnqfvo3 ------> libcamera.so
http://www.mediafire.com/download.php?4xeg0flhap9eud8 -------> liboemcamera.so
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 142
    I have re-written the ICS camera HAL module to be a thin wrapper for the gingerbread libcamera.so and hence it will only work with the 2.6 kernel. The advantage is that getting to gingerbread level functionality should be quick :) Creating a new thread because there is a slight chance that this will work for all qualcomm devices with existing libcamera.so files (with slight mods ofcourse :))

    http://www.mediafire.com/download.php?wjf035mz2vzunw4

    Here is a zip file which contains the new camera HAL module. README file accompanying it has instructions on the locations for the files. If you already have the previous version of camera HAL working, all you have to do is replace camera.qsd8k.so and libcamera.so with the ones in the zip file.

    What works:
    1) Preview works.
    2) Taking a picture works pretty well.
    3) Size of picture is no longer huge.
    4) Software zoom works.
    5) Most of the other knobs like focus, file size etc. seemed to work as well in my testing.
    6) Pretty stable as far as I can see :)

    Not working yet:
    Video and other fancy stuff.

    If people have requests for other qualcomm devices after having tried the HAL included in the zip file, kindly include the following information.
    1) logcat from having used the HAL module.
    2) build.prop
    3) libcamera.so from gingerbread ROM for the device.
    4) liboemcamera.so from gingerbread ROM.

    Currently known to work on the following devices:
    1) Nexus One.
    2) HTC Desire
    3) HTC HD2

    Enjoy and thanks for all the feedback.
    55
    Updates:

    02/09/2012

    Working barcode scanner mode

    Flashable zip file (should work with texasice's ROMs)
    http://www.mediafire.com/?w4fu0u05qtxq3tu

    01/30/2012
    Working Panorama mode

    Flashable zip file (should work with texasice's ROMs)
    http://www.mediafire.com/?5r599m5jg5yfaqn

    Known issues:
    Sometimes screen has some garbage while in Panorama mode viewfinder. Quitting completely from the app and restart or invoking Gallery from inside the app and returning back to camera app should mostly fix it.

    Video enabled version:

    Fastboot compatible images compiled from evervolv base:

    For Stock hboot :
    http://www.mediafire.com/?wdlip7h6necetia

    For HBoot(s) supporting larger /system partition
    http://www.mediafire.com/?f6rz3sz2r97qln0

    Source code is now available at
    https://github.com/rapmv78/
    14
    Got video to work finally with hardware encoder support as well. It is not as smooth as I would like it to, but I do not know what the issue is. I could see that all frames were encoded, so the issue is probably in the encoder or my SD card is slow. Would like some feedback on whether others see some stutters too or not. Updated the second post with new fastboot system images. Also source code is now available on my github, as promised :) DISCLAIMER: The code has a bunch of hacks and is not very clean, as I did not get much time to clean it up before sharing.

    For people with non-nexus devices, you can use the source code to compile your own or here is just the HAL module as a separate download

    http://www.mediafire.com/?87nizd1jrx01j49

    You also need

    media_profiles.xml which should to into /system/etc/

    http://www.mediafire.com/?ig6t931i8h3zhzf

    libmediaplayer.so which should go into /system/lib/

    http://www.mediafire.com/?8jb64a94tdfe4vp

    Here are the source changes for libmediaplayer.so
    --- a/frameworks/base/media/libmediaplayerservice/StagefrightRecorder.cpp
    +++ b/frameworks/base/media/libmediaplayerservice/StagefrightRecorder.cpp

    uint32_t encoder_flags = 0;
    - if (mIsMetaDataStoredInVideoBuffers) {
    + if (0 && mIsMetaDataStoredInVideoBuffers) {
    encoder_flags |= OMXCodec::kHardwareCodecsOnly;
    encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
    }

    Enjoy!!
    13
    Just updated the second post with a new flashable zip to enable panorama mode.
    The black lines should be either completely gone or very rare as far as I can tell.
    A bonus, Gallery hanging randomly should be fixed as well.
    Enjoy and thanks a lot for your feedback. Please keep them coming.
    12
    Have updated the post with another flashable zip file which should fix colors for the panorama mode and also the barcode scanner mode should work now.

    Enjoy!!