Output subindices with %02X.
authorFlorian Pose <fp@igh-essen.com>
Fri, 30 May 2008 09:39:29 +0000
changeset 926 6bb33c6ec770
parent 925 939f3e9bba1e
child 927 ffb7d1876ce0
Output subindices with %02X.
master/fsm_coe.c
master/fsm_coe_map.c
master/fsm_pdo_mapping.c
master/master.c
master/sdo_entry.c
master/slave.c
master/slave_config.c
--- a/master/fsm_coe.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/fsm_coe.c	Fri May 30 09:39:29 2008 +0000
@@ -880,7 +880,7 @@
     if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information
         (EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response
         EC_ERR("Sdo information error response at slave %u while"
-               " fetching Sdo entry 0x%04X:%i!\n", slave->ring_position,
+               " fetching Sdo entry 0x%04X:%02X!\n", slave->ring_position,
                sdo->index, fsm->subindex);
         ec_canopen_abort_msg(EC_READ_U32(data + 6));
         fsm->state = ec_fsm_coe_error;
@@ -892,7 +892,7 @@
         EC_READ_U16(data + 6) != sdo->index || // Sdo index
         EC_READ_U8(data + 8) != fsm->subindex) { // Sdo subindex
         EC_ERR("Invalid entry description response at slave %u while"
-               " fetching Sdo entry 0x%04X:%u!\n", slave->ring_position,
+               " fetching Sdo entry 0x%04X:%02X!\n", slave->ring_position,
                sdo->index, fsm->subindex);
         ec_print_data(data, rec_size);
         fsm->state = ec_fsm_coe_error;
@@ -998,7 +998,7 @@
     uint8_t *data;
 
     if (fsm->slave->master->debug_level) {
-        EC_DBG("Downloading Sdo 0x%04X:%u to slave %u.\n",
+        EC_DBG("Downloading Sdo 0x%04X:%02X to slave %u.\n",
                request->index, request->subindex, slave->ring_position);
         ec_print_data(request->data, request->data_size);
     }
@@ -1185,7 +1185,7 @@
     if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request
         EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request
         fsm->state = ec_fsm_coe_error;
-        EC_ERR("Sdo download 0x%04X:%X (%u bytes) aborted on slave %u.\n",
+        EC_ERR("Sdo download 0x%04X:%02X (%u bytes) aborted on slave %u.\n",
                request->index, request->subindex, request->data_size,
                slave->ring_position);
         if (rec_size < 10) {
@@ -1202,7 +1202,7 @@
         EC_READ_U16(data + 3) != request->index || // index
         EC_READ_U8 (data + 5) != request->subindex) { // subindex
         fsm->state = ec_fsm_coe_error;
-        EC_ERR("Sdo download 0x%04X:%X (%u bytes) failed:\n",
+        EC_ERR("Sdo download 0x%04X:%02X (%u bytes) failed:\n",
                request->index, request->subindex, request->data_size);
         EC_ERR("Invalid Sdo download response at slave %u!\n",
                slave->ring_position);
@@ -1228,7 +1228,7 @@
     uint8_t *data;
 
     if (master->debug_level)
-        EC_DBG("Uploading Sdo 0x%04X:%u from slave %u.\n",
+        EC_DBG("Uploading Sdo 0x%04X:%02X from slave %u.\n",
                request->index, request->subindex, slave->ring_position);
 
     if (!(slave->sii.mailbox_protocols & EC_MBOX_COE)) {
@@ -1416,7 +1416,7 @@
 
     if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request
         EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request
-        EC_ERR("Sdo upload 0x%04X:%X aborted on slave %u.\n",
+        EC_ERR("Sdo upload 0x%04X:%02X aborted on slave %u.\n",
                request->index, request->subindex, slave->ring_position);
         if (rec_size >= 10)
             ec_canopen_abort_msg(EC_READ_U32(data + 6));
@@ -1443,7 +1443,7 @@
                 EC_READ_U16(data + 3) != request->index || // index
                 EC_READ_U8 (data + 5) != request->subindex) { // subindex
             fsm->state = ec_fsm_coe_error;
-            EC_ERR("Sdo upload 0x%04X:%X failed:\n",
+            EC_ERR("Sdo upload 0x%04X:%02X failed:\n",
                     request->index, request->subindex);
             EC_ERR("Invalid Sdo upload expedited response at slave %u!\n",
                     slave->ring_position);
@@ -1484,7 +1484,7 @@
                 EC_READ_U16(data + 3) != request->index || // index
                 EC_READ_U8 (data + 5) != request->subindex) { // subindex
             fsm->state = ec_fsm_coe_error;
-            EC_ERR("Sdo upload 0x%04X:%X failed:\n",
+            EC_ERR("Sdo upload 0x%04X:%02X failed:\n",
                     request->index, request->subindex);
             EC_ERR("Invalid Sdo normal upload response at slave %u!\n",
                     slave->ring_position);
@@ -1707,7 +1707,7 @@
 
     if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request
         EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request
-        EC_ERR("Sdo upload 0x%04X:%X aborted on slave %u.\n",
+        EC_ERR("Sdo upload 0x%04X:%02X aborted on slave %u.\n",
                request->index, request->subindex, slave->ring_position);
         ec_canopen_abort_msg(EC_READ_U32(data + 6));
         fsm->state = ec_fsm_coe_error;
@@ -1716,7 +1716,7 @@
 
     if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response
         EC_READ_U8 (data + 2) >> 5 != 0x0) { // upload segment response
-        EC_ERR("Sdo upload 0x%04X:%X failed:\n", request->index, request->subindex);
+        EC_ERR("Sdo upload 0x%04X:%02X failed:\n", request->index, request->subindex);
         EC_ERR("Invalid Sdo upload segment response at slave %u!\n",
                slave->ring_position);
         ec_print_data(data, rec_size);
--- a/master/fsm_coe_map.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/fsm_coe_map.c	Fri May 30 09:39:29 2008 +0000
@@ -401,9 +401,10 @@
         }
 
         if (fsm->slave->master->debug_level) {
-            EC_DBG("    Pdo entry 0x%04X \"%s\" (%u bit).\n", pdo_entry->index,
-                    pdo_entry->name ? pdo_entry->name : "???",
-                    pdo_entry->bit_length);
+            EC_DBG("    Pdo entry 0x%04X:%02X, %u bit,  \"%s\".\n",
+                    pdo_entry->index, pdo_entry->subindex,
+                    pdo_entry->bit_length,
+                    pdo_entry->name ? pdo_entry->name : "???");
         }
 
         // next Pdo entry
--- a/master/fsm_pdo_mapping.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/fsm_pdo_mapping.c	Fri May 30 09:39:29 2008 +0000
@@ -309,7 +309,7 @@
     if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
 
     if (!ec_fsm_coe_success(fsm->fsm_coe)) {
-        EC_ERR("Failed to add entry 0x%04X:%u for slave %u.\n",
+        EC_ERR("Failed to add entry 0x%04X:%02X for slave %u.\n",
                 fsm->entry->index, fsm->entry->subindex,
                 fsm->slave->ring_position);
         fsm->state = ec_fsm_pdo_mapping_state_error;
--- a/master/master.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/master.c	Fri May 30 09:39:29 2008 +0000
@@ -1317,7 +1317,7 @@
     domain_offset = 0;
     list_for_each_entry(domain, &master->domains, list) {
         if (ec_domain_finish(domain, domain_offset)) {
-            EC_ERR("Failed to finish domain %X!\n", (u32) domain);
+            EC_ERR("Failed to finish domain 0x%08X!\n", (u32) domain);
             return -1;
         }
         domain_offset += domain->data_size;
--- a/master/sdo_entry.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/sdo_entry.c	Fri May 30 09:39:29 2008 +0000
@@ -101,7 +101,7 @@
     kobject_init(&entry->kobj);
     entry->kobj.ktype = &ktype_ec_sdo_entry;
     entry->kobj.parent = &sdo->kobj;
-    if (kobject_set_name(&entry->kobj, "%i", entry->subindex)) {
+    if (kobject_set_name(&entry->kobj, "%02X", entry->subindex)) {
         EC_ERR("Failed to set kobj name.\n");
         kobject_put(&entry->kobj);
         return -1;
--- a/master/slave.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/slave.c	Fri May 30 09:39:29 2008 +0000
@@ -800,10 +800,10 @@
 
                 list_for_each_entry(pdo_entry, &pdo->entries, list) {
                     buf += sprintf(buf,
-                            "      0x%04X:%X \"%s\", %u bit\n",
+                            "      0x%04X:%02X, %u bit, \"%s\"\n",
                             pdo_entry->index, pdo_entry->subindex,
-                            pdo_entry->name ? pdo_entry->name : "???",
-                            pdo_entry->bit_length);
+                            pdo_entry->bit_length,
+                            pdo_entry->name ? pdo_entry->name : "???");
                 }
             }
         }
@@ -825,10 +825,10 @@
                 buf += sprintf(buf, ", no default assignment.\n");
 
             list_for_each_entry(pdo_entry, &pdo->entries, list) {
-                buf += sprintf(buf, "    0x%04X:%X \"%s\", %u bit\n",
+                buf += sprintf(buf, "    0x%04X:%02X, %u bit, \"%s\"\n",
                         pdo_entry->index, pdo_entry->subindex,
-                        pdo_entry->name ? pdo_entry->name : "???",
-                        pdo_entry->bit_length);
+                        pdo_entry->bit_length,
+                        pdo_entry->name ? pdo_entry->name : "???");
             }
         }
         buf += sprintf(buf, "\n");
--- a/master/slave_config.c	Fri May 30 08:56:47 2008 +0000
+++ b/master/slave_config.c	Fri May 30 09:39:29 2008 +0000
@@ -259,7 +259,7 @@
                         pdo->index, pdo->name ? pdo->name : "???");
 
                 list_for_each_entry(entry, &pdo->entries, list) {
-                    buf += sprintf(buf, "    0x%04X:%X \"%s\", %u bit\n",
+                    buf += sprintf(buf, "    0x%04X:%02X \"%s\", %u bit\n",
                             entry->index, entry->subindex,
                             entry->name ? entry->name : "???",
                             entry->bit_length);
@@ -279,7 +279,7 @@
                 case 4: sprintf(str, "%u", EC_READ_U32(req->data)); break;
                 default: sprintf(str, "(invalid size)"); break;
             }
-            buf += sprintf(buf, "  0x%04X:%-3i -> %s\n",
+            buf += sprintf(buf, "  0x%04X:%02X -> %s\n",
                     req->index, req->subindex, str);
         }
         buf += sprintf(buf, "\n");
@@ -290,7 +290,7 @@
         buf += sprintf(buf, "\nSdo requests:\n");
 
         list_for_each_entry(req, &sc->sdo_requests, list) {
-            buf += sprintf(buf, "  0x%04X:%u\n", req->index, req->subindex);
+            buf += sprintf(buf, "  0x%04X:%02X\n", req->index, req->subindex);
         }
         buf += sprintf(buf, "\n");
     }
@@ -462,7 +462,7 @@
         if (sc->master->debug_level) {
             const ec_pdo_entry_t *entry;
             list_for_each_entry(entry, &pdo->entries, list) {
-                EC_DBG("    Entry 0x%04X:%u.\n",
+                EC_DBG("    Entry 0x%04X:%02X.\n",
                         entry->index, entry->subindex);
             }
         }
@@ -512,7 +512,7 @@
     ec_pdo_t *pdo;
     
     if (sc->master->debug_level)
-        EC_DBG("Adding Pdo entry 0x%04X:%u (%u bit) to mapping of Pdo"
+        EC_DBG("Adding Pdo entry 0x%04X:%02X (%u bit) to mapping of Pdo"
                 " 0x%04X, config %u:%u.\n", entry_index, entry_subindex,
                 entry_bit_length, pdo_index, sc->alias, sc->position);
 
@@ -632,7 +632,7 @@
         }
     }
 
-    EC_ERR("Pdo entry 0x%04X:%u is not mapped in slave config %u:%u.\n",
+    EC_ERR("Pdo entry 0x%04X:%02X is not mapped in slave config %u:%u.\n",
            index, subindex, sc->alias, sc->position);
     return -1;
 
@@ -645,7 +645,7 @@
     if (bit_position) {
         *bit_position = bit_pos;
     } else if (bit_pos) {
-        EC_ERR("Pdo entry 0x%04X:%X does not byte-align in config %u:%u.\n",
+        EC_ERR("Pdo entry 0x%04X:%02X does not byte-align in config %u:%u.\n",
                 index, subindex, sc->alias, sc->position);
         return -3;
     }