diff --git a/NEWS b/NEWS index 316ee76e..2b8cf9be 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ Changes since 1.4.0: * Added debug level for all masters as a module parameter. Thanks to Erwin Burgstaller. * Clear slave list on link down. +* Output device link state in 'ethercat master'. Changes in 1.4.0: diff --git a/TODO b/TODO index 6afd5b32..1e859984 100644 --- a/TODO +++ b/TODO @@ -14,7 +14,6 @@ Version 1.5.0: - Delay calculation. - Synchronize the reference clock to the master clock. * Read alias from register 0x0012 instead of SII. -* Output link state in 'ethercat master'. * Finish library implementation. * Re-work EoE code. * Replace locking callbacks. diff --git a/master/cdev.c b/master/cdev.c index 9c49692b..0d3e73a7 100644 --- a/master/cdev.c +++ b/master/cdev.c @@ -180,6 +180,7 @@ int ec_cdev_ioctl_master( memcpy(data.devices[0].address, master->main_mac, ETH_ALEN); } data.devices[0].attached = master->main_device.dev ? 1 : 0; + data.devices[0].link_state = master->main_device.link_state ? 1 : 0; data.devices[0].tx_count = master->main_device.tx_count; data.devices[0].rx_count = master->main_device.rx_count; @@ -190,6 +191,7 @@ int ec_cdev_ioctl_master( memcpy(data.devices[1].address, master->backup_mac, ETH_ALEN); } data.devices[1].attached = master->backup_device.dev ? 1 : 0; + data.devices[1].link_state = master->backup_device.link_state ? 1 : 0; data.devices[1].tx_count = master->backup_device.tx_count; data.devices[1].rx_count = master->backup_device.rx_count; up(&master->device_sem); diff --git a/master/ioctl.h b/master/ioctl.h index b1180325..be997a42 100644 --- a/master/ioctl.h +++ b/master/ioctl.h @@ -127,6 +127,7 @@ typedef struct { struct { uint8_t address[6]; uint8_t attached; + uint8_t link_state; uint32_t tx_count; uint32_t rx_count; } devices[2]; diff --git a/tool/CommandMaster.cpp b/tool/CommandMaster.cpp index 07c4d50a..f02c6bc8 100644 --- a/tool/CommandMaster.cpp +++ b/tool/CommandMaster.cpp @@ -107,6 +107,7 @@ void CommandMaster::execute(MasterDevice &m, const StringVector &args) << setw(2) << (unsigned int) data.devices[i].address[5] << " (" << (data.devices[i].attached ? "attached" : "waiting...") << ")" << endl << dec + << " Link: " << (data.devices[i].link_state ? "UP" : "DOWN") << endl << " Tx count: " << data.devices[i].tx_count << endl << " Rx count: " << data.devices[i].rx_count; }