Module: xenomai-abe
Branch: experimental
Commit: d116669ee0c28709d026802dfdc1c0ebc7a80162
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=d116669ee0c28709d026802dfdc1c0ebc7a80162

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Sun Mar  6 00:44:39 2011 +0100

analogy: [fake] correctly manage EOA events for loop subdevices

---

 ksrc/drivers/analogy/testing/fake.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ksrc/drivers/analogy/testing/fake.c 
b/ksrc/drivers/analogy/testing/fake.c
index d8f8cda..d82abb0 100644
--- a/ksrc/drivers/analogy/testing/fake.c
+++ b/ksrc/drivers/analogy/testing/fake.c
@@ -208,10 +208,12 @@ int ai2_push_values(a4l_subd_t *subd)
                        a4l_err(subd->dev, 
                                "ai2_push_values: "
                                "a4l_buf_put failed (err=%d)\n", err);
-       }
+               else {
+                       priv->count = 0;
+                       a4l_buf_evt(subd, 0);
+               }
 
-       if (priv->count)
-               a4l_buf_evt(subd, 0);
+       }
 
        return err;
 }
@@ -330,9 +332,21 @@ int ao_trigger(a4l_subd_t *subd, lsampl_t trignum)
 int ao_cancel(a4l_subd_t *subd)
 {
        struct fake_priv *priv = (struct fake_priv *)subd->dev->priv;
+       int running;
 
        a4l_info(subd->dev, "ao_cancel: (subd=%d)\n", subd->idx);
        RTDM_EXECUTE_ATOMICALLY(priv->ao_running = 0);
+
+       RTDM_EXECUTE_ATOMICALLY(running = priv->ai2_running);
+       if (running) {
+               a4l_subd_t *ai2_subd = 
+                       (a4l_subd_t *)a4l_get_subd(subd->dev, AI2_SUBD);
+               /* Here, we have not saved the required amount of
+                  data; so, we cannot know whether or not, it is the
+                  end of the acquisition; that is why we force it */
+               a4l_buf_evt(ai2_subd, A4L_BUF_EOA);
+       }
+
        return 0;
 }
 


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

Reply via email to