ui/ncurses: Add link status to system info & system config screens
authorJeremy Kerr <jk@ozlabs.org>
Mon, 16 Dec 2013 05:20:01 +0000 (13:20 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 18 Dec 2013 01:52:42 +0000 (09:52 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-config.c
ui/ncurses/nc-sysinfo.c

index 4eeeff830aed783a67874bebab16f32a8ba047ed..6c252602a1a58ce16c493de5c624b378719f8615 100644 (file)
@@ -471,17 +471,22 @@ static void config_screen_setup_widgets(struct config_screen *screen,
                        config_screen_network_change, screen);
 
        screen->widgets.iface_l = widget_new_label(set, 0, 0, "Device:");
-       screen->widgets.iface_f = widget_new_select(set, 0, 0, 20);
+       screen->widgets.iface_f = widget_new_select(set, 0, 0, 50);
 
        for (i = 0; i < sysinfo->n_interfaces; i++) {
                struct interface_info *info = sysinfo->interfaces[i];
+               char str[50], mac[20];
                bool is_default;
 
                is_default = ifcfg && !memcmp(ifcfg->hwaddr, info->hwaddr,
                                        sizeof(ifcfg->hwaddr));
 
+               mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac));
+               snprintf(str, sizeof(str), "%s [%s, %s]", info->name, mac,
+                               info->link ? "link up" : "link down");
+
                widget_select_add_option(screen->widgets.iface_f,
-                                               i, info->name, is_default);
+                                               i, str, is_default);
        }
 
        gw = ip = mask = NULL;
index 142c70506aa8e833a42ec8ad4e71be1b1c3e351b..fb1954f44f0fc7d2ce498764a665e419089c9cf7 100644 (file)
@@ -175,7 +175,8 @@ static void sysinfo_screen_populate(struct sysinfo_screen *screen,
                if_info_mac_str(info, macbuf, sizeof(macbuf));
 
                line("%s:", info->name);
-               line(" MAC: %s", macbuf);
+               line(" MAC:  %s", macbuf);
+               line(" link: %s", info->link ? "up" : "down");
                line(NULL);
        }