From 2ee266698973a285341e9e366c1fcc72b582ba28 Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Thu, 26 Jun 2008 13:42:23 +0000 Subject: [PATCH] Operational flag in 'ethercat config'. --- master/cdev.c | 2 ++ master/ioctl.h | 4 +++- tools/Master.cpp | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/master/cdev.c b/master/cdev.c index 94f0fa8f..7f6dbf6e 100644 --- a/master/cdev.c +++ b/master/cdev.c @@ -858,6 +858,8 @@ long eccdev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } data.sdo_count = ec_slave_config_sdo_count(sc); data.attached = sc->slave != NULL; + data.operational = sc->slave && + sc->slave->current_state == EC_SLAVE_STATE_OP; if (copy_to_user((void __user *) arg, &data, sizeof(data))) retval = -EFAULT; diff --git a/master/ioctl.h b/master/ioctl.h index 4f3cb7ab..deb265db 100644 --- a/master/ioctl.h +++ b/master/ioctl.h @@ -296,7 +296,9 @@ typedef struct { uint32_t pdo_count; } syncs[16]; uint32_t sdo_count; - uint8_t attached; + uint8_t attached : 1, + operational : 1; + } ec_ioctl_config_t; /*****************************************************************************/ diff --git a/tools/Master.cpp b/tools/Master.cpp index 63e72e9e..f23b02fa 100644 --- a/tools/Master.cpp +++ b/tools/Master.cpp @@ -198,7 +198,8 @@ void Master::showConfig() << hex << setw(8) << config.vendor_id << endl << "Product code: 0x" << hex << setw(8) << config.product_code << endl - << "Attached: " << (config.attached ? "yes" : "no") << endl; + << "Attached: " << (config.attached ? "yes" : "no") << endl + << "Operational: " << (config.operational ? "yes" : "no") << endl; for (j = 0; j < 16; j++) { if (config.syncs[j].pdo_count) { -- GitLab