Forums » Replicant development »
libakm on Samsung Galaxy W
Added by ralisi ralisi over 11 years ago
Hi everybody,
i have found that there is a free implementation of Samsung´s libakm.so at gitorious
Is this the most recent version of it? Based on that code, I made it work with the BMA222-sensor in my device, available here
However, my code is just a copy&paste with slight modificatins of the already existing code. This leads my to my question: does anyone know, if the libakm is used by a variety of other phones and sensors, or only quite a few and that's it? If it were several, I might consider a redesign in order to avaoid code-duplication.
Replies (3)
RE: libakm on Samsung Galaxy W - Added by Paul Kocialkowski over 11 years ago
I think I'll drop libakm_free in the future since it's better to deal with sensors at the sensors module level instead of using yet another library. So yes, the version on gitorious is the most recent version, but it doesn't support a lot of sensors.
The reason it exists is because Samsung has been using it for devices with AKM magnetic sensors (AKM8975 and AKM8973 mostly) but it also contained the accelerometer code. Other manufacturers use it in the form of a daemon, akmd. What they do is simply to hold the magic of the conversion of bare numbers that come out of the chip to SI units.
Nowadays, I prefer to write the sensors module from scratch and include the implementation of the units conversion there.
RE: libakm on Samsung Galaxy W - Added by ralisi ralisi over 11 years ago
Hi Paul, thanks for your answer.
So if I understood you correctly, you would only replace the libraray usually located at /system/lib/hw/sensors.$BOARDNAME.so ?
Can you point me to an example, which you would consider a "good" implementation of that?
//raphael
RE: libakm on Samsung Galaxy W - Added by Paul Kocialkowski over 11 years ago
Yes basically, that's what I do now and will keep doing for 4.2, including for devices that used libakm_free in the past. Oh and btw, I forgot about it but I renamed libakm_free samsung-sensors at some point so the latest source is actually: https://gitorious.org/replicant/hardware_samsung-sensors/source/8708271e21ad7dab5d00a3acefed9b7360d3b733:
As for the modules implementation, I think that what comes closest to a clean implementation is what I did for the Galaxy S3: https://gitorious.org/replicant/device_samsung_i9300/source/21ad33bb3a724557f7eee05810cd9319e7b94378:sensors which is an improved version of what I originally wrote for the Galaxy Tab 2 devices.