XDAndroid Gingerbread Accelerometer Support

Back when I started work on XDAndroid Gingerbread, I had a long list of features that were missing. One of the big entries on that list was the accelerometer. For accelerometer support, we rely on a sensors driver in the system.ext2 image that listens for events from the device.

In Gingerbread, a lot of the glue between those drivers and the Android system has changed, resulting in the incompatibilities we see now. This meant a rewrite was necessary for the driver we use. Today, I did the rewrite and got accelerometer support for Gingerbread. Those of you building from source can repo sync and get the updates now. Users will have to wait for a new system image (sorry).

The new driver is based on the HTC Passion (Nexus One) sensors driver, which is written in C++. The driver uses a few simple classes to do the heavy lifting, so the end result is a very manageable, simple and easy to understand driver. Down the line, we can also add proper proximity sensor support to the driver for Rhodium.

For developers and advanced users, the driver now resides in our device/xdandroid tree to follow upstream conventions. Please see the relevant commit for reference (and ignore the GPS change which I accidentally stuck in BoardConfig).

Thanks for reading!

5 thoughts on “XDAndroid Gingerbread Accelerometer Support”

  1. I compiled a new system.ext2 from source after i did a repo sync and the accelerometer on my HTC Pure (Topa210) still does not function. I do like this build, very fast. Keep up the great work, and thanks for your time and effort!

  2. thejokah,

    Check your device’s logcat for any message about nusensors attempting to load the sensors driver in compatibility mode.

    If you see something like that, you need to rebuild frameworks/base. There is a BuildConfig change that concerns frameworks/base, which may not have been rebuilt for you (the build system is unable to track such changes itself).

    Please ensure that the framework was rebuilt by issuing: make installclean ; make clean-framework ; make

    This will cause the build system to remove all installed files (out/target/product/msm) and all intermediate files for frameworks/base, then rebuild frameworks/base and rerun the installation process.

    Thanks.

  3. thanks for your reply. i did issue “make clean” first, but i will try others to rebuild frameworks. This might be the problem. if not i will get a demesg and logcat.

  4. thejokah@ubuntu:~/gingerbread$ make clean-framework
    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=2.3.1
    TARGET_PRODUCT=full_msm
    TARGET_BUILD_VARIANT=userdebug
    TARGET_SIMULATOR=
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=GINGERBREAD
    ============================================
    find: `frameworks/base/frameworks/base/docs/html’: No such file or directory
    find: `out/target/common/docs/gen’: No such file or directory
    find: `frameworks/base/frameworks/base/docs/html’: No such file or directory
    find: `out/target/common/docs/gen’: No such file or directory
    find: `frameworks/base/frameworks/base/docs/html’: No such file or directory
    find: `out/target/common/docs/gen’: No such file or directory
    find: `frameworks/base/frameworks/base/docs/html’: No such file or directory
    find: `out/target/common/docs/gen’: No such file or directory
    find: `frameworks/base/frameworks/base/docs/html’: No such file or directory
    find: `out/target/common/docs/gen’: No such file or directory
    diff: out/target/product/msm/obj/PACKAGING/updater_extensions_intermediates/register.inc.list: No such file or directory
    No private recovery resources for TARGET_DEVICE msm
    Clean: framework

    This is what it gives me after “make clean-framework”

Leave a Reply