diff options
author | Pietro Cerutti <gahr@FreeBSD.org> | 2008-03-28 17:33:50 +0000 |
---|---|---|
committer | Pietro Cerutti <gahr@FreeBSD.org> | 2008-03-28 17:33:50 +0000 |
commit | efb30783c88d92770116036c232784ebb64ea1b4 (patch) | |
tree | ad31ad3f14d4c7e3b794bbc7be6ffd0fe120832b /net/gkrellmwireless | |
parent | edc8e8e5ec0f13c1b212dea814db08f59414b241 (diff) | |
download | ports-efb30783c88d92770116036c232784ebb64ea1b4.tar.gz ports-efb30783c88d92770116036c232784ebb64ea1b4.zip |
Notes
Diffstat (limited to 'net/gkrellmwireless')
-rw-r--r-- | net/gkrellmwireless/Makefile | 10 | ||||
-rw-r--r-- | net/gkrellmwireless/files/patch-wireless.c | 107 | ||||
-rw-r--r-- | net/gkrellmwireless/files/patch-wireless.h | 13 |
3 files changed, 119 insertions, 11 deletions
diff --git a/net/gkrellmwireless/Makefile b/net/gkrellmwireless/Makefile index a5120aed174d..038a23702b27 100644 --- a/net/gkrellmwireless/Makefile +++ b/net/gkrellmwireless/Makefile @@ -7,7 +7,7 @@ PORTNAME= gkrellmwireless PORTVERSION= 0.2.2 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= net MASTER_SITES= http://gkrellm.luon.net/files/ @@ -23,10 +23,4 @@ USE_GNOME= imlib PLIST_FILES= libexec/gkrellm/plugins/wireless.so -.include <bsd.port.pre.mk> - -.if ${OSVERSION} >= 700042 -BROKEN= Does not compile with GCC 4.2 -.endif - -.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/net/gkrellmwireless/files/patch-wireless.c b/net/gkrellmwireless/files/patch-wireless.c new file mode 100644 index 000000000000..90f5d306b2d5 --- /dev/null +++ b/net/gkrellmwireless/files/patch-wireless.c @@ -0,0 +1,107 @@ +--- wireless.c.orig 2001-09-09 16:25:40.000000000 +0200 ++++ wireless.c 2008-03-18 12:10:36.000000000 +0100 +@@ -94,6 +94,37 @@ + + static int + find_wi_card(void) { ++ int s, ret; ++ ret = FALSE; ++ ++#if defined(__FreeBSD__) && __FreeBSD_version >= 600034 ++ struct ifaddrs *res = NULL, *ifa = NULL; ++ struct ifmediareq ifmr; ++ ++ if (getifaddrs(&res)) ++ return ret; ++ ++ if ((s = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { ++ freeifaddrs(res); ++ return ret; ++ } ++ ++ for (ifa = res; ifa; ifa = ifa->ifa_next) { ++ memset(&ifmr, 0, sizeof(ifmr)); ++ strncpy(ifmr.ifm_name, ifa->ifa_name, sizeof(ifmr.ifm_name)); ++ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) ++ continue; ++ if (!(ifmr.ifm_status & IFM_AVALID)) ++ continue; ++ if (IFM_TYPE(ifmr.ifm_active) != IFM_IEEE80211) ++ continue; ++ if (found_wcard(ifa->ifa_name) != NULL) ++ ret = TRUE; ++ } ++ ++ freeifaddrs(res); ++ ++#else + /* possible interfaces */ + char interfaces[][4] = {"wi0","wi1","wi2"}; + +@@ -101,9 +132,8 @@ + struct wi_req wreq; + /* interface request struct */ + struct ifreq ifr; +- int s,i,ret; ++ int i; + +- ret = FALSE; + /* open a socket for ioctl's */ + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) return ret; + +@@ -126,7 +156,7 @@ + + if(found_wcard(interfaces[i]) != NULL) ret = TRUE; + } +- ++#endif + close(s); + return ret; + } +@@ -174,11 +204,36 @@ + + static int + get_wi_link_quality(wcard_t *card, float *quality, float *level, float *noise) { ++ int s; ++#if defined(__FreeBSD__) && __FreeBSD_version >= 600034 ++ uint8_t buf[24 * 1024]; ++ struct ieee80211req ireq; ++ struct ieee80211req_scan_result *sr; ++ ++ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) return FALSE; ++ ++ memset(&ireq, 0, sizeof(ireq)); ++ strncpy(ireq.i_name, card->ifname, sizeof(ireq.i_name)); ++ ireq.i_type = IEEE80211_IOC_SCAN_RESULTS; ++ ireq.i_data = buf; ++ ireq.i_len = sizeof(buf); ++ if (ioctl(s, SIOCG80211, &ireq) < 0) { ++ close(s); ++ return FALSE; ++ } ++ close(s); ++ if (ireq.i_len < sizeof(struct ieee80211req_scan_result)) ++ return FALSE; ++ ++ sr = (struct ieee80211req_scan_result *) buf; ++ *quality = sr->isr_intval; ++ *level = sr->isr_rssi; ++ *noise = sr->isr_noise; ++#else + /* wireless info request struct */ + struct wi_req wreq; + /* interface request struct */ + struct ifreq ifr; +- int s; + + /* open a socket for ioctl's */ + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) return FALSE; +@@ -207,6 +262,8 @@ + *level = wreq.wi_val[1]; + *noise = wreq.wi_val[2]; + ++#endif ++ + return TRUE; + } + diff --git a/net/gkrellmwireless/files/patch-wireless.h b/net/gkrellmwireless/files/patch-wireless.h index 96d7403b1c54..0fce601556de 100644 --- a/net/gkrellmwireless/files/patch-wireless.h +++ b/net/gkrellmwireless/files/patch-wireless.h @@ -1,6 +1,6 @@ ---- wireless.h.orig Thu Aug 22 15:38:11 2002 -+++ wireless.h Thu Aug 22 15:38:24 2002 -@@ -21,7 +21,7 @@ +--- wireless.h.orig 2001-09-09 16:25:55.000000000 +0200 ++++ wireless.h 2008-03-18 12:07:33.000000000 +0100 +@@ -21,9 +21,14 @@ #include <gkrellm/gkrellm.h> #ifdef __FreeBSD__ #include <net/if.h> @@ -8,4 +8,11 @@ + #include <dev/wi/if_wavelan_ieee.h> #define ANCACHE #include <dev/an/if_aironet_ieee.h> ++ #if __FreeBSD_version > 600034 ++ #include <ifaddrs.h> ++ #include <net/if_media.h> ++ #include <net80211/ieee80211_ioctl.h> ++ #endif #endif + + #ifdef __NetBSD__ |