--- On Thu, 11/12/08, Nerijus Baliunas <[EMAIL PROTECTED]> wrote:

> From: Nerijus Baliunas <[EMAIL PROTECTED]>
> Subject: [zd1211-devs] ZD1211LnxDrv_2_22_0_0 + 2.6.26.5
> To: zd1211-devs@lists.sourceforge.net
> Date: Thursday, 11 December, 2008, 1:02 AM
> Hello,
> 
> Hin-Tak Leung said "I have recently upgraded to
> 2.6.26.2 and the same patch works fine."
> But the patch
> ZD1211LnxDrv_2_22_0_0.working-on-2.6.25.1-but-ugly.diff does
> not work
> for me (kernel 2.6.26.5-45.fc9, could be some wireless
> stuff backported by Fedora):
> 
> ZD1211LnxDrv_2_22_0_0/src/zd1205.c:7512: error: too few
> arguments to function 'iwe_stream_add_event'

2.6.26.5-45.fc9 is not *just* some wireless stuff backported by Fedora - 
John Linville (the kernel wireless maintainer) works for redhat, so the fedora 
kernel 2.6.26.5-45.fc9 is effectively 2.6.27.* as far as the wireless stack is 
concerned. 

Here is the latest diff I am using against 2.6.27.4. Let me (and the rest of 
the zd1211 people) know if it works or not.


      
diff --git a/Makefile b/Makefile
index 290b43b..a73cda3 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,10 @@ EXTRA_CFLAGS += -DZDCONF_APDBG
 EXTRA_CFLAGS += -DZDCONF_BANDEDGE_ADJUST
 EXTRA_CFLAGS += -DZDCONF_SES_SUPPORT=1
 EXTRA_CFLAGS += -DAAAA03_FIX=1
+EXTRA_CFLAGS += -DZDCONF_LP_SUPPORT=0       #See config.in for 0/1 usage
+EXTRA_CFLAGS += -DZDCONF_ACPI_SUPPORT=0
+EXTRA_CFLAGS += -DfDRV_UPDATE_EEP=0
+EXTRA_CFLAGS += -DZDCONF_ENABLE_USELESS_FUNCTION=0
 
 
 ifeq ($(ZDCONF_FULL_TIM_FIX), y)
@@ -340,10 +344,10 @@ endif
 both:
 	make clean
 	make ZD1211REV_B=0
-	make ZD1211REV_B=0 install
-	make clean
+	#make ZD1211REV_B=0 install
+	make almostclean
 	make ZD1211REV_B=1
-	make ZD1211REV_B=1 install
+	#make ZD1211REV_B=1 install
 
 	
 ifndef ZD1211REV_B
@@ -364,14 +368,17 @@ menuconfig:
 debug:
 	gcc -o apdbg apdbg.c
 	chmod +x apdbg
-	cp ./apdbg /sbin/apdbg   
+	#cp ./apdbg /sbin/apdbg   
 	make -C Menudbg
 	mv Menudbg/menudbg .
 	chmod +x menudbg
-	cp ./menudbg /sbin
+	#cp ./menudbg /sbin
 	gcc -DPKT_SEND_FUNCTION -o winevl_iface Winevl_iface/pkt_send.c Winevl_iface/winevl_bridge.c
 
-clean:
-	rm -rf .tmp_versions .*.cmd *.ko *.mod.c *.mod.o *.o $(SRC_DIR)/*.o  $(SRC_DIR)/.*.o.cmd menudbg apdbg winevl_iface
+almostclean:
+	rm -rf .tmp_versions .*.cmd *.mod.c *.mod.o *.o $(SRC_DIR)/*.o  $(SRC_DIR)/.*.o.cmd menudbg apdbg winevl_iface Module.symvers
+
+clean: almostclean
+	rm -rf *.ko
 
 
diff --git a/apdbg.c b/apdbg.c
index cbe5819..9462ee8 100644
--- a/apdbg.c
+++ b/apdbg.c
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
 
     if (argc < 5) {
         printf("Usage:\n");
-		printf("   %s<ifname> [<operation>] [<address>(0)] [<value>(0)]\n\n",  prgname );
+		printf("   %s <ifname> [<operation>] [<address>(0)] [<value>(0)]\n\n",  prgname );
 		printf("\n");
         printf("valid operation: mem, phy\n");
         printf("camdump, card, rfds, rmem, wmem, rate\n");
diff --git a/src/zd1205.c b/src/zd1205.c
index 42eba7a..bf0be43 100644
--- a/src/zd1205.c
+++ b/src/zd1205.c
@@ -6865,7 +6865,7 @@ zd1205_ioctl_setrate(struct net_device *dev, struct iw_param *frq)
                 macp->cardSetting.FixedRate = RATE_54M;
                 break;
             default:
-                printk("Rate = %ld\n", frq->value);
+                printk("Rate = %d\n", frq->value);
                 return -EINVAL;
         }
         macp->bFixedRate=1;
@@ -7160,16 +7160,16 @@ static int zd1205_ioctl_setmode(struct net_device *dev, __u32 *mode)
 	}
 
 	macp->bAssoc = 0;
-	if (macp->usb->speed != USB_SPEED_HIGH)
-		macp->cardSetting.MacMode = PURE_B_MODE;
-	else {
+	//if (macp->usb->speed != USB_SPEED_HIGH)
+	//	macp->cardSetting.MacMode = PURE_B_MODE;
+	//else {
 #if 0        
         if (macp->cardSetting.BssType == INDEPENDENT_BSS)
             macp->cardSetting.MacMode = PURE_B_MODE;
         else
 	        macp->cardSetting.MacMode = MIXED_MODE;
 #endif                             
-	}
+	//}
 
 	zd1205_SetRatesInfo(macp);    
 
@@ -7374,7 +7374,7 @@ static int zd1205wext_siwscan(struct net_device *dev, struct iw_request_info *in
     //BOOLEAN ProbeWithSsid_bak;
 	struct zd1205_private *macp = g_dev->priv;
 	u32 wait_cnt = 0;
-    int ret;
+    int ret = 0;
 
     if(!netif_running(dev))
         return -EINVAL;
@@ -7490,6 +7490,7 @@ encode_ie(void *buf, size_t bufsize,
  * format that the Wireless Tools will understand 
  */
 static char *zd1205_translate_scan(struct net_device *dev,
+                                   struct iw_request_info *info,
 					char *current_ev,
 					char *end_buf,
 					bss_info_t *list)
@@ -7509,7 +7510,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 	iwe.cmd = SIOCGIWAP;
 	iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
 	memcpy(iwe.u.ap_addr.sa_data, list->bssid, ETH_ALEN);
-	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
+	current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
 
 	/* Other entries will be displayed in the order we give them */
 
@@ -7519,7 +7520,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 		iwe.u.data.length = 32;
 	iwe.cmd = SIOCGIWESSID;
 	iwe.u.data.flags = 1;
-	current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, &list->ssid[2]);
+	current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, &list->ssid[2]);
 
 	/* Add mode */
 	iwe.cmd = SIOCGIWMODE;
@@ -7530,7 +7531,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 
 		else
 			iwe.u.mode = IW_MODE_ADHOC;
-		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+		current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
 	}
 
 	/* Add frequency */
@@ -7544,7 +7545,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 	}
 #endif
 	iwe.u.freq.e = 1;
-	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
+	current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
 
 #if ZDCONF_SIGNAL_INFO == 1
 #if WIRELESS_EXT < 15
@@ -7562,7 +7563,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 	iwe.u.qual.level = Tmp;
 	iwe.u.qual.noise = 0;
 	iwe.u.qual.qual = list->signalQuality;
-	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+	current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
 #else
 // Transform Signal quality from level to percentage
     memset(&iwe, 0, sizeof(iwe));
@@ -7572,9 +7573,9 @@ static char *zd1205_translate_scan(struct net_device *dev,
     Tmp = Tmp < -105 ? -105: Tmp;
     Tmp = (Tmp + 105)*100/65;
 
-    snprintf(buf, sizeof(buf), "SignalStrength=%lu %%,LinkQuality:%u%%", Tmp,list->signalQuality);
+    snprintf(buf, sizeof(buf), "SignalStrength=%u %%,LinkQuality:%u%%", Tmp,list->signalQuality);
     iwe.u.data.length = strlen(buf);
-    current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
+    current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
 #endif
 #endif
 #if ZDCONF_SES_SUPPORT == 1
@@ -7593,7 +7594,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
             sprintf(buf+6+i*2,"%02x",list->SES_Element.buf[5+i]);
 		}
         iwe.u.data.length = strlen(buf);
-        current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
+        current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
 
     }
 #endif
@@ -7606,11 +7607,11 @@ static char *zd1205_translate_scan(struct net_device *dev,
 	else
 		iwe.u.data.flags = IW_ENCODE_DISABLED;
 	iwe.u.data.length = 0;
-	current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, list->ssid);
+	current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, list->ssid);
 
 	/* Rate : stuffing multiple values in a single event require a bit
 	 * more of magic */
-	current_val = current_ev + IW_EV_LCP_LEN;
+	current_val = current_ev + iwe_stream_lcp_len(info);
 
 
 	iwe.cmd = SIOCGIWRATE;
@@ -7623,7 +7624,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 		/* Bit rate given in 500 kb/s units (+ 0x80) */
 		iwe.u.bitrate.value = ((list->supRates[i+2] & 0x7f) * 500000);
 		/* Add new value to event */
-		current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+		current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
 	}
 
 	if (list->apMode != PURE_B_AP){
@@ -7631,12 +7632,12 @@ static char *zd1205_translate_scan(struct net_device *dev,
 			/* Bit rate given in 500 kb/s units (+ 0x80) */
 			iwe.u.bitrate.value = ((list->extRates[i+2] & 0x7f) * 500000);
 			/* Add new value to event */
-			current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+			current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
 		}
 	}
 
 	/* Check if we added any event */
-	if((current_val - current_ev) > IW_EV_LCP_LEN)
+	if((current_val - current_ev) > iwe_stream_lcp_len(info))
 		current_ev = current_val;
 
 #if WIRELESS_EXT > 14
@@ -7647,7 +7648,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 	iwe.cmd = IWEVCUSTOM;
 	snprintf(buf, sizeof(buf), "bcn_int=%d", list->beaconInterval);
 	iwe.u.data.length = strlen(buf);
-	current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
+	current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
 
 	if (list->WPAIe[1] != 0) {
 		static const char rsn_leader[] = "rsn_ie=";
@@ -7664,7 +7665,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 					list->WPAIe, list->WPAIe[1]+2,
 					wpa_leader, sizeof(wpa_leader)-1);
 		if (iwe.u.data.length != 0)
-			current_ev = iwe_stream_add_point(current_ev, end_buf,
+			current_ev = iwe_stream_add_point(info, current_ev, end_buf,
 					&iwe, buf);
 	}
 	if (list->RSNIe[1] != 0) 
@@ -7678,7 +7679,7 @@ static char *zd1205_translate_scan(struct net_device *dev,
 					list->RSNIe, list->RSNIe[1]+2,
 					rsn_leader, sizeof(rsn_leader)-1);
 			if (iwe.u.data.length != 0)
-				current_ev = iwe_stream_add_point(current_ev, end_buf,	&iwe, buf);
+				current_ev = iwe_stream_add_point(info, current_ev, end_buf,	&iwe, buf);
 		}
 	}
 
@@ -7719,7 +7720,7 @@ static int zd1205wext_giwscan(struct net_device *dev, struct iw_request_info *in
         //4k byte most. So, we show from head/tail alternately.
         //if(loop & BIT_0) 
         {
-            current_ev = zd1205_translate_scan(dev, current_ev,
+          current_ev = zd1205_translate_scan(dev, info, current_ev,
                     //extra + IW_SCAN_MAX_DATA,
                     extra + data->length,
                     &macp->BSSInfo[i]);
@@ -9191,15 +9192,15 @@ void zd1205_init_card_setting(struct zd1205_private *macp)
 	else
     	pSetting->Rate275 = 0;    
 #else
-    if (macp->usb->speed != USB_SPEED_HIGH)
-        pSetting->MacMode = PURE_B_MODE;
-    else {
+    //if (macp->usb->speed != USB_SPEED_HIGH)
+    //    pSetting->MacMode = PURE_B_MODE;
+    //else {
 
         //if (pSetting->BssType == INDEPENDENT_BSS)
            //pSetting->MacMode = PURE_B_MODE;
         //else   
 	        pSetting->MacMode = MIXED_MODE;
-    }    
+    //}    
 	zd1205_SetRatesInfo(macp);
 	//pCardSetting->UartEnable = 1;	
 	//pCardSetting->BaudRate = BAUD_RATE_115200;
@@ -10228,8 +10229,8 @@ TX_LOOP:
                 CurrFragLen = 0;
             }
 
-            printk(KERN_DEBUG "zd1205: page_address = %x\n", (unsigned long)addr);
-            printk(KERN_DEBUG "zd1205: body_dma = %x\n", (unsigned long)body_dma);
+            printk(KERN_DEBUG "zd1205: page_address = %lx\n", (unsigned long)addr);
+            printk(KERN_DEBUG "zd1205: body_dma = %lx\n", (unsigned long)body_dma);
             pTbd++;
             tcb_tbd_num++;
         }
@@ -10652,6 +10653,7 @@ U16 zdcb_status_notify(U16 status, U8 *StaAddr)
 
         case STA_ASSOCIATED:
         case STA_REASSOCIATED:
+	  printk("Associated\n");
             macp->bAssoc = 1;
             mTmRetryConnect=0;
             iLED_ON(macp, macp->LinkLEDn);
diff --git a/src/zd1205_proc.c b/src/zd1205_proc.c
index 7c37d53..7788e9f 100644
--- a/src/zd1205_proc.c
+++ b/src/zd1205_proc.c
@@ -316,7 +316,7 @@ zd1205_init_proc_dir(void)
 
 	/* first check if adapters_proc_dir already exists */
 	len = strlen(ADAPTERS_PROC_DIR);
-	for (adapters_proc_dir = proc_net->subdir;
+	for (adapters_proc_dir = init_net.proc_net->subdir;
 	     adapters_proc_dir; adapters_proc_dir = adapters_proc_dir->next) {
 
 		if ((adapters_proc_dir->namelen == len) &&
@@ -326,7 +326,7 @@ zd1205_init_proc_dir(void)
 
 	if (!adapters_proc_dir)
 		adapters_proc_dir =
-			create_proc_entry(ADAPTERS_PROC_DIR, S_IFDIR, proc_net);
+			create_proc_entry(ADAPTERS_PROC_DIR, S_IFDIR, init_net.proc_net);
 
 	if (!adapters_proc_dir)
 		return false;
@@ -364,7 +364,7 @@ zd1205_proc_cleanup(void)
 	if (de)
 		return;
 
-	remove_proc_entry(ADAPTERS_PROC_DIR, proc_net);
+	remove_proc_entry(ADAPTERS_PROC_DIR, init_net.proc_net);
 	adapters_proc_dir = NULL;
 }
 
diff --git a/src/zd1211.c b/src/zd1211.c
index 57883f2..edf8876 100644
--- a/src/zd1211.c
+++ b/src/zd1211.c
@@ -496,13 +496,13 @@ int zd1211_USB_PACKAGE_READ_REGISTER(u16 *Address, u16 *pValue, u16 RegCount, u8
 	if (in_atomic()){
 #endif
 		printk(KERN_ERR "********zd1211_USB_PACKAGE_READ_REGISTER in_interrupt*********\n");
-		return 0;
+		return -1;
 	}
 	down(&macp->reg_sem); 
 	
 	if ((RegCount == 0) || (!macp->bUSBDeveiceAttached) || (!test_bit(ZD1211_RUNNING, &macp->flags))){
 		up(&macp->reg_sem);
-		return 0;
+		return -1;
 	}
 
    	pRegBuffer = kmalloc(size, GFP_KERNEL);
@@ -604,6 +604,24 @@ int zd1211_USB_PACKAGE_READ_REGISTER(u16 *Address, u16 *pValue, u16 RegCount, u8
 	if (test_bit(ZD1211_REQ_COMP, &macp->flags))
 		macp->regRspCompCnt++;
 	else{
+                { 
+                       int res;
+                       printk("%s: warning, restarting INT EP\n",__FUNCTION__);
+                       //dump_urb(macp->intr_urb);
+                       //usb_kill_urb(macp->intr_urb);
+                       usb_free_urb(macp->intr_urb);
+                       macp->intr_urb = USB_ALLOC_URB(0, GFP_KERNEL);
+                       usb_fill_int_urb(macp->intr_urb, macp->usb,
+		                        usb_rcvintpipe(macp->usb, EP_INT_IN),
+		                        macp->IntEPBuffer, MAX_EPINT_BUFFER,
+			                zd1211_intr_cb, macp, macp->in_interval);
+                       if ((res = SUBMIT_URB(macp->intr_urb, GFP_KERNEL))){
+                               printk(KERN_ERR "zd1211: failed intr_urb\n");
+                               zd1211_DumpErrorCode(macp, res);
+                               return -1;
+                       }
+                       macp->bUSBDeveiceAttached=1;
+                }
 		memset(macp->IntEPBuffer, 0x0, MAX_EPINT_BUFFER);
 		macp->regUnCompCnt++;
 		ret = -1;
@@ -653,14 +671,16 @@ u32 zd1211_readl(u32 Address, u8 bAddUSBCSRAddress)
 
 	while (bRet != 0){
 		bRet = zd1211_USB_PACKAGE_READ_REGISTER(ReadAddr, ReadData, 2, false);
+		if (!bRet) break; // OK
 		count++;
 		
 		if (count > 5){
 			printk(KERN_ERR "1211_readl failed for 5 attempts...Very Serious");
-			break;
+			return 0;
 		}
 	}
     
+	if (count) printk("%s retry OK\n",__FUNCTION__);
 	value = (((u32) ReadData[1]) << 16) + ReadData[0];
 	return value;
 }
@@ -1834,7 +1854,7 @@ extern struct iw_handler_def p80211wext_handler_def;
 
 u8 zd1211_InitSetup(struct net_device *dev, struct zd1205_private *macp)
 {
-	int res;
+	int res = 0;
 
 	//return true; //for debug
 	ZENTER(1);
@@ -1895,7 +1915,7 @@ u8 zd1211_InitSetup(struct net_device *dev, struct zd1205_private *macp)
 	macp->in_interval = 10;
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))        
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) /* this urb really needs to be transfer by interrupt - otherwise it doesn't work */        
 	usb_fill_int_urb(macp->intr_urb, macp->usb,
 		usb_rcvintpipe(macp->usb, EP_INT_IN),
 		macp->IntEPBuffer, MAX_EPINT_BUFFER,
@@ -1915,7 +1935,7 @@ u8 zd1211_InitSetup(struct net_device *dev, struct zd1205_private *macp)
 	macp->intr_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 #endif
 	if ((res = SUBMIT_URB(macp->intr_urb, GFP_KERNEL))){
-		printk(KERN_ERR "zd1211: failed intr_urb\n");
+		printk(KERN_ERR "zd1211: failed intr_urb with result %d\n", res);
 		zd1211_DumpErrorCode(macp, res);
 		return false;
 	}
@@ -2241,7 +2261,7 @@ void zd1211_rx_isr(unsigned long parm)
 		else
 			macp->NoMergedRxCnt++;
        
-		//ZD1211DEBUG(3, "last_pkt_len = %x\n", last_pkt_len);
+		ZD1211DEBUG(3, "last_pkt_len = %x\n", last_pkt_len);
 		//zd1205_dump_data("pRxBuffer", (u8 *)pRxBuffer, TotalLength);
        
 		for (i=0; i<total_rx_struct; i++){
@@ -2249,7 +2269,7 @@ void zd1211_rx_isr(unsigned long parm)
 			
 			if (total_rx_struct> 1){
                 CurFrmLen=zd_get_LE_U16(pRxBuffer+(TotalLength/sizeof(u16)+i-4)*2); 
-				//ZD1211DEBUG(2, "CurFrmLen = %x\n", CurFrmLen);
+				ZD1211DEBUG(2, "CurFrmLen = %x\n", CurFrmLen);
 			}
 			else
 				CurFrmLen = TotalLength;
@@ -2294,7 +2314,7 @@ void zd1211_rx_isr(unsigned long parm)
 		// last_pkt_len = 509, 510, 511
 		// wait next Rx
 		//ZD1211DEBUG(0, "Wait Rx Frames Length Info!!\n");
-		//ZD1211DEBUG(2, "last_pkt_len = %x\n", last_pkt_len);
+		ZD1211DEBUG(2, "last_pkt_len = %x\n", last_pkt_len);
 		macp->WaitLenInfoCnt++;
 		rx_struct->UnFinishFrmLen = ((TotalLength / macp->wMaxPacketSize) + 1) 
 					* (macp->wMaxPacketSize);
@@ -2341,7 +2361,7 @@ void zd1211_rx_isr(unsigned long parm)
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_rx_comp_cb(struct urb *urb)
 #else
-void zd1211_rx_comp_cb(struct urb *urb, struct pt_regs *regs)
+void zd1211_rx_comp_cb(struct urb *urb)
 #endif
 
 
@@ -2461,7 +2481,7 @@ void zd1211_rx_comp_cb(struct urb *urb, struct pt_regs *regs)
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_intr_cb(struct urb *urb)
 #else
-void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
+void zd1211_intr_cb(struct urb *urb)
 #endif
 {
 	struct zd1205_private *macp = urb->context;
@@ -2478,7 +2498,7 @@ void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
 		zd1211_DumpErrorCode(macp, urb->status);
 
 		if (urb->status == -ENODEV){ //device was removed
-			FPRINT("Device was removed!!!");
+			printk("Device was removed!!!\n");
 			macp->bUSBDeveiceAttached = 0;
 
             wake_up(&macp->regSet_wait);
@@ -2496,7 +2516,7 @@ void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
             case -EPROTO:
         #endif
                 macp->bUSBDeveiceAttached = 0;
-                FPRINT("Device was down!!!");
+                printk("Device was down!!!\n");
         #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
                 spin_unlock(&macp->intr_lock);
                 return;
@@ -2563,7 +2583,7 @@ void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
 					macp->bIBSS_Wakeup_Dest = 1;
 
 
-                //ZD1211DEBUG(2, "Retry Failed!!!\n");
+                ZD1211DEBUG(2, "Retry Failed!!!\n");
  		        //ZD1211DEBUG(2, "NewRate = %x\n", NewRate);
  		       	aid = zd_AidLookUp(pMacAddr);
 	           	zd_EventNotify(EVENT_TX_COMPLETE, ZD_RETRY_FAILED, 0xff, (U32)aid);
@@ -2585,11 +2605,10 @@ void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
 #if 1
     //memset(macp->IntEPBuffer, 0x0, MAX_EPINT_BUFFER);
 
-    //use bulk instead of interrupt in
-    usb_fill_bulk_urb(macp->intr_urb, macp->usb,
-		  usb_rcvbulkpipe(macp->usb, EP_INT_IN),
+    usb_fill_int_urb(macp->intr_urb, macp->usb,
+		  usb_rcvintpipe(macp->usb, EP_INT_IN),
 		  macp->IntEPBuffer, MAX_EPINT_BUFFER,
-          zd1211_intr_cb, macp);
+          zd1211_intr_cb, macp, macp->in_interval);
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) 
     macp->intr_urb->transfer_flags |= URB_ASYNC_UNLINK;
 #endif
@@ -2612,7 +2631,7 @@ void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_reg_cb(struct urb *urb)
 #else
-void zd1211_reg_cb(struct urb *urb, struct pt_regs *regs)
+void zd1211_reg_cb(struct urb *urb)
 #endif
 {
 	struct zd1205_private *macp = urb->context;
@@ -2627,7 +2646,7 @@ void zd1211_handle_non_tx_rx(struct zd1205_private *macp)
 
 	//intr_status = *(u16 *)(macp->IntEPBuffer3+4);
     intr_status = zd_get_LE_U16(macp->IntEPBuffer3+4);
-	//ZD1211DEBUG(2, "intr_status = %x\n", intr_status);
+	ZD1211DEBUG(2, "intr_status = %x\n", intr_status);
  
 	if (!intr_status)
     {
@@ -2741,11 +2760,10 @@ int zd1211_submit_rx_urb(struct zd1205_private *macp)
 #endif    
     	
 
-	usb_fill_bulk_urb(macp->rx_urb, macp->usb,
-		      usb_rcvbulkpipe(macp->usb, EP_DATA_IN),
+	usb_fill_int_urb(macp->rx_urb, macp->usb,
+		      usb_rcvintpipe(macp->usb, EP_DATA_IN),
 		      rx_buff, bufLen,
-
-		      zd1211_rx_comp_cb, macp);
+		      zd1211_rx_comp_cb, macp, macp->in_interval);
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
     macp->rx_urb->transfer_flags |= URB_ASYNC_UNLINK;
@@ -2800,7 +2818,7 @@ void zd1211_tx_isr(unsigned long parm)
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_tx_comp_cb(struct urb *urb)
 #else
-void zd1211_tx_comp_cb(struct urb *urb, struct pt_regs *regs)
+void zd1211_tx_comp_cb(struct urb *urb)
 
 #endif
 {
@@ -3184,18 +3202,18 @@ else
 
 if(nonDataLen == 0)
 {
-    usb_fill_bulk_urb(macp->tx_urb, macp->usb,
-              usb_sndbulkpipe(macp->usb, EP_DATA_OUT),
+    usb_fill_int_urb(macp->tx_urb, macp->usb,
+              usb_sndintpipe(macp->usb, EP_DATA_OUT),
               macp->tx_buff, TotalLength,
-              zd1211_tx_comp_cb, macp);
+              zd1211_tx_comp_cb, macp, macp->in_interval);
 }
 #if ZDCONF_TX_NOCOPY == 1
 else
 {
-    usb_fill_bulk_urb(macp->tx_urb, macp->usb,
-              usb_sndbulkpipe(macp->usb, EP_DATA_OUT),
+    usb_fill_int_urb(macp->tx_urb, macp->usb,
+              usb_sndintpipe(macp->usb, EP_DATA_OUT),
               noCopyStart, TotalLength,
-              zd1211_tx_comp_cb, macp);
+              zd1211_tx_comp_cb, macp, macp->in_interval);
 }
 #endif
 
@@ -3412,7 +3430,7 @@ int zd1211_GetUSBSpecData(struct zd1205_private *macp, u8 *pBuffer,
 				FIRMWARE_READ_DATA, USB_DIR_IN | 0x40, uCodeOfst, 0,
 				image, uCurLength, 1000 * HZ);			
 
-        //ZD1211DEBUG(3, "result = %d\n", result);        
+        ZD1211DEBUG(3, "result = %d\n", result);        
         if (result < 0) {
 			printk(KERN_ERR "zd1211: usb_rcvctrlpipe 1 fail: %02X\n", result);
 			goto exit;
@@ -3470,8 +3488,8 @@ int zd1211_LoadUSBSpecCode(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLen
 	while (uImgLength > 0) {
         int translen = (uImgLength > 4096) ? 4096 : uImgLength;
 
-        ZD1211DEBUG(0, "translen = %x\n", translen);
-        ZD1211DEBUG(0, "uCodeOfst = %x\n", uCodeOfst);
+        ZD1211DEBUG(1, "translen = %x\n", translen);
+        ZD1211DEBUG(1, "uCodeOfst = %x\n", uCodeOfst);
 
                                                                                                                                                                                      
 		result = usb_control_msg(macp->usb, usb_sndctrlpipe(macp->usb, 0),
@@ -3480,12 +3498,12 @@ int zd1211_LoadUSBSpecCode(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLen
 					image, translen, HZ);
 
         ZD1211DEBUG(0, "result = %x\n", result);
-        if(result != translen)
+        /*if(result != translen)
         {
             printk("##### Warning! ####\n");
             printk("usb_control_msg doesn't send all data out\n");
             printk("You need to decrease the message amount in each send\n");
-        }
+	}*/
 
 
 		if (result < 0) {
@@ -3493,7 +3511,7 @@ int zd1211_LoadUSBSpecCode(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLen
 			goto exit;
 		}
 
-
+		translen = result & ~1;
 		uImgLength -= translen;
 		image += translen;
 
@@ -3505,7 +3523,7 @@ int zd1211_LoadUSBSpecCode(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLen
 
 	
     if (bReboot){                                                                               
-        printk("Finsih download Firmware. Ready to reboot \n");
+        printk("Finish download Firmware. Ready to reboot \n");
  		result = usb_control_msg(macp->usb, usb_rcvctrlpipe(macp->usb, 0),
 				FIRMWARE_CONFIRM, USB_DIR_IN | 0x40, 0, 0,
 				&ret, sizeof(ret), 1000 * HZ);
@@ -3520,7 +3538,7 @@ int zd1211_LoadUSBSpecCode(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLen
 
 		}
 
-        //ZD1211DEBUG(2, "result = %x\n", result);
+        ZD1211DEBUG(2, "result = %x\n", result);
 
         ZD1211DEBUG(0, "FIRMWARE_CONFIRM = %x\n", ret);
 
diff --git a/src/zd1211.h b/src/zd1211.h
index 6a1f398..21c8e83 100644
--- a/src/zd1211.h
+++ b/src/zd1211.h
@@ -196,10 +196,10 @@ void zd1211_rx_comp_cb(struct urb *urb);
 void zd1211_intr_cb(struct urb *urb);
 void zd1211_reg_cb(struct urb *urb);
 #else
-void zd1211_tx_comp_cb(struct urb *urb, struct pt_regs *regs);
-void zd1211_rx_comp_cb(struct urb *urb, struct pt_regs *regs);
-void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs);
-void zd1211_reg_cb(struct urb *urb, struct pt_regs *regs);
+void zd1211_tx_comp_cb(struct urb *urb);
+void zd1211_rx_comp_cb(struct urb *urb);
+void zd1211_intr_cb(struct urb *urb);
+void zd1211_reg_cb(struct urb *urb);
 #endif
 void zd1211_disable_net_traffic(struct zd1205_private *macp);
 int zd1211_USB_ProgramFlash(struct zd1205_private *macp, u16 *Value, u16 RegCount);
diff --git a/src/zdapi.h b/src/zdapi.h
index f554685..bf35082 100644
--- a/src/zdapi.h
+++ b/src/zdapi.h
@@ -16,7 +16,7 @@
 #endif
 
 
-//#define ZD_DEBUG 	//debug protocol stack
+#define ZD_DEBUG 	//debug protocol stack
 
 #ifdef ZD_DEBUG
 #define ZDEBUG(string)			FPRINT(string)
diff --git a/src/zdasocsvc.c b/src/zdasocsvc.c
index 3b31ab9..b469792 100644
--- a/src/zdasocsvc.c
+++ b/src/zdasocsvc.c
@@ -4,6 +4,10 @@
 #include "zd80211.h"
 #include "zd1205.h"
 #include "zdturbo_burst.h"
+#undef FPRINT
+#define FPRINT(string)                  printk(KERN_DEBUG "%s\n", string)
+#undef FPRINT_V
+#define FPRINT_V(string, i)             printk(KERN_DEBUG "%s = %x\n", string, i)
 
 U8 AsocState = STE_ASOC_IDLE;
 static MacAddr_t AsSta;
@@ -19,8 +23,8 @@ BOOLEAN Disasoc(Signal_t *signal)
 	ReasonCode Rsn;
 	U8 vapId = 0;
 	
-	//ZDEBUG("Disasoc");
-	//FPRINT("Disasoc");
+	ZDEBUG("Disasoc");
+	FPRINT("Disasoc");
 	pfrmDesc = signal->frmInfo.frmDesc;
 	rdu = pfrmDesc->mpdu;
 	memcpy((U8 *)&Sta, (U8 *)(addr2(rdu)), 6); // Get the address of the transmitter.
@@ -76,8 +80,8 @@ BOOLEAN DisasocReq(Signal_t *signal)
 	ReasonCode Rsn = RC_UNSPEC_REASON;
 	U8 vapId = 0;
 
-	//ZDEBUG("DisasocReq");
-	//FPRINT("DisasocReq");
+	ZDEBUG("DisasocReq");
+	FPRINT("DisasocReq");
 	
 	memcpy((U8 *)&Sta, (U8 *)&signal->frmInfo.Sta, 6);
 	Rsn = signal->frmInfo.rCode;
@@ -153,7 +157,7 @@ BOOLEAN Re_Asociate(Signal_t *signal)
     {		
 		rdu = pfrmDesc->mpdu;
 		lsInterval = listenInt(pfrmDesc->mpdu);
-		//FPRINT_V("lsInterval", lsInterval);
+		FPRINT_V("lsInterval", lsInterval);
 		cap = cap(rdu);
 		memcpy((U8 *)&Sta, (U8 *)addr2(rdu), 6);
 	
@@ -244,7 +248,7 @@ BOOLEAN Re_Asociate(Signal_t *signal)
             { //Zydas 16.5M
 				ZydasMode = 1;
 				mZyDasModeClient = TRUE;
-			//FPRINT("ZydasMode");
+			FPRINT("ZydasMode");
 			}	
 		}	
 	
@@ -252,14 +256,14 @@ BOOLEAN Re_Asociate(Signal_t *signal)
         {
 			void *reg = pdot11Obj->reg;
 			// 11b STA 
-			//FPRINT("11b STA");
+			FPRINT("11b STA");
 			if (mMacMode == PURE_G_MODE){ // don't support b only sta
 				MaxRate = RateConvert((tmpMaxRate & 0x7f));	
 				//MaxBasicRate = RateConvert((HigestBasicRate & 0x7f));	
 				if (MaxRate < pdot11Obj->BasicRate)
                 {
-					//FPRINT_V("MaxRate", MaxRate);
-					//FPRINT_V("pdot11Obj->BasicRate", pdot11Obj->BasicRate);
+					FPRINT_V("MaxRate", MaxRate);
+					FPRINT_V("pdot11Obj->BasicRate", pdot11Obj->BasicRate);
 					asStatus = SC_UNSUP_RATES;
 					goto check_failed;
 				}	
@@ -289,7 +293,7 @@ BOOLEAN Re_Asociate(Signal_t *signal)
 					}
 				}
 				bErpSta = TRUE;		
-				//FPRINT("11g STA");
+				FPRINT("11g STA");
 			}
 			else {
 				FPRINT("Pure B mode don't support G sta");
@@ -394,10 +398,10 @@ BOOLEAN Re_Asociate(Signal_t *signal)
 							tmpValue &= ~NON_BARKER_PMB_SET;
 							tmpValue |= CTS_RATE_11M;
 							pdot11Obj->SetReg(reg, ZD_RTS_CTS_Rate, tmpValue); 
-							//FPRINT("Enable Barker Preamble");
+							FPRINT("Enable Barker Preamble");
 						}	
 						pdot11Obj->ConfigFlag |= ENABLE_PROTECTION_SET;
-						//FPRINT("Enable Protection Mode");
+						FPRINT("Enable Protection Mode");
 					}
 				}		
 		
@@ -475,7 +479,7 @@ BOOLEAN Re_AsocRsp(Signal_t *signal)
 	MacAddr_t Sta;
 	U16 status;
 		
-	//ZDEBUG("Re_AsocRsp");
+	ZDEBUG("Re_AsocRsp");
 	FPRINT("Re_AsocRsp");
 	
 	pfrmDesc = signal->frmInfo.frmDesc;
@@ -483,7 +487,7 @@ BOOLEAN Re_AsocRsp(Signal_t *signal)
 	
 	memcpy((U8 *)&Sta, (U8 *)addr2(rdu), 6);
 	if (memcmp(&AsSta, &Sta, 6) != 0){
-		//FPRINT("Not for my Assoc AP");
+		FPRINT("Not for my Assoc AP");
 		goto asoc_release;
 	}
 	
@@ -561,10 +565,10 @@ BOOLEAN Re_AsocRsp(Signal_t *signal)
 			}
 		}
 
-		//FPRINT_V("tmpMaxRate", tmpMaxRate);
-		//FPRINT_V("mMaxTxRate", mMaxTxRate);
+		FPRINT_V("tmpMaxRate", tmpMaxRate);
+		FPRINT_V("mMaxTxRate", mMaxTxRate);
 		MaxRate = RateConvert((tmpMaxRate & 0x7f));
-		//FPRINT_V("MaxRate", MaxRate);
+		FPRINT_V("MaxRate", MaxRate);
 		if (MaxRate > mMaxTxRate)
 			MaxRate = mMaxTxRate;
 		memset(mAPBrates.buf, 0, sizeof(Element)); 
diff --git a/src/zdhw.c b/src/zdhw.c
index e830d69..ce2e979 100644
--- a/src/zdhw.c
+++ b/src/zdhw.c
@@ -2301,7 +2301,7 @@ HW_Set_UW2453_RF_Chips(zd_80211Obj_t *pObj, U32 ChannelNo, U8 InitChOnly)
 #else
     LockPhyReg(pObj);
     //pObj->GetReg(reg, ZD_CR203, &tmpvalue);
-    tmpvalue &= ~BIT_4;
+    //tmpvalue &= ~BIT_4;
     //pObj->SetReg(reg, ZD_CR203, tmpvalue);
     UnLockPhyReg(pObj);
 #endif
@@ -4571,7 +4571,7 @@ void HW_SwitchChannel(zd_80211Obj_t *pObj, U16 channel, U8 InitChOnly, const U8
 	switch(pObj->rfMode)
 	{
 		default:
-			printk("Invalid RF module parameter:%lu", pObj->rfMode);
+			printk("Invalid RF module parameter:%u\n", pObj->rfMode);
 
 			break;
 /*			
@@ -4772,7 +4772,7 @@ void HW_SetBeaconFIFO(zd_80211Obj_t *pObj, U8 *pBeacon, U16 index)
     U16      WriteIndex=0;
 
 	//pObj->SetReg(reg, ZD_BCN_FIFO_Semaphore, 0x0);
-	//tmpValue = pObj->GetReg(reg, ZD_BCN_FIFO_Semaphore); //FIXME. Should be uncomment !?
+	tmpValue = pObj->GetReg(reg, ZD_BCN_FIFO_Semaphore); //FIXME. Should be uncomment !?
 
 	while (tmpValue & BIT_1){
 		pObj->DelayUs(1000);
diff --git a/src/zdinlinef.h b/src/zdinlinef.h
index 355e494..2ee9ec6 100644
--- a/src/zdinlinef.h
+++ b/src/zdinlinef.h
@@ -356,8 +356,8 @@ Cfg_CtrlSetting(
 	u8			tmp;
 	u16			Len = 0;
 	u16			NextLen = 0;
-	u16			LenInUs;
-	u16			NextLenInUs;
+	u16			LenInUs = 0;
+	u16			NextLenInUs = 0;
 	u8			Service;
 	u8			TxRate;
 	u8			Rate = pSetParms->Rate;
diff --git a/src/zdpsmon.c b/src/zdpsmon.c
index 5a28dc9..78f6708 100644
--- a/src/zdpsmon.c
+++ b/src/zdpsmon.c
@@ -408,10 +408,13 @@ Hash_t *RxInfoIndicate(MacAddr_t *sta, PsMode psm, U8 rate)
 		    return NULL;
     }    	
 	else{
-		PsMode oldPsm = pHash->psm;
-		StationState asoc = pHash->asoc;
-
+	        PsMode oldPsm;
+	        StationState asoc;
+	  
 updateInfo:		
+		oldPsm = pHash->psm;
+		asoc = pHash->asoc;
+
 		if (rate > pHash->MaxRate)
 			pHash->MaxRate = rate;
             
diff --git a/src/zdreq.c b/src/zdreq.c
index ed49fd2..c7bce11 100644
--- a/src/zdreq.c
+++ b/src/zdreq.c
@@ -62,7 +62,7 @@ int zdproduction_ioctl(struct zd1205_private *macp, struct zd_point *p)
 
     if (p->length < sizeof(oid_wrap_t) || !p->pointer)
     {
-        printk(KERN_ERR "Something Wrong,%d,%d\n",p->length,sizeof(oid_wrap_t));
+        printk(KERN_ERR "Something Wrong,%d,%ld\n",p->length,sizeof(oid_wrap_t));
         return -EINVAL;
     }
 
@@ -518,7 +518,7 @@ PULONG BytesNeeded
 
             if (InformationBufferLength < sizeof(ZD_RD_STRUCT)-4)
             {
-                ZDPRODUCTDBG("OID_ZD_RD: NDIS_STATUS_BUFFER_TOO_SHORT,%d,%d\r\n",InformationBufferLength,sizeof(ZD_RD_STRUCT));
+                ZDPRODUCTDBG("OID_ZD_RD: NDIS_STATUS_BUFFER_TOO_SHORT,%d,%ld\r\n",InformationBufferLength,sizeof(ZD_RD_STRUCT));
                 *BytesNeeded = sizeof(ZD_RD_STRUCT);
                 *BytesWritten = 0;
                 Status = NDIS_STATUS_BUFFER_TOO_SHORT;
diff --git a/src/zdreq.h b/src/zdreq.h
index ba4b0c6..3afb2ba 100644
--- a/src/zdreq.h
+++ b/src/zdreq.h
@@ -361,7 +361,7 @@ typedef enum _ZD_CUSTOM_FUNC_ID
 #define AP_RX_FILTER            0x0400feff
 #define STA_RX_FILTER           0x0000ffff
 
-//#define ZDDEBUG
+#define ZDDEBUG
 /* Macro definition */
 #ifdef ZDDEBUG
 #define ZDPRODUCTDBG(args...)           do { printk(KERN_DEBUG args); } while (0)
diff --git a/src/zdsynch.c b/src/zdsynch.c
index c6c7a04..f03e33e 100644
--- a/src/zdsynch.c
+++ b/src/zdsynch.c
@@ -302,6 +302,7 @@ BOOLEAN ProbeRsp_Beacon(Signal_t *signal)
 		if (!getElem(rdu, EID_SSID, &pCurrBssInfo->ssid,1)){
  			goto release;
 		}    
+		printk("%s: ssid=%s\n",__FUNCTION__,&(pCurrBssInfo->ssid.buf[2]));
 	
 		if (!getElem(rdu, EID_SUPRATES, &pCurrBssInfo->supRates,1)){
 			goto release;	
diff --git a/src/zdusb.c b/src/zdusb.c
index 99d21a7..18b9591 100644
--- a/src/zdusb.c
+++ b/src/zdusb.c
@@ -69,6 +69,7 @@ static struct usb_device_id zd1211_ids [] = {
     { USB_DEVICE(0x0053, 0x5301) },
     { USB_DEVICE(0x0053, 0x5302) },
     { USB_DEVICE(0x2019, 0x5303) }, //Add, 2006.04.17
+    { USB_DEVICE(0x0471, 0x1236) },
     { USB_DEVICE(0x050D, 0x4050) },
     { USB_DEVICE(0x050D, 0x705C) },
     { USB_DEVICE(0x0586, 0x340F) },
@@ -79,7 +80,7 @@ static struct usb_device_id zd1211_ids [] = {
     { USB_DEVICE(0x0CDE, 0x001A) },
     { USB_DEVICE(0x0DF6, 0x9075) },
     { USB_DEVICE(0x0F88, 0x3014) },
-    { USB_DEVICE(0x1233, 0x0471) },
+    { USB_DEVICE(0x1233, 0x0471) }, /* typo for an earlier Philip USB stick? */
     { USB_DEVICE(0x1582, 0x6003) },
 #endif
 #elif defined(ZD1211)
@@ -318,6 +319,7 @@ static int zd1211_probe(struct usb_interface *interface,
 	usb_get_dev(dev);
 #endif    
 
+	mdelay(1); // workaround loading FW bug
 	vendor_id = zd_le16_to_cpu(dev->descriptor.idVendor);
 	product_id = zd_le16_to_cpu(dev->descriptor.idProduct);
 
@@ -373,7 +375,6 @@ static int zd1211_probe(struct usb_interface *interface,
 	net->priv = macp;   //kernel 2.6
 	macp->device = net;
 	macp->usb = dev;
-	SET_MODULE_OWNER(net);
 	macp->dev_index = dev_index;
 	macp->release = zd_le16_to_cpu(dev->descriptor.bcdDevice);
 	printk(KERN_NOTICE "Release Ver = %04x\n", macp->release);
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs

Reply via email to