Fixed copying port information.
authorStefan Weiser <ch1010858@ch10pc584>
Fri, 30 Apr 2010 11:17:26 +0200
changeset 1983 df270de292e1
parent 1982 7421bca39b6d
child 1984 02c8728bf9e4
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
@@ -136,7 +136,7 @@
         ec_slave_info_t *slave_info)
 {
     ec_ioctl_slave_t data;
-    int index;
+    int index, i;
 
     data.position = slave_position;
 
@@ -152,7 +152,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;