Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2006 11:15:49 -0700 (PDT)
From:      Kevin Oberman <oberman@es.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/95758: Patch to support FreeBSD device names
Message-ID:  <20060414181549.C311E5C30@slan.es.net>
Resent-Message-ID: <200604141820.k3EIKKwp072388@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         95758
>Category:       ports
>Synopsis:       Patch to support FreeBSD device names
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 14 18:20:20 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Kevin Oberman
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
ESnet-The Energy Sciences Network
>Environment:
System: FreeBSD slan.es.net 7.0-CURRENT FreeBSD 7.0-CURRENT #8: Fri Apr 7 12:34:51 PDT 2006 root@slan.es.net:/usr/obj/usr/src/sys/IBM-T43 i386

>Description:
	The netspeed applet does not understand FreeBSD device types.
	This has two impacts. First, the icons are never changed with
        the interface type. Second, if the active interface switched,
        instead of switching to the new interface, it would flip to
        loopback, not terribly useful. The code that should have
        handled this was doing a g_string_equals for "lo" and not
        "lo0". 

	I am sure that I could have coded the icon settings better, but
        it seems to work. Feel free to do soemting tidier if you feel
	like it. I am not a great C programmer.

>How-To-Repeat:
	N/A
>Fix:
	Add the attached file as patch-src_netspeed.c

--- src/netspeed.c.orig	Thu Apr 21 14:02:38 2005
+++ src/netspeed.c	Fri Apr 14 10:52:18 2006
@@ -162,13 +162,16 @@
 	 */
 	if (applet->change_icon)
 	{
-		if (strstr(device, "ppp"))
+		if (strstr(device, "tun"))
 			type = gdk_pixbuf_new_from_xpm_data(ICON_PPP);
-		else if (!strcmp(device, "lo"))
+		else if (strstr(device, "lo"))
 			type = gdk_pixbuf_new_from_xpm_data(ICON_LO);
-		else if (strstr(device, "lip"))
+		else if (strstr(device, "plip"))
 			type = gdk_pixbuf_new_from_xpm_data(ICON_PLIP);
-		else if (strstr(device, "wlan"))
+		else if (strstr(device, "ath") || strstr(device, "wi"))
+			type = gdk_pixbuf_new_from_xpm_data(ICON_WLAN);
+		else if (strstr(device, "ndis") || strstr(device, "an") ||
+			strstr(device, "ral") || strstr(device, "awi"))
 			type = gdk_pixbuf_new_from_xpm_data(ICON_WLAN);
 		else
 			type = gdk_pixbuf_new_from_xpm_data(ICON_ETH);
@@ -386,7 +389,7 @@
 	
 	devices = get_available_devices();
 	for (tmp = devices; tmp; tmp = g_list_next(tmp)) {
-		if (!g_str_equal(tmp->data, "lo")) {
+		if (!g_str_equal(tmp->data, "lo0")) {
 			info = get_device_info(tmp->data);
 			if (info.running) {
 				free_device_info(&applet->devinfo);
@@ -1387,13 +1390,13 @@
 		GList *ptr, *devices = get_available_devices();
 		ptr = devices;
 		while (ptr) { 
-			if (!g_str_equal(ptr->data, "lo"))
+			if (!g_str_equal(ptr->data, "lo0"))
 				applet->devinfo = get_device_info(ptr->data);
 			ptr = g_list_next(ptr);
 		}
 		free_devices_list(devices);		
 	}
-	if (!applet->devinfo.name) applet->devinfo = get_device_info("lo");	
+	if (!applet->devinfo.name) applet->devinfo = get_device_info("lo0");	
 	applet->device_has_changed = TRUE;	
 	
 	applet->tooltips = gtk_tooltips_new();
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060414181549.C311E5C30>