Hi,

a looong due update to xfce4-wavelan, which has been marked broken since
some months now. It displays current ssid, signal quality and txpower
for a configurable wireless interface in the Xfce4 panel.

It has been heavily patched to use our net80211 API (most code is
borrowed from ifconfig.c:ieee80211_status()) and works fine here with my
iwi(4) interface. Btw, i'll push the patch upstream, but this plugin
deserves some love anyway (missing desktop icon p.ex)

Please test it with various wireless devices and report back to me, i'd
like to commit it during the week. You'll need x11/xfce4/xfce4.port.mk
(probably r1.3 from yesterday, but r1.2 should work) to compile it.

Thanks,

Landry
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/xfce4/xfce4-wavelan/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- Makefile    15 Sep 2007 20:04:27 -0000      1.13
+++ Makefile    8 Jul 2008 14:29:08 -0000
@@ -1,14 +1,9 @@
 # $OpenBSD: Makefile,v 1.13 2007/09/15 20:04:27 merdely Exp $
 
-BROKEN=                No release available that works with xfce 4.4.
-
 COMMENT=       displays stats from a WLAN interface
-DISTNAME=      xfce4-wavelan-plugin-0.4.1
-EXTRACT_SUFX=  .tar.bz2
-PKGNAME=       ${DISTNAME:S/-plugin//}p4
-MASTER_SITES=  ${MASTER_SITE_BERLIOS:=xfce-goodies/}
 
-HOMEPAGE=      http://xfce-goodies.berlios.de/
+XFCE_VERSION=  0.5.4
+XFCE_PLUGIN=   wavelan
 
 # BSD
 PERMIT_DISTFILES_CDROM=        Yes
@@ -16,14 +11,14 @@ PERMIT_DISTFILES_FTP=       Yes
 PERMIT_PACKAGE_CDROM=  Yes
 PERMIT_PACKAGE_FTP=    Yes
 
-BUILD_DEPENDS= :xfce4-panel-*:x11/xfce4/xfce4-panel
-LIB_DEPENDS=   xfcegui4.>=3.4::x11/xfce4/libxfcegui4 \
-               xml2.>=9.0::textproc/libxml
-RUN_DEPENDS=   :xfce4-panel-*:x11/xfce4/xfce4-panel
-WANTLIB=       ICE SM X11 Xext Xrender fontconfig freetype m z \
-               atk-1.0 gdk-x11-2.0 gdk_pixbuf-2.0 glib-2.0 \
-               gmodule-2.0 gobject-2.0 gtk-x11-2.0 pango-1.0 \
-               pangoft2-1.0 pangocairo-1.0 cairo glitz png \
-               startup-notification-1 xfce4util.>=1
+MODULES=       x11/xfce4
+EXTRACT_SUFX=  .tar.gz
+
+WANTLIB=       ICE SM X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext \
+               Xfixes Xi Xinerama Xrandr Xrender atk-1.0 c cairo expat \
+               fontconfig freetype gdk-x11-2.0 gdk_pixbuf-2.0 glib-2.0 \
+               glitz gmodule-2.0 gobject-2.0 gtk-x11-2.0 m pango-1.0 \
+               pangocairo-1.0 pangoft2-1.0 pcre pixman-1 png 
startup-notification-1 \
+               xfce4util xfcegui4 z
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/x11/xfce4/xfce4-wavelan/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- distinfo    5 Apr 2007 17:36:27 -0000       1.2
+++ distinfo    8 Jul 2008 14:29:08 -0000
@@ -1,5 +1,5 @@
-MD5 (xfce4/xfce4-wavelan-plugin-0.4.1.tar.bz2) = XKffDzv+PuZ+Kh/Wx7YOsA==
-RMD160 (xfce4/xfce4-wavelan-plugin-0.4.1.tar.bz2) = 
jXpIjh+fETZz2mmcVaT5h2vEKZk=
-SHA1 (xfce4/xfce4-wavelan-plugin-0.4.1.tar.bz2) = mNEuEKK8FxOOOXB6Fnp4u7Edb3I=
-SHA256 (xfce4/xfce4-wavelan-plugin-0.4.1.tar.bz2) = 
88wPVikBdXyPotb2a8QAsg9NsDjgQwRTG3Jze2qK7rM=
-SIZE (xfce4/xfce4-wavelan-plugin-0.4.1.tar.bz2) = 312288
+MD5 (xfce4/xfce4-wavelan-plugin-0.5.4.tar.gz) = sTmT+streiXKgayM3pqRAA==
+RMD160 (xfce4/xfce4-wavelan-plugin-0.5.4.tar.gz) = MNSJOBIATP4M8RV5Drctr5K0218=
+SHA1 (xfce4/xfce4-wavelan-plugin-0.5.4.tar.gz) = 1F2KE6FRL9t0qs8JxbaumcR0P90=
+SHA256 (xfce4/xfce4-wavelan-plugin-0.5.4.tar.gz) = 
W4xeo3VhzDLxCzrrrGfPFPySFrdI4ZTzZ28m1CpPHAU=
+SIZE (xfce4/xfce4-wavelan-plugin-0.5.4.tar.gz) = 596378
Index: patches/patch-panel-plugin_wavelan_c
===================================================================
RCS file: patches/patch-panel-plugin_wavelan_c
diff -N patches/patch-panel-plugin_wavelan_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-panel-plugin_wavelan_c        8 Jul 2008 14:29:08 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- panel-plugin/wavelan.c.orig        Wed Jan 10 21:23:05 2007
++++ panel-plugin/wavelan.c     Tue Jul  8 16:20:59 2008
+@@ -219,9 +219,9 @@ wavelan_timer(gpointer data)
+         wavelan_set_state(wavelan, STATE_LINK0);
+ 
+       if (strlen(stats.ws_netname) > 0)
+-        tip = g_strdup_printf("%d%% (%s)", stats.ws_quality, 
stats.ws_netname);
++        tip = g_strdup_printf("%s: %ddB at %ddBm", stats.ws_netname, 
stats.ws_quality, stats.ws_rate);
+       else
+-        tip = g_strdup_printf("%d%%", stats.ws_quality);
++        tip = g_strdup_printf("%ddB at %ddBm", stats.ws_quality, 
stats.ws_rate);
+     }
+   }
+   else {
Index: patches/patch-panel-plugin_wi_bsd_c
===================================================================
RCS file: 
/cvs/ports/x11/xfce4/xfce4-wavelan/patches/patch-panel-plugin_wi_bsd_c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-panel-plugin_wi_bsd_c
--- patches/patch-panel-plugin_wi_bsd_c 12 May 2005 04:38:50 -0000      1.1.1.1
+++ patches/patch-panel-plugin_wi_bsd_c 8 Jul 2008 14:29:08 -0000
@@ -1,12 +1,117 @@
 $OpenBSD: patch-panel-plugin_wi_bsd_c,v 1.1.1.1 2005/05/12 04:38:50 jolan Exp $
---- panel-plugin/wi_bsd.c.orig Mon Feb  9 15:20:54 2004
-+++ panel-plugin/wi_bsd.c      Mon Nov 29 23:56:41 2004
-@@ -56,7 +56,7 @@
+--- panel-plugin/wi_bsd.c.orig Thu Dec 21 22:33:39 2006
++++ panel-plugin/wi_bsd.c      Tue Jul  8 16:17:16 2008
+@@ -56,9 +56,9 @@
  #endif
  #endif
  #ifdef __OpenBSD__
 -#include <net/if_ieee80211.h>
-+#include <net80211/ieee80211.h>
  #include <dev/ic/if_wi_ieee.h>
- #define le16toh(x) letoh16(x)
+-#define le16toh(x) letoh16(x)
++#include <net80211/ieee80211.h>
++#include <net80211/ieee80211_ioctl.h>
+ #endif
  #endif
+ 
+@@ -95,8 +95,10 @@ struct wi_device
+ };
+ 
+ static int _wi_carrier(const struct wi_device *);
++#if defined(__NetBSD__) || defined(__FreeBSD__)
+ static int _wi_getval(const struct wi_device *, struct wi_req *);
+ static int _wi_vendor(const struct wi_device *, char *, size_t);
++#endif
+ static int _wi_netname(const struct wi_device *, char *, size_t);
+ static int _wi_quality(const struct wi_device *, int *);
+ static int _wi_rate(const struct wi_device *, int *);
+@@ -141,8 +143,10 @@ wi_query(struct wi_device *device, struct wi_stats *st
+   bzero((void *)stats, sizeof(*stats));
+ 
+   /* check vendor (independent of carrier state) */
++#if !defined(__OpenBSD__)
+   if ((result = _wi_vendor(device, stats->ws_vendor, WI_MAXSTRLEN)) != WI_OK)
+     return(result);
++#endif
+ 
+   /* check carrier */
+   if ((result = _wi_carrier(device)) != WI_OK)
+@@ -193,7 +197,71 @@ _wi_carrier(const struct wi_device *device)
+       return((ifmr.ifm_status & IFM_ACTIVE) != 0 ? WI_OK : WI_NOCARRIER);
+ }
+ 
++/* OpenBSD uses net80211 API */
++#if defined(__OpenBSD__)
+ static int
++_wi_netname(const struct wi_device *device, char *buffer, size_t len)
++{
++  int result;
++  struct ifreq ifr;
++  struct ieee80211_nwid nwid;
++
++  bzero((void *) &ifr, sizeof(ifr));
++  ifr.ifr_data = (caddr_t) & nwid;
++  strlcpy(ifr.ifr_name, device->interface, sizeof(ifr.ifr_name));
++  if ((result = ioctl(device->socket, SIOCG80211NWID, (caddr_t) & ifr)) != 
WI_OK)
++    return (result);
++
++  strlcpy(buffer, (char *) nwid.i_nwid, MIN(len, strlen(nwid.i_nwid) + 1));
++
++  return(WI_OK);
++}
++
++static int
++_wi_quality(const struct wi_device *device, int *quality)
++{
++  int result;
++  struct ieee80211_nodereq nr;
++  struct ieee80211_bssid bssid;
++
++  bzero((void *) &bssid, sizeof(bssid));
++  bzero((void *) &nr, sizeof(nr));
++
++  /* get i_bssid from interface */
++  strlcpy(bssid.i_name, device->interface, sizeof(bssid.i_name));
++  if((result = ioctl(device->socket, SIOCG80211BSSID, (caddr_t) &bssid)) != 
WI_OK)
++    return (result);
++
++  /* put i_bssid into nr_macaddr to get nr_rssi */
++  bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr));
++  strlcpy(nr.nr_ifname, device->interface, sizeof(nr.nr_ifname));
++  if ((result = ioctl(device->socket, SIOCG80211NODE, (caddr_t) & nr)) != 
WI_OK)
++    return (result);
++
++  *quality = nr.nr_rssi;
++  return(WI_OK);
++}
++
++static int
++_wi_rate(const struct wi_device *device, int *rate)
++{
++  int result;
++  struct ieee80211_txpower txpower;
++
++  bzero((void *) &txpower, sizeof(txpower));
++  strlcpy(txpower.i_name, device->interface, sizeof(txpower.i_name));
++  if ((result = ioctl(device->socket, SIOCG80211TXPOWER, (caddr_t) & 
txpower)) != WI_OK)
++
++    return (result);
++
++  *rate = txpower.i_val;
++  return(WI_OK);
++}
++#endif
++
++/* NetBSD and FreeBSD use old wi_* API */
++#if defined(__NetBSD__) || defined(__FreeBSD__)
++static int
+ _wi_getval(const struct wi_device *device, struct wi_req *wr)
+ {
+   struct ifreq ifr;
+@@ -311,5 +379,5 @@ _wi_rate(const struct wi_device *device, int *rate)
+   return(WI_OK);
+ }
+ 
+-#endif  /* !defined(__NetBSD__) && !defined(__FreeBSD__) */
+-
++#endif  /* defined(__NetBSD__) || defined(__FreeBSD__) */
++#endif
Index: pkg/PFRAG.shared
===================================================================
RCS file: pkg/PFRAG.shared
diff -N pkg/PFRAG.shared
--- pkg/PFRAG.shared    10 Nov 2005 22:57:41 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
[EMAIL PROTECTED] $OpenBSD: PFRAG.shared,v 1.2 2005/11/10 22:57:41 jolan Exp $
-lib/xfce4/panel-plugins/libwavelan.so
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/x11/xfce4/xfce4-wavelan/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- pkg/PLIST   16 Aug 2005 09:49:56 -0000      1.2
+++ pkg/PLIST   8 Jul 2008 14:29:08 -0000
@@ -1,5 +1,17 @@
 @comment $OpenBSD: PLIST,v 1.2 2005/08/16 09:49:56 espie Exp $
 @conflict xfce4-wavelan-plugin-*
-%%SHARED%%
-lib/xfce4/panel-plugins/libwavelan.a
-lib/xfce4/panel-plugins/libwavelan.la
+libexec/xfce4/
+libexec/xfce4/panel-plugins/
[EMAIL PROTECTED] libexec/xfce4/panel-plugins/xfce4-wavelan-plugin
+share/locale/de/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/eu/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/fr/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/hu/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/it/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/ja/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/ko/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/pl/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/locale/vi/LC_MESSAGES/xfce4-wavelan-plugin.mo
+share/xfce4/
+share/xfce4/panel-plugins/
+share/xfce4/panel-plugins/wavelan.desktop

Reply via email to