Changed names of debug interfaces.
authorFlorian Pose <fp@igh-essen.com>
Wed, 08 Aug 2007 13:58:24 +0000
changeset 687 6de97f276423
parent 686 ca85fe008581
child 688 eeeaf9106d75
Changed names of debug interfaces.
master/debug.c
master/debug.h
master/device.c
--- a/master/debug.c	Wed Aug 08 10:49:43 2007 +0000
+++ b/master/debug.c	Wed Aug 08 13:58:24 2007 +0000
@@ -59,7 +59,10 @@
    Initializes the debug object, creates a net_device and registeres it.
 */
 
-int ec_debug_init(ec_debug_t *dbg /**< debug object */)
+int ec_debug_init(
+        ec_debug_t *dbg, /**< debug object */
+        const char *name /**< interface name */
+        )
 {
     int result;
 
@@ -67,7 +70,7 @@
     memset(&dbg->stats, 0, sizeof(struct net_device_stats));
 
     if (!(dbg->dev =
-          alloc_netdev(sizeof(ec_debug_t *), "ec%d", ether_setup))) {
+          alloc_netdev(sizeof(ec_debug_t *), name, ether_setup))) {
         EC_ERR("Unable to allocate net_device for debug object!\n");
         goto out_return;
     }
--- a/master/debug.h	Wed Aug 08 10:49:43 2007 +0000
+++ b/master/debug.h	Wed Aug 08 13:58:24 2007 +0000
@@ -56,7 +56,7 @@
 
 /*****************************************************************************/
 
-int ec_debug_init(ec_debug_t *);
+int ec_debug_init(ec_debug_t *, const char *);
 void ec_debug_clear(ec_debug_t *);
 void ec_debug_send(ec_debug_t *, const uint8_t *, size_t);
 
--- a/master/device.c	Wed Aug 08 10:49:43 2007 +0000
+++ b/master/device.c	Wed Aug 08 13:58:24 2007 +0000
@@ -57,10 +57,22 @@
         ec_master_t *master /**< master owning the device */
         )
 {
+#ifdef EC_DEBUG_IF
+    char ifname[10];
+    char mb = 'x';
+#endif
+
     device->master = master;
 
 #ifdef EC_DEBUG_IF
-    if (ec_debug_init(&device->dbg)) {
+    if (device == &master->main_device)
+        mb = 'm';
+    else if (device == &master->backup_device)
+        mb = 'b';
+
+    sprintf(ifname, "ecdbg%c%u", mb, master->index);
+
+    if (ec_debug_init(&device->dbg, ifname)) {
         EC_ERR("Failed to init debug device!\n");
         goto out_return;
     }