summary refs log tree commit diff
path: root/pkgs/os-specific/linux/broadcom-sta
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/broadcom-sta')
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/default.nix55
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/license.patch9
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/linux-2.6.39.patch11
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/linux-3.2.patch13
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/linux-3.4.patch12
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/linux-recent.patch126
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/makefile.patch16
7 files changed, 158 insertions, 84 deletions
diff --git a/pkgs/os-specific/linux/broadcom-sta/default.nix b/pkgs/os-specific/linux/broadcom-sta/default.nix
index 816a099e243..5955543f8e1 100644
--- a/pkgs/os-specific/linux/broadcom-sta/default.nix
+++ b/pkgs/os-specific/linux/broadcom-sta/default.nix
@@ -1,38 +1,37 @@
-{ stdenv, fetchurl, kernelDev }:
-
-let version = "5_100_82_112";
-    bits = if stdenv.system == "i686-linux" then "32" else
-      assert stdenv.system == "x86_64-linux"; "64";
+{ stdenv, fetchurl, kernel }:
+let
+  version = "6_30_223_141";
 in
-
 stdenv.mkDerivation {
-  name = "broadcom-sta-${version}-${kernelDev.version}";
-
-  src = fetchurl {
-    url = "http://www.broadcom.com/docs/linux_sta/hybrid-portsrc_x86_${bits}-v${version}.tar.gz";
-    sha256 = if bits == "32"
-      then "1rvhw9ngw0djxyyjx5m01c0js89zs3xiwmra03al6f9q7cbf7d45"
-      else "1qsarnry10f5m8a73wbr9cg2ifs00sqg6x0ay59l72vl9hb2zlww";
-  };
-
-  buildInputs = [ kernelDev ];
-  patches =
-    [ ./makefile.patch ./linux-2.6.39.patch ./linux-3.2.patch
-      ./linux-3.4.patch ./license.patch
-    ];
-
-  makeFlags = "KDIR=${kernelDev}/lib/modules/${kernelDev.modDirVersion}/build";
-
-  unpackPhase =
-    ''
+  name = "broadcom-sta-${version}-${kernel.version}";
+
+  src = if stdenv.system == "i686-linux" then (
+    fetchurl {
+      url = "http://www.broadcom.com/docs/linux_sta/hybrid-v35-nodebug-pcoem-${version}.tar.gz";
+      sha256 = "19wra62dpm0x0byksh871yxr128b4v13kzkzqv56igjfpzv36z6m";
+    } ) else (
+    fetchurl {
+      url = "http://www.broadcom.com/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-${version}.tar.gz";
+      sha256 = "0jlvch7d3khmmg5kp80x4ka33hidj8yykqjcqq6j56z2g6wb4dsz";
+    }
+  );
+
+  patches = [
+    ./linux-recent.patch
+    ./license.patch
+  ];
+
+  makeFlags = "KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}";
+
+  unpackPhase = ''
       sourceRoot=broadcom-sta
       mkdir "$sourceRoot"
       tar xvf "$src" -C "$sourceRoot"
-    '';
+  '';
 
   installPhase =
     ''
-      binDir="$out/lib/modules/${kernelDev.modDirVersion}/kernel/net/wireless/"
+      binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
       docDir="$out/share/doc/broadcom-sta/"
       mkdir -p "$binDir" "$docDir"
       cp wl.ko "$binDir"
@@ -43,7 +42,7 @@ stdenv.mkDerivation {
     description = "Kernel module driver for some Broadcom's wireless cards";
     homepage = http://www.broadcom.com/support/802.11/linux_sta.php;
     license = "unfree-redistributable";
-    maintainers = [ stdenv.lib.maintainers.vcunat ];
+    maintainers = with stdenv.lib.maintainers; [ phreedom vcunat ];
     platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/broadcom-sta/license.patch b/pkgs/os-specific/linux/broadcom-sta/license.patch
index b320d977e8b..aebb4636519 100644
--- a/pkgs/os-specific/linux/broadcom-sta/license.patch
+++ b/pkgs/os-specific/linux/broadcom-sta/license.patch
@@ -1,12 +1,13 @@
 diff -Naur hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c
 --- hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c	2009-04-23 02:48:59.000000000 +0900
 +++ hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c	2009-05-08 00:48:20.000000000 +0900
-@@ -163,6 +163,8 @@
+@@ -171,6 +171,8 @@
  static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
  static void wl_get_driver_info(struct net_device *dev, struct ethtool_drvinfo *info);
  
 +MODULE_LICENSE("MIXED/Proprietary");
 +
- static struct pci_device_id wl_id_table[] = {
- 	{ PCI_VENDOR_ID_BROADCOM, 0x4311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
- 	{ PCI_VENDOR_ID_BROADCOM, 0x4312, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
+ #if defined(WL_CONFIG_RFKILL)
+ #include <linux/rfkill.h>
+ static int wl_init_rfkill(wl_info_t *wl);
+
diff --git a/pkgs/os-specific/linux/broadcom-sta/linux-2.6.39.patch b/pkgs/os-specific/linux/broadcom-sta/linux-2.6.39.patch
deleted file mode 100644
index ca07c918c36..00000000000
--- a/pkgs/os-specific/linux/broadcom-sta/linux-2.6.39.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- old/src/wl/sys/wl_cfg80211.c
-+++ new/src/wl/sys/wl_cfg80211.c
-@@ -1811,7 +1811,7 @@
- 	notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) +
- 	                            wl_get_ielen(wl);
- 	freq = ieee80211_channel_to_frequency(notif_bss_info->channel 
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
- 		,(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ
- #endif
- 	);
diff --git a/pkgs/os-specific/linux/broadcom-sta/linux-3.2.patch b/pkgs/os-specific/linux/broadcom-sta/linux-3.2.patch
deleted file mode 100644
index b491537cb86..00000000000
--- a/pkgs/os-specific/linux/broadcom-sta/linux-3.2.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -Naur broadcom-sta-5.100.82.112.orig/src/wl/sys/wl_linux.c broadcom-sta-5.100.82.112/src/wl/sys/wl_linux.c
---- broadcom-sta-5.100.82.112.orig/src/wl/sys/wl_linux.c	2011-10-23 01:56:55.000000000 +0900
-+++ broadcom-sta-5.100.82.112/src/wl/sys/wl_linux.c	2011-11-22 00:56:07.021520421 +0900
-@@ -385,7 +385,9 @@
- #endif
- 	.ndo_get_stats = wl_get_stats,
- 	.ndo_set_mac_address = wl_set_mac_address,
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
- 	.ndo_set_multicast_list = wl_set_multicast_list,
-+#endif
- 	.ndo_do_ioctl = wl_ioctl
- };
- 
diff --git a/pkgs/os-specific/linux/broadcom-sta/linux-3.4.patch b/pkgs/os-specific/linux/broadcom-sta/linux-3.4.patch
deleted file mode 100644
index 854131c641b..00000000000
--- a/pkgs/os-specific/linux/broadcom-sta/linux-3.4.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- broadcom-sta.orig/src/wl/sys/wl_linux.c
-+++ broadcom-sta.new/src/wl/sys/wl_linux.c
-@@ -40,7 +40,9 @@
- #include <linux/pci_ids.h>
- #define WLC_MAXBSSCFG          1
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
- #include <asm/system.h>
-+#endif
- #include <asm/io.h>
- #include <asm/irq.h>
- #include <asm/pgtable.h>
diff --git a/pkgs/os-specific/linux/broadcom-sta/linux-recent.patch b/pkgs/os-specific/linux/broadcom-sta/linux-recent.patch
new file mode 100644
index 00000000000..97a331a2bd7
--- /dev/null
+++ b/pkgs/os-specific/linux/broadcom-sta/linux-recent.patch
@@ -0,0 +1,126 @@
+--- a/src/wl/sys/wl_linux.c	2013-08-01 08:52:22.000000000 +0200
++++ b/src/wl/sys/wl_linux.c	2013-09-13 14:25:36.463020788 +0200
+@@ -910,7 +910,11 @@
+ 	pci_set_drvdata(pdev, NULL);
+ }
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
+ static struct pci_driver wl_pci_driver = {
++#else
++static struct pci_driver wl_pci_driver __refdata = {
++#endif
+ 	name:		"wl",
+ 	probe:		wl_pci_probe,
+ 	suspend:	wl_suspend,
+@@ -3235,7 +3239,7 @@
+ void
+ wl_tkip_printstats(wl_info_t *wl, bool group_key)
+ {
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+ 	char debug_buf[512];
+ 	int idx;
+ 	if (wl->tkipmodops) {
+@@ -3408,6 +3412,7 @@
+ 	return 0;
+ }
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+ static int
+ wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
+ {
+@@ -3462,19 +3467,90 @@
+ 	return length;
+ }
+ 
++#else
++
++static int
++wl_proc_read(struct seq_file *seq, void *offset)
++{
++	wl_info_t * wl = (wl_info_t *)seq->private;
++	int bcmerror, to_user;
++
++	WL_LOCK(wl);
++	bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL);
++	WL_UNLOCK(wl);
++
++	seq_printf(seq, "%d\n", to_user);
++	return bcmerror;
++}
++
++static ssize_t wl_proc_write(struct file *file, const char __user *buff,
++			     size_t length, loff_t *ppos)
++{
++	struct seq_file *seq = file->private_data;
++	wl_info_t * wl = (wl_info_t *)seq->private;
++	int bcmerror, from_user = 0;
++
++	if (length != 1) {
++		WL_ERROR(("%s: Invalid data length\n", __FUNCTION__));
++		return -EIO;
++	}
++
++	if (copy_from_user(&from_user, buff, 1)) {
++		WL_ERROR(("%s: copy from user failed\n", __FUNCTION__));
++		return -EFAULT;
++	}
++
++	if (from_user >= 0x30)
++		from_user -= 0x30;
++
++	WL_LOCK(wl);
++	bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL);
++	WL_UNLOCK(wl);
++
++	if (bcmerror < 0) {
++		WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror));
++		return -EIO;
++	}
++	*ppos += length;
++	return length;
++}
++
++static int wl_proc_open(struct inode *inode, struct file *file)
++{
++	return single_open(file, wl_proc_read, PDE_DATA(inode));
++}
++
++static const struct file_operations wl_proc_fops = {
++	.owner = THIS_MODULE,
++	.open = wl_proc_open,
++	.read = seq_read,
++	.write = wl_proc_write,
++	.llseek = seq_lseek,
++	.release = single_release,
++};
++#endif
++
+ static int
+ wl_reg_proc_entry(wl_info_t *wl)
+ {
+ 	char tmp[32];
+ 	sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit);
+-	if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++	wl->proc_entry = create_proc_entry(tmp, 0644, NULL);
++	if (wl->proc_entry) {
++		wl->proc_entry->read_proc = wl_proc_read;
++		wl->proc_entry->write_proc = wl_proc_write;
++		wl->proc_entry->data = wl;
++	} 
++#else
++	wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_proc_fops, wl);
++#endif
++	if (!wl->proc_entry) {
+ 		WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
+ 		ASSERT(0);
+ 		return -1;
+ 	}
+-	wl->proc_entry->read_proc = wl_proc_read;
+-	wl->proc_entry->write_proc = wl_proc_write;
+-	wl->proc_entry->data = wl;
+ 	return 0;
+ }
+ #ifdef WLOFFLD
diff --git a/pkgs/os-specific/linux/broadcom-sta/makefile.patch b/pkgs/os-specific/linux/broadcom-sta/makefile.patch
deleted file mode 100644
index 6ba8527e267..00000000000
--- a/pkgs/os-specific/linux/broadcom-sta/makefile.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- src/Makefile	2010-10-08 00:32:59.000000000 +0200
-+++ src/Makefile	2010-11-09 11:06:28.832999850 +0100
-@@ -27,10 +27,10 @@
- EXTRA_LDFLAGS      := $(src)/lib/wlc_hybrid.o_shipped
- 
- all:
--	KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
-+	KBUILD_NOPEDANTIC=1 make -C ${KDIR} M=`pwd`
- 
- clean:
--	KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd` clean
-+	KBUILD_NOPEDANTIC=1 make -C ${KDIR} clean
- 
- install:
--	install -D -m 755 wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/wl.ko
-+	install -D -m 755 wl.ko $out/lib/modules/${kernelVersion}/kernel/drivers/net/wireless/wl.ko