[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bind wireless pc card to device wvlan0 instead of eth0



Philipp Haller a écrit, mardi 15 octobre 2002, à 19:21 :
> Subject says it all. ;-)
> 
> I connect via DHCP so is there maybe something I have to set in /etc/dhclient.conf?

I didn't find an option (in pcmcia-cs-3.1.35), here is a patch:

--- /usr/src/modules/pcmcia-cs/wireless/orinoco_cs.c.orig	Sat Jun 29 08:39:33 2002
+++ /usr/src/modules/pcmcia-cs/wireless/orinoco_cs.c	Fri Jul 19 22:47:08 2002
@@ -41,6 +41,10 @@
 #include "hermes.h"
 #include "orinoco.h"
 
+/* first cards are named `wlanX' instead of `ethX' */
+#define IFACE_NAME_IS_WLAN
+#define MAX_WLAN_CARDS 8
+
 /*====================================================================*/
 
 static char version[] __initdata = "orinoco_cs.c 0.11b (David Gibson <hermes@gibson.dropbear.id.au> and others)";
@@ -442,6 +446,9 @@
 	tuple_t tuple;
 	cisparse_t parse;
 	int last_fn, last_ret;
+#ifdef IFACE_NAME_IS_WLAN
+	int i, wlan_err = 0;
+#endif
 	u_char buf[64];
 	config_info_t conf;
 	cistpl_cftable_entry_t dflt = { 0 };
@@ -620,10 +627,29 @@
 	ndev->base_addr = link->io.BasePort1;
 	ndev->irq = link->irq.AssignedIRQ;
 
+#ifdef IFACE_NAME_IS_WLAN
+	/* my name is wlanX... */
+	sprintf(ndev->name, "wlan0");
+	i = 0;
+	while((i < MAX_WLAN_CARDS) && ((wlan_err = register_netdev(ndev))==-EEXIST)) {
+	  sprintf(ndev->name, "wlan%d", ++i);
+	}
+
+	/* probably useless */
+	if (i >= MAX_WLAN_CARDS) {
+	  printk(KERN_DEBUG "orinoco_cs: wlan%d is too high! Back to ethX...\n", i);
+	  /* ...then try ethX ? */
+	  ndev->name[0] = '\0';
+	  wlan_err = register_netdev(ndev);
+	}
+
+	if (wlan_err) {
+#else
 	/* register_netdev will give us an ethX name */
 	ndev->name[0] = '\0';
 	/* Tell the stack we exist */
 	if (register_netdev(ndev) != 0) {
+#endif
 		printk(KERN_ERR "orinoco_cs: register_netdev() failed\n");
 		goto failed;
 	}

# patch end

HTH,
-- 
Jacques L'helgoualc'h



Reply to: