Re: Orientation sensors at HAL

272 views
Skip to first unread message

Chinmay V S

unread,
Nov 14, 2011, 1:52:07 AM11/14/11
to sarika baby, android-porting

On Mon, Nov 14, 2011 at 11:51 AM, sarika baby <sarika...@gmail.com> wrote:
Hello,
    I read your blog http://thecodeartist.blogspot.com/search/label/Sensors it was quite interesting.Actually i am trying to integrate orientation sensors at HAL and i am not able to implement it properly.Can you kindly help me.

--
Regards
SarikA


Hi Sarika,

The log "couldn't load sensors module" is logged from

android/frameworks/base/services/sensorservice/SensorDevice.cpp
    status_t err = hw_get_module(SENSORS_HARDWARE_MODULE_ID,
            (hw_module_t const**)&mSensorModule);

    LOGE_IF(err, "couldn't load %s module (%s)",
            SENSORS_HARDWARE_MODULE_ID, strerror(-err));

hw_get_module() is implemented in android/hardware/libhardware/hardware.c

You might want to look into the code and log a few more variables to see why it is failing in ur case.

The most common reason would be a missing/improperly-named sensors lib in /system/lib/hw/ on your device.

hw_get_module() expects the sensors-lib to be named as one of the following:

static const char *variant_keys[] = {
    "ro.hardware",  /* This goes first so that it can pick up a different
                       file on the emulator. */
    "ro.product.board",
    "ro.board.platform",
    "ro.arch"
};

This is done in the Android.mk file in libsensors directory. For example to name the sensors lib specific to the board.platform, the following line goes into Android.mk:
LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM)

Finally the file sensors.*.so must be present in /system/lib/hw on the device.


GoodLUCK!
- CVS

Chinmay V S

unread,
Nov 14, 2011, 10:02:52 AM11/14/11
to sarika baby, android-porting
On Mon, Nov 14, 2011 at 7:54 PM, sarika baby <sarika...@gmail.com> wrote:

Hello,
    I am trying to implement orientation sensor and for that reason i added Orientsensor.cpp , Orientsensor.h in mydroid/device/ti/pandaboard/libsensors/
   And i am trying to display the pitch, roll, azimuth values using TI sensor test application but i am not able to display the values. can you help me why?


Regards
Sarika


Yaw, pitch, roll are calculated by a combination of accelerometer and compass sensors.
Reference orientation-sensor code in sensor-HAL is available here:
http://www.google.com/codesearch#cZwlSNS7aEw/device/samsung/crespo/libsensors/AkmSensor.cpp
(the same file implements support for accelerometer, magnetic-field & orientation sensor)

Before trying that, the "couldn't load sensors module" error needs to be resolved to ensure that the Android-runtime is properly picking-up your sensor-HAL library. Is it resolved yet?...

regards
CVS

Reply all
Reply to author
Forward
0 new messages