SDO configurations in Sysfs.
authorFlorian Pose <fp@igh-essen.com>
Fri, 27 Oct 2006 15:01:32 +0000
changeset 464 6c21a8d8c785
parent 463 938de5ebe1ca
child 465 3779b60a7c9b
SDO configurations in Sysfs.
master/slave.c
--- a/master/slave.c	Fri Oct 27 15:01:10 2006 +0000
+++ b/master/slave.c	Fri Oct 27 15:01:32 2006 +0000
@@ -574,6 +574,8 @@
     ec_sii_pdo_t *pdo;
     ec_sii_pdo_entry_t *pdo_entry;
     int first, i;
+    ec_sdo_data_t *sdodata;
+    char str[20];
 
     off += sprintf(buffer + off, "\nName: ");
 
@@ -705,6 +707,20 @@
         }
     }
 
+    if (!list_empty(&slave->sdo_confs))
+        off += sprintf(buffer + off, "\nSDO configurations:\n");
+
+    list_for_each_entry(sdodata, &slave->sdo_confs, list) {
+        switch (sdodata->size) {
+            case 1: sprintf(str, "%i", EC_READ_U8(sdodata->data)); break;
+            case 2: sprintf(str, "%i", EC_READ_U16(sdodata->data)); break;
+            case 4: sprintf(str, "%i", EC_READ_U32(sdodata->data)); break;
+            default: sprintf(str, "(invalid size)"); break;
+        }
+        off += sprintf(buffer + off, "  0x%04X:%-3i -> %s\n",
+                       sdodata->index, sdodata->subindex, str);
+    }
+
     off += sprintf(buffer + off, "\n");
 
     return off;