# HG changeset patch
# User Rafael Blank <ch1010866@ch10pc436>
# Date 1298538282 -3600
# Node ID f5b31f46c38f1f86a393b3bc9079656b09230850
# Parent  45706e3273fde0788ee66acb5ee614158448c696
Fixed segmented sdo dictionary upload (only first segment contains list type)

diff -r 45706e3273fd -r f5b31f46c38f master/fsm_coe.c
--- a/master/fsm_coe.c	Mon Jan 17 11:09:11 2011 +0100
+++ b/master/fsm_coe.c	Thu Feb 24 10:04:42 2011 +0100
@@ -503,10 +503,13 @@
         return;
     }
 
-    sdo_count = (rec_size - 8) / 2;
+    bool first_segment = list_empty(&slave->sdo_dictionary) ? true : false;
+    size_t index_list_offset = first_segment ? 8 : 6;
+
+    sdo_count = (rec_size - index_list_offset) / 2;
 
     for (i = 0; i < sdo_count; i++) {
-        sdo_index = EC_READ_U16(data + 8 + i * 2);
+        sdo_index = EC_READ_U16(data + index_list_offset + i * 2);
         if (!sdo_index) {
             EC_SLAVE_DBG(slave, 1, "SDO dictionary contains index 0x0000.\n");
             continue;