Hi,

Since the master mode is missing from the rewrite driver, I am still using the old driver to run an access point. The attached patch is based on Jon Smirl's patch on vendor's driver ZD1211LnxDrv_2_16_0_0 modified to get the old driver (r84) compiled without warning on 2.6.20 while maintaining compatibility with older kernels. So far, it has been working no worse than the previous drivers running on older kernels for me. Hope it will be useful for those are still stuck with the old driver.


Chun-Chung Chen
Index: src/zd1205_proc.c
===================================================================
--- src/zd1205_proc.c	(revision 84)
+++ src/zd1205_proc.c	(working copy)
@@ -30,7 +30,12 @@
 *
 * -------------------------------------------------------------------- */
 
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
+#include <linux/autoconf.h>
+#else
 #include <linux/config.h>
+#endif
 
 #ifdef CONFIG_PROC_FS
 #include "zd1205.h"
Index: src/zdhw.c
===================================================================
--- src/zdhw.c	(revision 84)
+++ src/zdhw.c	(working copy)
@@ -1865,7 +1865,7 @@
 HW_Set_AL2232_RF_Chips(zd_80211Obj_t *pObj, U32 ChannelNo, U8 InitChOnly)
 {
         void *reg = pObj->reg;
-        struct zd1205_private *macp = (struct zd1205_private *)g_dev->priv;
+        // struct zd1205_private *macp = (struct zd1205_private *)g_dev->priv;
         U32 tmpValue;
 
         if (!InitChOnly) {
Index: src/zd1205.c
===================================================================
--- src/zd1205.c	(revision 84)
+++ src/zd1205.c	(working copy)
@@ -31,7 +31,12 @@
 * -------------------------------------------------------------------- */
 #define __KERNEL_SYSCALLS__
 
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
+#include <linux/autoconf.h>
+#else
 #include <linux/config.h>
+#endif
 #include <net/checksum.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
@@ -193,7 +198,7 @@
 void zd1205_initCAM(struct zd1205_private *macp);
 int zd1205_CheckOverlapBss(struct zd1205_private *macp, plcp_wla_Header_t *pWlanHdr, u8 *pMacBody, u32 bodyLen);
 void zd1205_HandleQosRequest(struct zd1205_private *macp);
-void zd1205_SetRatesInfo(struct zd1205_private *macp);
+// void zd1205_SetRatesInfo(struct zd1205_private *macp);
 
 u8 X_To_dB(u32 X, u8 rate);
 u16 ZDLog10multiply100(int data);
@@ -734,7 +739,7 @@
 }
 
 
-inline u32 zd_readl(u32 offset)
+u32 zd_readl(u32 offset)
 {
 	struct zd1205_private *macp = g_dev->priv;
 	void *regp = macp->regp;
@@ -2027,7 +2032,7 @@
 
 void zd1205_tx_isr(struct zd1205_private *macp)
 {
-        zd1205_SwTcb_t *sw_tcb;
+        zd1205_SwTcb_t *sw_tcb = NULL;
 
 #ifndef HOST_IF_USB
 
@@ -2046,6 +2051,7 @@
         if (!macp->activeTxQ->count)
         {
                 printk(KERN_DEBUG "No element in activeQ\n");
+		clear_bit(ZD1211_TX_BUSY, &macp->flags);
                 return;
         }
 
@@ -2806,7 +2812,7 @@
         u32	min_length;
         u32 frame_len;
 
-        u32 len, len1,tot_len;
+        u32 len, tot_len;
         u8	bOfdmFrm = 0;
         u8	PlcpRate;
         //u8	rx_offset = macp->rxOffset;
@@ -7180,7 +7186,7 @@
         Tmp = Tmp < -105 ? -105: Tmp;
         Tmp = (Tmp + 105)*100/65;
 
-        snprintf(buf, sizeof(buf), "SignalStrength=%d\%,LinkQuality:%d\%", Tmp,list->signalQuality);
+        snprintf(buf, sizeof(buf), "SignalStrength=%lu%%,LinkQuality:%d%%", Tmp,list->signalQuality);
         iwe.u.data.length = strlen(buf);
         current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
 #endif
@@ -7385,7 +7391,7 @@
                 Tmp = Tmp < -105 ? -105: Tmp;
                 Tmp = (Tmp + 105)*100/65;
 
-                printk("   %2d %", Tmp);
+                printk("   %2lu %%", Tmp);
 
                 cap = pBssInfo->cap;
                 cap &= (0x10 | 0x02 | 0x01);
@@ -7524,7 +7530,7 @@
 	printk("\n");
 }
 
-static const int zd1211_set_auth_param(struct net_device *net_dev, const int idx, const u32 value) {
+static int zd1211_set_auth_param(struct net_device *net_dev, const int idx, const u32 value) {
 	int result;
 	struct zd1205_private *macp;
 
@@ -7605,7 +7611,7 @@
 
 static U8 zero_mac[]={0,0,0,0,0,0};
 // SIOCSIWENCODEEXT
-static const int zd1211_set_encode_ext(struct zd1205_private *macp, struct iwreq *wrq) {
+static int zd1211_set_encode_ext(struct zd1205_private *macp, struct iwreq *wrq) {
 	int i_key;
 	u8 *key;
 	size_t key_len;
@@ -7694,7 +7700,7 @@
 }
 
 // SIOCSIWGENIE
-static const int zd1211_set_wpa_ie(struct zd1205_private *macp, struct iwreq *wrq) {
+static int zd1211_set_wpa_ie(struct zd1205_private *macp, struct iwreq *wrq) {
         card_Setting_t *pSetting = &macp->cardSetting;
 
 	/* Copy the WPA IE */
@@ -7710,7 +7716,7 @@
 }
 
 
-const int zd1211_mlme(struct zd1205_private *macp) {
+int zd1211_mlme(struct zd1205_private *macp) {
 	int result;
 #ifdef HOSTAPD_SUPPORT
 	u8 mac_addr[80];
@@ -8434,8 +8440,14 @@
                         }
                         zd1205_lock(macp);
                         zd1205_zd_dbg2_ioctl(macp, &zdreq,&ret);
-                        copy_from_user(&in,((struct zdap_ioctl *)(ifr->ifr_data))->data,4);
-                        copy_to_user(((struct zdap_ioctl *)(ifr->ifr_data))->data, &ret, sizeof(ret));
+                        if (copy_from_user(&in,((struct zdap_ioctl *)(ifr->ifr_data))->data,4)) {
+				zd1205_unlock(macp);
+				return -EFAULT;
+                        }
+			if (copy_to_user(((struct zdap_ioctl *)(ifr->ifr_data))->data, &ret, sizeof(ret))) {
+				zd1205_unlock(macp);
+				return -EFAULT;
+			}
                         zd1205_unlock(macp);
                         err = 0;
                 }
@@ -10071,7 +10083,7 @@
         u8 SignalQuality2 = macp->rxSignalQuality2;
         u32 X;
         u16	tmpf;
-        u8 rxOffset = macp->rxOffset;
+        //u8 rxOffset = macp->rxOffset;
 
         wla_hdr = (plcp_wla_Header_t *)&rfd->RxBuffer[macp->rxOffset];
         tot_len = (le32_to_cpu(rfd->ActualCount) & 0x3fff);
Index: src/zd1205.h
===================================================================
--- src/zd1205.h	(revision 84)
+++ src/zd1205.h	(working copy)
@@ -1265,6 +1265,7 @@
 **		Function Declarations
 ***************************************************************************
 */
+void zd1205_SetRatesInfo(struct zd1205_private *macp);
 void zd1205_sleep_reset(struct zd1205_private *macp);
 void update_beacon_interval(struct zd1205_private *macp, int val);
 void zd1205_sw_reset(struct zd1205_private *macp);
@@ -1329,7 +1330,7 @@
 int zd1205_dis_connect(struct zd1205_private *macp);
 void ChangeMacMode(u8 MAC_Mode, u8 Channel);
 void zd1205_alloc_skbs(struct zd1205_private *macp);
-const int zd1211_mlme(struct zd1205_private *macp);
+int zd1211_mlme(struct zd1205_private *macp);
 #if ZDCONF_WE_STAT_SUPPORT == 1
 
 struct iw_statistics * zd1205_iw_getstats(struct net_device *dev);
Index: src/zd1211.c
===================================================================
--- src/zd1211.c	(revision 84)
+++ src/zd1211.c	(working copy)
@@ -30,7 +30,12 @@
 *
 * -------------------------------------------------------------------- */
 
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
+#include <linux/autoconf.h>
+#else
 #include <linux/config.h>
+#endif
 #include <net/checksum.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
@@ -1552,7 +1557,7 @@
                                   u16  WriteIndex = 0;
 #endif
 
-#if fVERIFY_FLASH
+#ifdef fVERIFY_FLASH
 
                                   u16  ReadAddr[cMAX_MULTI_READ_REG_NUM];
                                   u16  ReadData[cMAX_MULTI_READ_REG_NUM];
@@ -1775,6 +1780,21 @@
                                   defer_kevent(macp, KEVENT_STD_IOCTL);
                                   return 0;
                           }
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
+			  void process_event(struct zd1205_private *macp);
+                          void scan_tout_event(struct work_struct * work)
+                          {
+                                  struct zd1205_private *macp =
+                                          container_of(work, struct zd1205_private, scan_tout_event);
+                                  process_event(macp);
+                          }
+			void kevent(struct work_struct * work)
+			{
+				struct zd1205_private *macp =
+					container_of(work, struct zd1205_private, kevent);
+				process_event(macp);
+			}
+#endif
 
 #define	ZD1211_TX_TIMEOUT		(HZ*10)
 #define	ZD1211_MTU			1500
@@ -1801,8 +1821,13 @@
         spin_lock_init(&(macp->q_lock));
         spin_lock_init(&(macp->cs_lock));
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
+        INIT_WORK(&macp->kevent, kevent);
+        INIT_WORK(&macp->scan_tout_event, scan_tout_event);
+#else
         INIT_WORK(&macp->kevent, kevent, macp);
         INIT_WORK(&macp->scan_tout_event, kevent, macp);
+#endif
 
         macp->numTcb = NUM_TCB;
         macp->numTbd = NUM_TBD;
@@ -1887,12 +1912,14 @@
         dev->hard_start_xmit = zd1205_xmit_frame;
         dev->set_multicast_list = zd1205_set_multi;
         dev->get_stats = zd1205_get_stats;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
 #if ZDCONF_WE_STAT_SUPPORT == 1
 
         dev->get_wireless_stats = zd1205_iw_getstats;
 #elif !defined(ZDCONF_WE_STAT_SUPPORT)
 	#error "Undefine ZDCONF_WE_STAT_SUPPORT"
 #endif
+#endif
 
         dev->mtu = ZD1211_MTU;
         dev->set_mac_address = zd1205_set_mac;
@@ -2290,16 +2317,11 @@
 
 
 
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)||LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 void zd1211_rx_comp_cb(struct urb *urb)
 #else
 void zd1211_rx_comp_cb(struct urb *urb, struct pt_regs *regs)
 #endif
-
-
-
-
 {
         struct zd1205_private *macp = urb->context;
 
@@ -2371,7 +2393,7 @@
 
 
 //callback function for interrupt or response
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)||LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 void zd1211_intr_cb(struct urb *urb)
 #else
 void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
@@ -2528,7 +2550,7 @@
 
 
 //callback function for register get/set
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)||LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 void zd1211_reg_cb(struct urb *urb)
 #else
 void zd1211_reg_cb(struct urb *urb, struct pt_regs *regs)
@@ -2698,7 +2720,7 @@
 
 
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)||LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 void zd1211_tx_comp_cb(struct urb *urb)
 #else
 void zd1211_tx_comp_cb(struct urb *urb, struct pt_regs *regs)
@@ -3296,9 +3318,14 @@
 
 }
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
+void process_event(struct zd1205_private *macp)
+{
+#else
 void kevent(void *data)
 {
         struct zd1205_private *macp = (struct zd1205_private *) data;
+#endif
         if (!macp->bUSBDeveiceAttached) {
                 return;
         }
Index: src/zddebug.c
===================================================================
--- src/zddebug.c	(revision 84)
+++ src/zddebug.c	(working copy)
@@ -25,7 +25,7 @@
 extern U8 mGkInstalled;
 extern U8 mDynKeyMode;
 extern U8 mKeyFormat;
-void zd1205_cont_tx(struct zd1205_private *macp, u8 rate);
+int zd1205_cont_tx(struct zd1205_private *macp, u8 rate);
 extern int zd_SetKeyContext(U8 *addr, U8 encryMode, U8 keyLength, U8 KeyId, U8 *pKeyContent);
 extern void ConfigBcnFIFO(void);
 extern BOOLEAN zd_CmdDeauth(MacAddr_t *sta, U8 rCode);
@@ -698,7 +698,7 @@
 }
 
 
-void zd1205_cont_tx(struct zd1205_private *macp, u8 rate)
+int zd1205_cont_tx(struct zd1205_private *macp, u8 rate)
 {
 
         void *reg = dot11Obj.reg;
Index: src/zd1211.h
===================================================================
--- src/zd1211.h	(revision 84)
+++ src/zd1211.h	(working copy)
@@ -203,7 +203,7 @@
 int zd1211_USB_SET_RF_REG(u16 *InputValue, int bIs3683A);
 int zd1211_submit_rx_urb(struct zd1205_private *macp);
 int zd1211_submit_tx_urb(struct zd1205_private *macp,BOOLEAN LastFrag);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)||LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 void zd1211_tx_comp_cb(struct urb *urb);
 void zd1211_rx_comp_cb(struct urb *urb);
 void zd1211_intr_cb(struct urb *urb);
@@ -221,7 +221,9 @@
 int zd1211_GetUSBSpecData(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLength, u16 uCodeOfst);
 int zd1211_DownLoadUSBCode(struct zd1205_private *macp, u8* FileName, void *ptr, u16 uCodeOfst);
 int zd1211_WriteMultiRegister(u16 *Address, u16 *Value, u16 RegCount, u8 bAddUSBCSRAddress);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 void kevent(void *data);
+#endif
 void defer_kevent(struct zd1205_private *macp, int flag);
 void zd1211_rx_isr(unsigned long parm);
 void zd1211_tx_isr(unsigned long parm);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Zd1211-devs mailing list - http://zd1211.ath.cx/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs

Reply via email to