summaryrefslogtreecommitdiff
path: root/net/gkrellmwireless2/files/patch-ume-scan.diff
diff options
context:
space:
mode:
Diffstat (limited to 'net/gkrellmwireless2/files/patch-ume-scan.diff')
-rw-r--r--net/gkrellmwireless2/files/patch-ume-scan.diff148
1 files changed, 0 insertions, 148 deletions
diff --git a/net/gkrellmwireless2/files/patch-ume-scan.diff b/net/gkrellmwireless2/files/patch-ume-scan.diff
deleted file mode 100644
index 7c82c9601046..000000000000
--- a/net/gkrellmwireless2/files/patch-ume-scan.diff
+++ /dev/null
@@ -1,148 +0,0 @@
-Index: wireless.c
-diff -u -p wireless.c.orig wireless.c
---- wireless.c.orig 2002-12-07 00:01:13.000000000 +0900
-+++ wireless.c 2007-10-04 02:52:24.000000000 +0900
-@@ -93,6 +93,37 @@ wcard_t *found_wcard(gchar *interface) {
- #if defined(__FreeBSD__) || defined(__NetBSD__)
- /* FreeBSD & NetBSD specific */
-
-+#if defined(__FreeBSD__) && __FreeBSD_version >= 600034
-+static gint
-+find_scan_card(void) {
-+ gint ret = FALSE;
-+ struct ifaddrs *res = NULL, *ifa = NULL;
-+ struct ifmediareq ifmr;
-+ int s;
-+
-+ if (getifaddrs(&res) != 0)
-+ 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;
-+ }
-+ close(s);
-+ freeifaddrs(res);
-+ return ret;
-+}
-+#else
- static int
- find_wi_card(void) {
- /* possible interfaces */
-@@ -161,18 +192,56 @@ find_an_card(void) {
- return ret;
- }
- #endif /* !defined(__NetBSD__) */
-+#endif /* defined(__FreeBSD__) && __FreeBSD_version >= 600034 */
-
- static gint
- find_wlancard(void) {
- gint ret = FALSE;
--
-+
-+#if defined(__FreeBSD__) && __FreeBSD_version >= 600034
-+ ret = find_scan_card();
-+#else
- ret = find_wi_card();
- #if !defined(__NetBSD__)
- ret = find_an_card() || ret;
- #endif /* !defined(__NetBSD__) */
-+#endif /* defined(__FreeBSD__) && __FreeBSD_version >= 600034 */
- return ret;
- }
-
-+#if defined(__FreeBSD__) && __FreeBSD_version >= 600034
-+static int
-+get_scan_link_quality(wcard_t *card, float *quality, float *level, float *noise) {
-+ int s;
-+ uint8_t buf[24 * 1024];
-+ struct ieee80211req ireq;
-+ struct ieee80211req_scan_result *sr;
-+
-+ /* open a socket for ioctl's */
-+ 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;
-+ return TRUE;
-+}
-+#endif /* defined(__FreeBSD__) && __FreeBSD_version >= 600034 */
-+
-+#if !defined(__FreeBSD__) || __FreeBSD_version < 700052
- static int
- get_wi_link_quality(wcard_t *card, float *quality, float *level, float *noise) {
- /* wireless info request struct */
-@@ -210,6 +279,7 @@ get_wi_link_quality(wcard_t *card, float
-
- return TRUE;
- }
-+#endif /* !defined(__FreeBSD__) || __FreeBSD_version < 700052 */
-
- #if !defined(__NetBSD__)
- static int
-@@ -256,6 +326,15 @@ get_an_link_quality(wcard_t *card, float
-
- static int
- get_link_quality(wcard_t *card, float *quality, float *level, float *noise) {
-+#if defined(__FreeBSD__) && __FreeBSD_version >= 600034
-+ if (strncmp(card->ifname, "an", 2) == 0 && isnumber(card->ifname[2]))
-+ return get_an_link_quality(card,quality,level,noise);
-+#if !defined(__FreeBSD__) || __FreeBSD_version < 700052
-+ else if (strncmp(card->ifname, "wi", 2) == 0 && isnumber(card->ifname[2]))
-+ return get_wi_link_quality(card,quality,level,noise);
-+#endif /* !defined(__FreeBSD__) || __FreeBSD_version < 700052 */
-+ return get_scan_link_quality(card,quality,level,noise);
-+#else
- switch (card->ifname[0]) {
- #if !defined(__NetBSD__)
- case 'a': /* an card */
-@@ -265,6 +344,7 @@ get_link_quality(wcard_t *card, float *q
- return get_wi_link_quality(card,quality,level,noise);
- }
- return FALSE;
-+#endif
- }
- #endif
-
-Index: wireless.h
-diff -u wireless.h.orig wireless.h
---- wireless.h.orig 2002-12-07 00:01:13.000000000 +0900
-+++ wireless.h 2007-10-04 02:33:03.000000000 +0900
-@@ -24,6 +24,11 @@
- #include <sys/socket.h>
- #include <sys/sockio.h>
- #include <net/if.h>
-+#if __FreeBSD_version >= 600034
-+ #include <net/if_media.h>
-+ #include <net80211/ieee80211_ioctl.h>
-+ #include <ifaddrs.h>
-+#endif
- #if __FreeBSD_version >= 470000
- #include <dev/wi/if_wavelan_ieee.h>
- #else