From 48d6d33296077f1e7e22e354fa54fe7771635507 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 17 Jul 2002 21:55:33 +0000 Subject: [PATCH] added error handling for failed writes to buffer --- comedi/drivers/comedi_fc.c | 15 +++++++++++++++ comedi/drivers/comedi_fc.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/comedi/drivers/comedi_fc.c b/comedi/drivers/comedi_fc.c index e3e964b6..d45a77aa 100644 --- a/comedi/drivers/comedi_fc.c +++ b/comedi/drivers/comedi_fc.c @@ -102,6 +102,21 @@ unsigned int cfc_read_array_from_buffer( comedi_subdevice *subd, void *data, return num_bytes; } +unsigned int cfc_handle_events( comedi_device *dev, comedi_subdevice *subd ) +{ + unsigned int events = subd->async->events; + + if( events & COMEDI_CB_ERROR ) + events |= COMEDI_CB_EOA; + + if( events & COMEDI_CB_EOA ) + subd->cancel( dev, subd ); + + comedi_event( dev, subd, events ); + + return events; +} + MODULE_AUTHOR("Frank Mori Hess "); MODULE_DESCRIPTION("Shared functoins for Comedi low-level drivers"); MODULE_LICENSE("GPL"); diff --git a/comedi/drivers/comedi_fc.h b/comedi/drivers/comedi_fc.h index 5e49c7ca..46ed5ee2 100644 --- a/comedi/drivers/comedi_fc.h +++ b/comedi/drivers/comedi_fc.h @@ -44,3 +44,5 @@ inline unsigned int cfc_write_long_to_buffer( comedi_subdevice *subd, lsampl_t d unsigned int cfc_read_array_from_buffer( comedi_subdevice *subd, void *data, unsigned int num_bytes ); + +unsigned int cfc_handle_events( comedi_device *dev, comedi_subdevice *subd ); -- 2.26.2