Build and Run
Build
My assumption is that you have gotten the source by
git-clone git://git.moblin.org/sensor-framework.gitFollow below steps to configure and build source:
./autogen.sh --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/infoFramework is built based on autoconf/automake/libtool.These tools are mandatory,make sure they have been installed in your system. Besides them, framework also requires glib, gmodule, gobject and GStreamer while GStreamer is optional. The configuration process will check each component and stop if mandatory component is lost.
make
sudo make installNow framework should have been installed in your system. You will find libraries at
/usr/lib/libsensorapi.so
/usr/lib/libsensorcore.so
/usr/lib/sensorframework/modules/libmodule-accel-simulator.so.0
/usr/lib/sensorframework/modules/libmodule-als-simulator.so.0
/usr/lib/sensorframework/modules/libmodule-mrst-accel.so.0
/usr/lib/sensorframework/modules/libmodule-mrst-als.so.0libsensorapi.so is for application whilst libsensorcore.so is for sensor daemon. Others are plugin modules loaded/unloaded by sensor daemon.
/usr/bin/sensordThis is executable binary of sensor daemon
All header files are located at:
/usr/include/sensorframeworkPls note that header files of framework is not fully normalized. There will be subsequent changes, however, our tendency is that application only simply includes "sf.h"
There is also a configure file "module.conf" at /etc/sesnorframework/module.conf. Will explain details about it later.
Run
You are able to launch sensor daemon by:
sensord -c path_to_module.conf -d path_to_plugin_modulestypically:
sensord -c /etc/sensorframework/module.conf -d /usr/lib/sensorframework/modules
Configure file
module.conf is a configure file for pulgins who directly talk to driver. Usually pulgins have their personal parameter which decided by its author. For example, to plugin of accelerometer driver on Moonstown, pathes to x/y/z axis interface are required.
module.conf contains a seires of entires while each entry represents a plugin. The entry strictly follows specification defined by "Key-value file parser" of glib. The format is:
[module name]
key1 = value1
key2 = value2
key3 = value3
.......................
keyN = valueNhere "module name" is name of plugin library trims off prefix "lib" and suffix ",.so". For example, the "module name" of libmodule-mrst-accel.so is "module-mrst-accel". Please fill "module name" with correct value otherwise sesnor daemon will not load plugin.
Each key is parameter required by plugin module. We will inroduce a tool later to get parameter list of each plugin. Below is a example of accelerometer pulgin on Moonstown:
[module-mrst-accel]
x-path = /sys/class/hwmon/hwmon3/device/mrst_accel/x_out
y-path = /sys/class/hwmon/hwmon3/device/mrst_accel/y_out
z-path = /sys/class/hwmon/hwmon3/device/mrst_accel/z_out
#Sample interval in ms
sample-interval = 10Before launching sensor daemon, make sure each parameter required by pulgin is rightly configured.
There are three in-source configure files.
module.conf --- generic configure file, typically as a template
module-MRST.conf --- configure file for MRST
module-phidget.conf --- configure file for Phidget USB accelerometer
Compile your application with sensorframework
This work is very easy with pkg-config. Below command does all things for you:
gcc your_application.c -o binary_name_of_your_application `pkg-config --libs --cflags sensorframework`or you may add below lines in your Makefile:
CFLAGS=`pkg-config --cflags sensorframework`
LDFLAGS=`pkg-config --libs sensorframework`- Printer-friendly version
- Login or register to post comments
Comments (2 total)
Paths needs --prefix
All the paths here need to be prefixed with $PREFIX, which was set to /usr at autogen time. In other words, the module.conf file is not located at /etc/sensorframework/module.conf. It is located at /usr/sensorframework/module.conf.
thx Clayne, I fixed it with
thx Clayne, I fixed it with full parameters :)