Module: xenomai-2.5
Branch: master
Commit: 734ee783a29e94e0d20d82cfe339d64cf2380c0a
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=734ee783a29e94e0d20d82cfe339d64cf2380c0a

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Sat Feb  6 23:05:08 2010 +0100

analogy: [fake] send events only if data are sent to userspace

---

 ksrc/drivers/analogy/testing/fake.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/ksrc/drivers/analogy/testing/fake.c 
b/ksrc/drivers/analogy/testing/fake.c
index 1536bfb..27d6d88 100644
--- a/ksrc/drivers/analogy/testing/fake.c
+++ b/ksrc/drivers/analogy/testing/fake.c
@@ -125,26 +125,24 @@ static void ai_task_proc(void *arg)
                        elapsed_ns += now_ns - priv->last_ns + 
priv->reminder_ns;
                        priv->last_ns = now_ns;
 
-                       while(elapsed_ns >= priv->scan_period_ns)
-                       {
+                       while(elapsed_ns >= priv->scan_period_ns) {
                                int j;
-
-                               for(j = 0; j < cmd->nb_chan; j++)
-                               {
+                               
+                               for(j = 0; j < cmd->nb_chan; j++) {
                                        uint16_t value = ai_value_output(priv);
                                        a4l_buf_put(subd, &value, 
sizeof(uint16_t));
-
                                }
-
+                               
                                elapsed_ns -= priv->scan_period_ns;
                                i++;
 
-                       }
+                       }                      
 
                        priv->current_ns += i * priv->scan_period_ns;
                        priv->reminder_ns = elapsed_ns;
 
-                       a4l_buf_evt(subd, 0);
+                       if (i != 0)
+                               a4l_buf_evt(subd, 0);
                }
 
                a4l_task_sleep(AI_TASK_PERIOD);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to