Set the delay (in ms) between events the lis302dl kernel module generates.
With this can control the amount of cpu fsodeviced uses when the accelerometer
is enabled/generating events.

Signed-off-by: Peter van de Werken <pwerken-...@a-eskwadraat.nl>
---
 fsodeviced/conf/openmoko_gta/fsodeviced.conf       |    1 +
 .../src/plugins/accelerometer_lis302/plugin.vala   |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fsodeviced/conf/openmoko_gta/fsodeviced.conf 
b/fsodeviced/conf/openmoko_gta/fsodeviced.conf
index d04570f..5d1ac8c 100644
--- a/fsodeviced/conf/openmoko_gta/fsodeviced.conf
+++ b/fsodeviced/conf/openmoko_gta/fsodeviced.conf
@@ -12,6 +12,7 @@ log_destination = /var/log/fsodeviced.log
 [fsodevice.accelerometer_lis302]
 inputnode = /input/event4
 sysfsnode = /bus/spi/devices/spi3.0/
+duration = 200
 sample_rate = 100
 threshold = 54
 full_scale = 2.3
diff --git a/fsodeviced/src/plugins/accelerometer_lis302/plugin.vala 
b/fsodeviced/src/plugins/accelerometer_lis302/plugin.vala
index 0fc60ef..1f2aa4c 100644
--- a/fsodeviced/src/plugins/accelerometer_lis302/plugin.vala
+++ b/fsodeviced/src/plugins/accelerometer_lis302/plugin.vala
@@ -25,6 +25,7 @@ namespace Hardware {
     internal const string DEFAULT_EVENT_NODE = "/input/event4";
     internal const string LIS302_CONFIGURATION_NODE = 
"/bus/spi/devices/spi3.0/";
 
+    internal const int LIS302_DEFAULT_DURATION = 200;
     internal const int LIS302_DEFAULT_SAMPLERATE = 100;
     internal const int LIS302_DEFAULT_THRESHOLD = 54;
     internal const string LIS302_DEFAULT_FULLSCALE = "2.3";
@@ -34,6 +35,7 @@ class AccelerometerLis302 : FsoDevice.BaseAccelerometer
     private string inputnode;
     private string sysfsnode;
 
+    private uint duration;
     private uint sample_rate;
     private uint threshold;
     private string full_scale;
@@ -54,6 +56,7 @@ class AccelerometerLis302 : FsoDevice.BaseAccelerometer
         var devfs_root = config.stringValue( "cornucopia", "devfs_root", 
"/dev" );
         inputnode = devfs_root + config.stringValue( PLUGIN_NAME, "inputnode", 
DEFAULT_EVENT_NODE );
         sysfsnode = sysfs_root + config.stringValue( PLUGIN_NAME, "sysfsnode", 
LIS302_CONFIGURATION_NODE );
+        duration = config.intValue( PLUGIN_NAME, "duration", 
LIS302_DEFAULT_DURATION );
         sample_rate = config.intValue( PLUGIN_NAME, "sample_rate", 
LIS302_DEFAULT_SAMPLERATE );
         threshold = config.intValue( PLUGIN_NAME, "threshold", 
LIS302_DEFAULT_THRESHOLD );
         full_scale = config.stringValue( PLUGIN_NAME, "full_scale", 
LIS302_DEFAULT_FULLSCALE );
@@ -65,6 +68,7 @@ class AccelerometerLis302 : FsoDevice.BaseAccelerometer
         }
         else
         {
+            FsoFramework.FileHandling.write( duration.to_string(), sysfsnode + 
"/duration" );
             FsoFramework.FileHandling.write( sample_rate.to_string(), 
sysfsnode + "/sample_rate" );
             FsoFramework.FileHandling.write( threshold.to_string(), sysfsnode 
+ "/threshold" );
             FsoFramework.FileHandling.write( full_scale, sysfsnode + 
"/full_scale" );
-- 
1.7

_______________________________________________
Smartphones-userland mailing list
Smartphones-userland@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/smartphones-userland

Reply via email to