PATCH: "Could not get RID" error - RID len mismatch

Christophe Chaloin christophe.chaloin
Thu Mar 20 03:56:35 PST 2003


## repost in text format ##

I modified the sources from version 2002-10-12 of HostAP.
Here is the patch of my modifications.
Copy the diff above in the file "hostap_pci.patch" and apply with "patch -p1
< hostap_pci.patch".

Hope it will be useful !

Chris

---------------------------cut here--------------------------
--- old/hostap_hw.c Thu Mar 20 13:38:53 2003
+++ new/hostap_hw.c Thu Mar 20 13:39:36 2003
@@ -696,9 +696,7 @@
  return 0;
 }

-
-static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int
len,
-      int exact_len)
+static int hfa384x_get_rid_deported(struct net_device *dev, u16 rid, void
*buf, int len, int exact_len)
 {
  local_info_t *local = (local_info_t *) dev->priv;
  int res, rlen = 0;
@@ -750,6 +748,19 @@
  return rlen;
 }

+static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int
len, int exact_len)
+{
+ int ret;
+ int counter = 0;
+
+ ret = hfa384x_get_rid_deported(dev, rid, buf, len, exact_len);
+ while((ret < 0) && (counter<20)) {
+  counter++;
+  ret = hfa384x_get_rid_deported(dev, rid, buf, len, exact_len);
+ }
+
+ return ret;
+}

 static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int
len)
 {
@@ -884,13 +895,21 @@
 }


-static int prism2_get_version_info(struct net_device *dev, u16 rid,
-       const char *txt)
+static int prism2_get_version_info(struct net_device *dev, u16 rid, const
char *txt)
 {
  struct hfa384x_comp_ident comp;
+ int ret;
+ int counter = 0;

- if (hfa384x_get_rid(dev, rid, &comp, sizeof(comp), 1) < 0) {
-  printk(KERN_DEBUG "Could not get RID for component %s\n", txt);
+ ret = hfa384x_get_rid(dev, rid, &comp, sizeof(comp), 1);
+ printk(KERN_DEBUG "Reading %s with multiple attempts :\n", txt);
+ while((ret < 0) && (counter<20)) {
+  counter++;
+  ret = hfa384x_get_rid(dev, rid, &comp, sizeof(comp), 1);
+ }
+
+ if (counter>=20) {
+  printk(KERN_DEBUG "\nAborting\nCould not get RID for component %s\n",
txt);
   return -1;
  }

@@ -1077,6 +1096,8 @@
 {
  local_info_t *local = (local_info_t *) dev->priv;
  int ret, i, first = 1;
+ int counter = 0;
+

  PDEBUG(DEBUG_FLOW, "prism2_hw_init()\n");

@@ -1165,11 +1186,20 @@

   prism2_check_sta_fw_version(local);

-  if (hfa384x_get_rid(dev, HFA384X_RID_CNFOWNMACADDR,
-        &dev->dev_addr, 6, 1) < 0) {
-   printk("%s: could not get own MAC address\n",
-          dev->name);
+  ret = hfa384x_get_rid(dev, HFA384X_RID_CNFOWNMACADDR, &dev->dev_addr, 6,
1);
+  printk(KERN_DEBUG "Reading MAC address with multiple attempts :\n");
+  while((ret < 0) && (counter<20)) {
+   counter++;
+   ret = hfa384x_get_rid(dev, HFA384X_RID_CNFOWNMACADDR, &dev->dev_addr, 6,
1);
   }
+
+  if (counter>=20) {
+   printk(KERN_DEBUG "\nAborting\n%s: could not get own MAC address\n",
dev->name);
+   return -1;
+  }
+
+  printk(KERN_DEBUG "%s: MAC address OK\n", dev->name);
+
 #ifdef PRISM2_HOSTAPD
   memcpy(local->apdev->dev_addr, dev->dev_addr, ETH_ALEN);
 #endif /* PRISM2_HOSTAPD */
---------------------------cut here--------------------------





More information about the Hostap mailing list