Fixed copying port information. redundancy
authorStefan Weiser <ch1010858@ch10pc584>
Fri, 30 Apr 2010 11:17:26 +0200
branchredundancy
changeset 2338 76d092535367
parent 2337 3967e3eb75b0
child 2339 ecaff0d1d165
Fixed copying port information.
lib/master.c
--- a/lib/master.c	Fri Apr 30 10:53:56 2010 +0200
+++ b/lib/master.c	Fri Apr 30 11:17:26 2010 +0200
@@ -216,7 +216,7 @@
         ec_slave_info_t *slave_info)
 {
     ec_ioctl_slave_t data;
-    int index;
+    int index, i;
 
     data.position = slave_position;
 
@@ -232,7 +232,15 @@
     slave_info->serial_number = data.serial_number;
     slave_info->alias = data.alias;
     slave_info->current_on_ebus = data.current_on_ebus;
-    strncpy((char*) slave_info->ports, (char*) data.ports, sizeof(slave_info->ports));
+    for ( i = 0; i < EC_MAX_PORTS; i++ ) {
+    	slave_info->ports[i].desc = data.ports[i].desc;
+    	slave_info->ports[i].link.link_up = data.ports[i].link.link_up;
+    	slave_info->ports[i].link.loop_closed = data.ports[i].link.loop_closed;
+    	slave_info->ports[i].link.signal_detected = data.ports[i].link.signal_detected;
+    	slave_info->ports[i].receive_time = data.ports[i].receive_time;
+    	slave_info->ports[i].next_slave = data.ports[i].next_slave;
+    	slave_info->ports[i].delay_to_next_dc = data.ports[i].delay_to_next_dc;
+    }
     slave_info->al_state = data.al_state;
     slave_info->error_flag = data.error_flag;
     slave_info->sync_count = data.sync_count;