diff options
author | marcus <marcus@FreeBSD.org> | 2003-08-08 23:37:34 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2003-08-08 23:37:34 +0800 |
commit | 480b54f16e71b297e089e8c37dafb8f55ea315cd (patch) | |
tree | f586cbb775556cefc76d5e066273e14f63b501d7 /x11 | |
parent | c251e854609a014c99e8620b7aada0fb2b283e6c (diff) | |
download | freebsd-ports-graphics-480b54f16e71b297e089e8c37dafb8f55ea315cd.tar.gz freebsd-ports-graphics-480b54f16e71b297e089e8c37dafb8f55ea315cd.tar.zst freebsd-ports-graphics-480b54f16e71b297e089e8c37dafb8f55ea315cd.zip |
Print the signal strength for wi-driven cards instead of signal quality.
This fixes problems some users were seeing where the wireless-applet would
display N/A for status. This brings the wi functionality inline with the
Aironet functionality.
While I'm here, change an instance of strcpy to strlcpy.
Tested by: Andrew Thomson <ajthomson@optushome.com.au>
Diffstat (limited to 'x11')
-rw-r--r-- | x11/gnome-applets/Makefile | 2 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-wireless_wireless-applet.c | 28 | ||||
-rw-r--r-- | x11/gnomeapplets2/Makefile | 2 | ||||
-rw-r--r-- | x11/gnomeapplets2/files/patch-wireless_wireless-applet.c | 28 |
4 files changed, 32 insertions, 28 deletions
diff --git a/x11/gnome-applets/Makefile b/x11/gnome-applets/Makefile index e4f4a938834..5364bcb9e29 100644 --- a/x11/gnome-applets/Makefile +++ b/x11/gnome-applets/Makefile @@ -7,7 +7,7 @@ PORTNAME= gnomeapplets2 PORTVERSION= 2.2.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11 gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/gnome-applets/2.2 diff --git a/x11/gnome-applets/files/patch-wireless_wireless-applet.c b/x11/gnome-applets/files/patch-wireless_wireless-applet.c index 139c5ef0e96..434f3769f41 100644 --- a/x11/gnome-applets/files/patch-wireless_wireless-applet.c +++ b/x11/gnome-applets/files/patch-wireless_wireless-applet.c @@ -1,5 +1,5 @@ ---- wireless/wireless-applet.c.orig Sun May 18 08:50:43 2003 -+++ wireless/wireless-applet.c Fri Aug 1 23:06:51 2003 +--- wireless-applet/wireless-applet.c.orig Sun May 18 11:50:43 2003 ++++ wireless-applet/wireless-applet.c Fri Aug 8 10:10:53 2003 @@ -30,12 +30,25 @@ #include <math.h> #include <dirent.h> @@ -70,7 +70,7 @@ applet->state = BUSTED_LINK; wireless_applet_animation_state (applet); } else if (percent == 0) { -@@ -387,22 +412,177 @@ +@@ -387,22 +412,179 @@ applet->show_dialogs = show; } @@ -83,7 +83,7 @@ + + bzero((char *)&ifr, sizeof(ifr)); + -+ strcpy(ifr.ifr_name, device); ++ strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); + ifr.ifr_data = (caddr_t)wreq; + + s = socket(AF_INET, SOCK_DGRAM, 0); @@ -94,7 +94,7 @@ + GTK_WIDGET (applet), + "Socket Error", + NULL); -+ return(1); ++ return 0; + } + + if (ioctl(s, SIOCGWAVELAN, &ifr) == -1) @@ -103,12 +103,12 @@ + GTK_WIDGET (applet), + "ioctl Error", + NULL); -+ return(1); ++ return 0; + } + + close(s); + -+ return(0); ++ return 1; +} + +static void @@ -117,12 +117,14 @@ + struct wi_req wreq; + long int signal_strength; + ++ bzero((char *)&wreq, sizeof(wreq)); ++ + wreq.wi_len = WI_MAX_DATALEN; + wreq.wi_type = WI_RID_COMMS_QUALITY; + + (void)wi_getval(applet, device, &wreq); + -+ signal_strength = (long int) (wreq.wi_val[0]); ++ signal_strength = (long int) (wreq.wi_val[1]); + + memcpy(level, &signal_strength, sizeof(level)); + @@ -250,7 +252,7 @@ char *ptr; fgets (line, 256, applet->file); -@@ -435,6 +615,7 @@ +@@ -435,6 +617,7 @@ wireless_applet_update_state (applet, device, link, level, noise); } } @@ -258,7 +260,7 @@ } while (1); if (g_list_length (applet->devices)==1) { -@@ -446,17 +627,23 @@ +@@ -446,17 +629,23 @@ } /* rewind the /proc/net/wireless file */ @@ -282,7 +284,7 @@ wireless_applet_read_device_state (applet); -@@ -522,6 +709,7 @@ +@@ -522,6 +711,7 @@ static void start_file_read (WirelessApplet *applet) { @@ -290,7 +292,7 @@ applet->file = fopen ("/proc/net/wireless", "rt"); if (applet->file == NULL) { gtk_tooltips_set_tip (applet->tips, -@@ -530,6 +718,7 @@ +@@ -530,6 +720,7 @@ NULL); show_error_dialog (_("There doesn't seem to be any wireless devices configured on your system.\nPlease verify your configuration if you think this is incorrect.")); } @@ -298,7 +300,7 @@ } static void -@@ -775,8 +964,10 @@ +@@ -775,8 +966,10 @@ applet->prefs = NULL; } diff --git a/x11/gnomeapplets2/Makefile b/x11/gnomeapplets2/Makefile index e4f4a938834..5364bcb9e29 100644 --- a/x11/gnomeapplets2/Makefile +++ b/x11/gnomeapplets2/Makefile @@ -7,7 +7,7 @@ PORTNAME= gnomeapplets2 PORTVERSION= 2.2.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11 gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/gnome-applets/2.2 diff --git a/x11/gnomeapplets2/files/patch-wireless_wireless-applet.c b/x11/gnomeapplets2/files/patch-wireless_wireless-applet.c index 139c5ef0e96..434f3769f41 100644 --- a/x11/gnomeapplets2/files/patch-wireless_wireless-applet.c +++ b/x11/gnomeapplets2/files/patch-wireless_wireless-applet.c @@ -1,5 +1,5 @@ ---- wireless/wireless-applet.c.orig Sun May 18 08:50:43 2003 -+++ wireless/wireless-applet.c Fri Aug 1 23:06:51 2003 +--- wireless-applet/wireless-applet.c.orig Sun May 18 11:50:43 2003 ++++ wireless-applet/wireless-applet.c Fri Aug 8 10:10:53 2003 @@ -30,12 +30,25 @@ #include <math.h> #include <dirent.h> @@ -70,7 +70,7 @@ applet->state = BUSTED_LINK; wireless_applet_animation_state (applet); } else if (percent == 0) { -@@ -387,22 +412,177 @@ +@@ -387,22 +412,179 @@ applet->show_dialogs = show; } @@ -83,7 +83,7 @@ + + bzero((char *)&ifr, sizeof(ifr)); + -+ strcpy(ifr.ifr_name, device); ++ strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); + ifr.ifr_data = (caddr_t)wreq; + + s = socket(AF_INET, SOCK_DGRAM, 0); @@ -94,7 +94,7 @@ + GTK_WIDGET (applet), + "Socket Error", + NULL); -+ return(1); ++ return 0; + } + + if (ioctl(s, SIOCGWAVELAN, &ifr) == -1) @@ -103,12 +103,12 @@ + GTK_WIDGET (applet), + "ioctl Error", + NULL); -+ return(1); ++ return 0; + } + + close(s); + -+ return(0); ++ return 1; +} + +static void @@ -117,12 +117,14 @@ + struct wi_req wreq; + long int signal_strength; + ++ bzero((char *)&wreq, sizeof(wreq)); ++ + wreq.wi_len = WI_MAX_DATALEN; + wreq.wi_type = WI_RID_COMMS_QUALITY; + + (void)wi_getval(applet, device, &wreq); + -+ signal_strength = (long int) (wreq.wi_val[0]); ++ signal_strength = (long int) (wreq.wi_val[1]); + + memcpy(level, &signal_strength, sizeof(level)); + @@ -250,7 +252,7 @@ char *ptr; fgets (line, 256, applet->file); -@@ -435,6 +615,7 @@ +@@ -435,6 +617,7 @@ wireless_applet_update_state (applet, device, link, level, noise); } } @@ -258,7 +260,7 @@ } while (1); if (g_list_length (applet->devices)==1) { -@@ -446,17 +627,23 @@ +@@ -446,17 +629,23 @@ } /* rewind the /proc/net/wireless file */ @@ -282,7 +284,7 @@ wireless_applet_read_device_state (applet); -@@ -522,6 +709,7 @@ +@@ -522,6 +711,7 @@ static void start_file_read (WirelessApplet *applet) { @@ -290,7 +292,7 @@ applet->file = fopen ("/proc/net/wireless", "rt"); if (applet->file == NULL) { gtk_tooltips_set_tip (applet->tips, -@@ -530,6 +718,7 @@ +@@ -530,6 +720,7 @@ NULL); show_error_dialog (_("There doesn't seem to be any wireless devices configured on your system.\nPlease verify your configuration if you think this is incorrect.")); } @@ -298,7 +300,7 @@ } static void -@@ -775,8 +964,10 @@ +@@ -775,8 +966,10 @@ applet->prefs = NULL; } |