--- a/master/cdev.c Fri Aug 21 09:45:53 2009 +0200
+++ b/master/cdev.c Fri Aug 21 09:46:29 2009 +0200
@@ -175,6 +175,7 @@
data.eoe_handler_count = ec_master_eoe_handler_count(master);
#endif
data.phase = (uint8_t) master->phase;
+ data.active = (uint8_t) master->active;
data.scan_busy = master->scan_busy;
up(&master->master_sem);
@@ -1647,6 +1648,23 @@
/*****************************************************************************/
+/** Deactivates the master.
+ */
+int ec_cdev_ioctl_deactivate(
+ ec_master_t *master, /**< EtherCAT master. */
+ unsigned long arg, /**< ioctl() argument. */
+ ec_cdev_priv_t *priv /**< Private data structure of file handle. */
+ )
+{
+ if (unlikely(!priv->requested))
+ return -EPERM;
+
+ ecrt_master_deactivate(master);
+ return 0;
+}
+
+/*****************************************************************************/
+
/** Send frames.
*/
int ec_cdev_ioctl_send(
@@ -3262,6 +3280,10 @@
if (!(filp->f_mode & FMODE_WRITE))
return -EPERM;
return ec_cdev_ioctl_activate(master, arg, priv);
+ case EC_IOCTL_DEACTIVATE:
+ if (!(filp->f_mode & FMODE_WRITE))
+ return -EPERM;
+ return ec_cdev_ioctl_deactivate(master, arg, priv);
case EC_IOCTL_SEND:
if (!(filp->f_mode & FMODE_WRITE))
return -EPERM;