From owner-svn-ports-all@FreeBSD.ORG Wed May 21 17:21:39 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E2383A2; Wed, 21 May 2014 17:21:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79E742BEE; Wed, 21 May 2014 17:21:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4LHLdab015088; Wed, 21 May 2014 17:21:39 GMT (envelope-from olivierd@svn.freebsd.org) Received: (from olivierd@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4LHLcTU015081; Wed, 21 May 2014 17:21:38 GMT (envelope-from olivierd@svn.freebsd.org) Message-Id: <201405211721.s4LHLcTU015081@svn.freebsd.org> From: Olivier Duchateau Date: Wed, 21 May 2014 17:21:38 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r354754 - in head/sysutils/xfce4-wavelan-plugin: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 May 2014 17:21:39 -0000 Author: olivierd Date: Wed May 21 17:21:38 2014 New Revision: 354754 URL: http://svnweb.freebsd.org/changeset/ports/354754 QAT: https://qat.redports.org/buildarchive/r354754/ Log: - Convert to USES= libtool tar:bzip2 - Add new patch, 'patch-panel-plugin__wavelan.ci', in order to change percentage values (25%, 50% and 75%, instead 40%, 55% and 70%) - Fix signal quality - Bump PORTREVISION Submitted by: J.R. Oldroyd Obtained from: http://lists.freebsd.org/pipermail/freebsd-xfce/2014-May/000914.html Added: head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wavelan.c (contents, props changed) Modified: head/sysutils/xfce4-wavelan-plugin/Makefile head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wi_bsd.c head/sysutils/xfce4-wavelan-plugin/pkg-plist Modified: head/sysutils/xfce4-wavelan-plugin/Makefile ============================================================================== --- head/sysutils/xfce4-wavelan-plugin/Makefile Wed May 21 15:49:26 2014 (r354753) +++ head/sysutils/xfce4-wavelan-plugin/Makefile Wed May 21 17:21:38 2014 (r354754) @@ -3,6 +3,7 @@ PORTNAME= xfce4-wavelan-plugin PORTVERSION= 0.5.11 +PORTREVISION= 1 CATEGORIES= sysutils xfce MASTER_SITES= ${MASTER_SITE_XFCE} MASTER_SITE_SUBDIR=src/panel-plugins/${PORTNAME}/${PORTVERSION:R} @@ -11,9 +12,8 @@ DIST_SUBDIR= xfce4 MAINTAINER= xfce@FreeBSD.org COMMENT= Displays various information about a WaveLAN device -USE_BZIP2= yes GNU_CONFIGURE= yes -USES= gettext pkgconfig gmake +USES= gettext pkgconfig gmake libtool tar:bzip2 USE_GNOME= gtk20 glib20 intltool intlhack USE_XFCE= configenv libutil libmenu panel Added: head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wavelan.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wavelan.c Wed May 21 17:21:38 2014 (r354754) @@ -0,0 +1,35 @@ +--- ./panel-plugin/wavelan.c.orig 2012-06-29 20:07:10.000000000 +0000 ++++ ./panel-plugin/wavelan.c 2014-05-20 21:45:00.000000000 +0000 +@@ -98,11 +98,11 @@ + + if (wavelan->signal_colors) { + /* set color */ +- if (state > 70) ++ if (state > 75) + gdk_color_parse(signal_color_strong, &color); +- else if (state > 55) ++ else if (state > 50) + gdk_color_parse(signal_color_good, &color); +- else if (state > 40) ++ else if (state > 25) + gdk_color_parse(signal_color_weak, &color); + else + gdk_color_parse(signal_color_bad, &color); +@@ -163,7 +163,16 @@ + } + } + else { +- wavelan_set_state(wavelan, stats.ws_quality); ++ if (strcmp(stats.ws_qunit, "dBm") == 0) ++ /* ++ * Usual formula is: ++ * qual = 4 * (signal - noise) ++ * where noise is typically about -96dBm, but we don't have ++ * the actual noise value here, so approximate one. ++ */ ++ wavelan_set_state(wavelan, 4 * (stats.ws_quality - (-96))); ++ else ++ wavelan_set_state(wavelan, stats.ws_quality); + + if (strlen(stats.ws_netname) > 0) + tip = g_strdup_printf("%s: %d%s at %dMb/s", stats.ws_netname, stats.ws_quality, stats.ws_qunit, stats.ws_rate); Modified: head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wi_bsd.c ============================================================================== --- head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wi_bsd.c Wed May 21 15:49:26 2014 (r354753) +++ head/sysutils/xfce4-wavelan-plugin/files/patch-panel-plugin__wi_bsd.c Wed May 21 17:21:38 2014 (r354754) @@ -1,26 +1,112 @@ --- ./panel-plugin/wi_bsd.c.orig 2012-04-09 16:45:20.000000000 +0000 -+++ ./panel-plugin/wi_bsd.c 2014-01-31 09:31:51.000000000 +0000 -@@ -52,10 +52,6 @@ ++++ ./panel-plugin/wi_bsd.c 2014-05-20 21:29:11.000000000 +0000 +@@ -3,6 +3,8 @@ + * (OpenBSD support) + * 2008 Pietro Cerutti + * (FreeBSD > 700000 adaptation) ++ * 2014 J.R. Oldroyd ++ * (Enhance FreeBSD support) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions +@@ -26,14 +28,9 @@ + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +-#if !defined(__FreeBSD_kernel__) && defined(__FreeBSD__) +-#define __FreeBSD_kernel__ __FreeBSD__ +-#endif +-#if !defined(__FreeBSD_kernel_version) && defined(__FreeBSD_version) +-#define __FreeBSD_kernel_version __FreeBSD_version +-#endif ++#include + +-#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD_kernel_kernel__) || defined(__OpenBSD__) ++#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) + + #include + #include +@@ -44,20 +41,14 @@ + + #include + #include +-#ifdef __FreeBSD_kernel__ ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + #include + #include + #include +-#if __FreeBSD_kernel_version >= 700000 #include #include #include --#else + #else -#include -#include -#include - #endif - #else +-#endif +-#else #ifdef __NetBSD__ -@@ -111,8 +107,6 @@ + #include + #include +@@ -107,13 +98,9 @@ + }; + + static int _wi_carrier(const struct wi_device *); +-#if defined(__FreeBSD_kernel__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) static int _wi_vendor(const struct wi_device *, char *, size_t); - #if __FreeBSD_kernel_version > 700000 +-#if __FreeBSD_kernel_version > 700000 static int _wi_getval(const struct wi_device *, struct ieee80211req_scan_result *); -#else -static int _wi_getval(const struct wi_device *, struct wi_req *); - #endif +-#endif #endif static int _wi_netname(const struct wi_device *, char *, size_t); -@@ -319,46 +313,6 @@ + static int _wi_quality(const struct wi_device *, int *); +@@ -160,7 +147,7 @@ + + strlcpy(stats->ws_qunit, "dBm", 4); + /* check vendor (independent of carrier state) */ +-#if defined(__FreeBSD_kernel__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + if ((result = _wi_vendor(device, stats->ws_vendor, WI_MAXSTRLEN)) != WI_OK) + return(result); + #endif +@@ -294,12 +281,10 @@ + } + #endif + +-/* seems only FreeBSD supports this operation */ +-#if defined(__FreeBSD_kernel__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + static int + _wi_vendor(const struct wi_device *device, char *buffer, size_t len) + { +-#if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 700000 + /* + * We use sysctl to get a device description + */ +@@ -316,59 +301,30 @@ + dev_number = (int)strtol(c, NULL, 10); + *c = '\0'; + ++ /* ++ * Also, wlan doesn't present dev.wlan.N.%desc, need to use ++ * underlying driver name, instead: dev.ath.0.%desc, so we ++ * need to get the parent's name. ++ */ ++ if(strcmp(dev_name, "wlan") == 0) { ++ snprintf(mib, sizeof(mib), "net.%s.%d.%%parent", dev_name, dev_number); ++ if(sysctlbyname(mib, dev_name, &len, NULL, 0) == -1) ++ return (WI_NOSUCHDEV); ++ ++ c = dev_name; ++ while(!isdigit(*c)) c++; ++ dev_number = (int)strtol(c, NULL, 10); ++ *c = '\0'; ++ len = WI_MAXSTRLEN; ++ } ++ snprintf(mib, sizeof(mib), "dev.%s.%d.%%desc", dev_name, dev_number); if(sysctlbyname(mib, buffer, &len, NULL, 0) == -1) return (WI_NOSUCHDEV); @@ -64,88 +150,101 @@ - - snprintf(buffer, len, "%s (ID %d, version %d.%d)", vendor, - wr.wi_val[0], wr.wi_val[2], wr.wi_val[3]); - #endif +-#endif return(WI_OK); -@@ -393,21 +347,6 @@ + } +-#endif /* wi_vendor */ + +-/* NetBSD and FreeBSD 6.x uses old wi_* API */ +-#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) +-/* FreeBSD 7.x use its own new iee80211 API */ +-#if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 700000 + static int + _wi_getval(const struct wi_device *device, struct ieee80211req_scan_result *scan) + { +@@ -393,7 +349,9 @@ return(WI_OK); } -#else --static int --_wi_getval(const struct wi_device *device, struct wi_req *wr) --{ -- struct ifreq ifr; -- -- bzero((void*)&ifr, sizeof(ifr)); -- strlcpy(ifr.ifr_name, device->interface, sizeof(ifr.ifr_name)); -- ifr.ifr_data = (void*)wr; -- -- if (ioctl(device->socket, SIOCGWAVELAN, &ifr) < 0) -- return(WI_NOSUCHDEV); -- -- return(WI_OK); --} ++#endif ++ ++#if defined(__NetBSD__) + static int + _wi_getval(const struct wi_device *device, struct wi_req *wr) + { +@@ -409,10 +367,11 @@ + return(WI_OK); + } #endif ++ static int _wi_netname(const struct wi_device *device, char *buffer, size_t len) -@@ -423,18 +362,6 @@ + { +-#if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 700000 ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + struct ieee80211req ireq; + + memset(&ireq, 0, sizeof(ireq)); +@@ -423,7 +382,7 @@ ireq.i_len = len; if (ioctl(device->socket, SIOCG80211, &ireq) < 0) return WI_NOSUCHDEV; -#else -- struct wi_req wr; -- int result; -- -- bzero((void *)&wr, sizeof(wr)); -- wr.wi_len = WI_MAX_DATALEN; -- wr.wi_type = WI_RID_CURRENT_SSID; -- -- if ((result = _wi_getval(device, &wr)) != WI_OK) -- return(result); -- -- strlcpy(buffer, (char *)&wr.wi_val[1], MIN(len, le16toh(wr.wi_val[0]) + 1)); - #endif ++#elif defined(__NetBSD__) + struct wi_req wr; + int result; - return(WI_OK); -@@ -452,21 +379,6 @@ +@@ -443,7 +402,7 @@ + static int + _wi_quality(const struct wi_device *device, int *quality) + { +-#if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 700000 ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + struct ieee80211req_scan_result req; + int result; + bzero(&req, sizeof(req)); +@@ -451,8 +410,16 @@ + if((result = _wi_getval(device, &req)) != WI_OK) return (result); - *quality = req.isr_rssi; +- *quality = req.isr_rssi; -#else -- struct wi_req wr; -- int result; -- -- bzero((void *)&wr, sizeof(wr)); -- wr.wi_len = WI_MAX_DATALEN; -- wr.wi_type = WI_RID_COMMS_QUALITY; -- -- if ((result = _wi_getval(device, &wr)) != WI_OK) -- return(result); -- -- /* according to various implementation (conky, ifconfig) : -- wi_val[0] = quality, wi_val[1] = signal, wi_val[2] = noise -- but my ral only shows a value for signal, and it seems it's a dB value */ -- *quality = le16toh(wr.wi_val[1]); - #endif ++ /* ++ * FreeBSD's wlan stats: ++ * signal (in dBm) = rssi * 2 + noise; ++ * quality_bars = 4 * (signal - noise); ++ * or ++ * quality_bars = rssi * 8; ++ * but, per wi_query(), above, we need to return strength in dBm, so... ++ */ ++ *quality = req.isr_rssi * 2 + req.isr_noise; ++#elif defined(__NetBSD__) + struct wi_req wr; + int result; - return(WI_OK); -@@ -488,18 +400,6 @@ +@@ -475,7 +442,7 @@ + static int + _wi_rate(const struct wi_device *device, int *rate) + { +-#if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 700000 ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + struct ieee80211req_scan_result req; + int result, i, high; + bzero(&req, sizeof(req)); +@@ -488,7 +455,7 @@ high = req.isr_rates[i] & IEEE80211_RATE_VAL; *rate = high / 2; -#else -- struct wi_req wr; -- int result; -- -- bzero((void *)&wr, sizeof(wr)); -- wr.wi_len = WI_MAX_DATALEN; -- wr.wi_type = WI_RID_CUR_TX_RATE; -- -- if ((result = _wi_getval(device, &wr)) != WI_OK) -- return(result); -- -- *rate = le16toh(wr.wi_val[0]); - #endif ++#elif defined(__NetBSD__) + struct wi_req wr; + int result; +@@ -505,5 +472,4 @@ return(WI_OK); + } + +-#endif /* defined(__NetBSD__) || defined(__FreeBSD_kernel__) */ + #endif Modified: head/sysutils/xfce4-wavelan-plugin/pkg-plist ============================================================================== --- head/sysutils/xfce4-wavelan-plugin/pkg-plist Wed May 21 15:49:26 2014 (r354753) +++ head/sysutils/xfce4-wavelan-plugin/pkg-plist Wed May 21 17:21:38 2014 (r354754) @@ -1,4 +1,3 @@ -lib/xfce4/panel/plugins/libwavelan.la lib/xfce4/panel/plugins/libwavelan.so share/locale/ar/LC_MESSAGES/xfce4-wavelan-plugin.mo share/locale/ast/LC_MESSAGES/xfce4-wavelan-plugin.mo