From d412936e905c5e16350b16c3656e6b2db2a70a15 Mon Sep 17 00:00:00 2001
From: Knud Baastrup <kba@deif.com>
Date: Sun, 10 Aug 2014 22:07:39 +0200
Subject: [PATCH] Use call back functions.

Ensures that we use the call back functions (with io lock support) when
using the IOCTL interface. Fixed by Johnny Rasmussen <jra@deif.com>.

Conflicts:
	master/ioctl.c
---
 master/ioctl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/master/ioctl.c b/master/ioctl.c
index bce7c6b..1ee417e 100755
--- a/master/ioctl.c
+++ b/master/ioctl.c
@@ -2244,7 +2244,10 @@ static ATTRIBUTES int ec_ioctl_send(
     if (ec_lock_down_interruptible(&master->master_sem))
         return -EINTR;
 
-    sent_bytes = ecrt_master_send(master);
+    if (master->send_cb != NULL)
+        sent_bytes = master->send_cb(master->cb_data);
+    else
+        sent_bytes = ecrt_master_send(master);
     
     ec_lock_up(&master->master_sem);
 
@@ -2276,7 +2279,10 @@ static ATTRIBUTES int ec_ioctl_receive(
     if (ec_lock_down_interruptible(&master->master_sem))
         return -EINTR;
 
-    ecrt_master_receive(master);
+    if (master->receive_cb != NULL)
+        master->receive_cb(master->cb_data);
+    else
+        ecrt_master_receive(master);
 
     ec_lock_up(&master->master_sem);
     return 0;
-- 
1.9.5.msysgit.0

