Nexus 7, Linux, Accelerometer, sensorfw

This is just a brief wrap up about a patch I just submitted: in a nutshell, this patch enables the practical use of the acceleration sensor on Nexus 7 in Linux.

Thanks a lot to Glueckself who posted a first guide on how to manually read data from the Nexus 7 accelerometer to the Mer wiki: https://wiki.merproject.org/wiki/Community_Workspace/Tegra3/Nexus7#Accelerometer_.2F_Gyroscope This, however, does not enable the practical usage of the sensor in apps.

In order to make practical use of the sensor, additional software, like sensorfw/sensord is needed. The cool thing about sensorfw/sensord is that once a sensor works there, it also works in QtMobility and thus works in all apps that utilitze QtMobility.

Following is a small video that shows the Stellarium N9 app as well as the “show-acceleration” command line application from the QtMobility examples:

Please note that, right now, the accelerometer sensor has to be manually enabled after each boot the way Glueckself described. For convenience, the require steps are described below (Executed as root.):

cd /sys/devices/platform/tegra-i2c.2/i2c-2/2-0068/iio\:device0/
echo 10 > buffer/length
for i in scan_elements/in_*en ; do echo 1 > $i ; done
echo 1 > buffer/enable

Similarly to the description by Glueckself linked above, the magnetometer can be accessed in sysfs here: “/sys/devices/platform/tegra-i2c.2/i2c-2/2-000e/iio:device1” Unfortunately, getting the magnetometer to work is much more complicated. Additionally to the adaptor for reading the raw data from the sensor, in this case, also a chain implementation, namely the compasschain, is needed. According to this post there are legal issues with an older compasschain implementation that prohibit it’s publication.

So, to get the magnetometer running, at least an adaptor and a chain must be implemented. The chain seems to be the more complicated part. My understanding is that, amongst others, the chain performs some processing of the data that allows the easy consumption of the data by other software pieces like QtMobility. Probably the first step to coming up with such a chain implementation is to have a specification of what the output data should look like. Unfortunately, I couldn’t find any information about this yet. Any helpful insights are highly appreciated.

Advertisements
This entry was posted in Announcements, Other Software and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s