Most of you know that we have a working camera with CM6 (froyo) ROMs. Some of you also know that, in theory, a camera lib that works on froyo can be used for gingerbread as well - because CM7 has a built-in wrapper to allow the use of froyo compatible libcamera binaries.
Now, so why does the pulse have a camera in froyo and not in gingerbread? The answer is simple: our libcamera isn't froyo compatible. There were two major changes between eclair and froyo:
- libui was split into libui, libcamera_client and libsurfaceflinger_client
- components inside libbinder ("MemoryDealer" and others) were modified and expose a slightly different API
In CM6, the camera only works because all above mentioned changes (eclair -> froyo) have been reverted when compiling CM6 for the pulse. The libui of CM6 (for the pulse, not in general!) is merged again with libcamera_client. Therefore, you won't find libcamera_client.so in a pulse CM6 ROM. Also, libbinder is modified to use eclair MemoryDealer. As a consequence, any library that depends on either libbinder, libui, libcamera_client or libsurfaceflinger_client is different in pulse-CM6 compared to any other CM6 build.
I followed an alternative approach: instead of patching the CM source to work with an old binary, I hexedited the binary to load an additional library. This additional library ("camera.so") contains wrappers for libbinder and libcamera_client.
The combination of hexedited "libcamera.so" and helper library "camera.so" integrates into an existing ROM like a normal froyo compatible libcamera.
It should therefore work on any froyo ROM, or on any non-froyo ROMs that require a froyo libcamera.
Anyone wants to know what happens when placing those two small files into a CM7 ROM? Be prepared...
Edited by dr.flo, 24 January 2012 - 07:55 AM.