Submitted By: David B. Cortarello (Nomius) Date: 02-07-2006 Initial Package Version: 2.0.7.0 Description: The patch was created from the original RT25USB-SRC with the dos2unix formating This patch provides the following bug solution: * Fixed: _WIN32_WINNT warnings (Let's use WIN32_LEAN_AND_MEAN before) * Fixed: DBG warnings (ok, an ifdef before usage is not a bad idea ;) ) * Changed verify_area for access_ok (Come on! that's pretty old! The driver doesn't even see that old function) * Added a compilation time debug system (To activate or deactivate it see config.h, DEBUG_NOMIUS 0 means no debuging, a number different than 0 will enable it). * Added stdlib.h to qhexvalidator.h in the driver utility (without it, it doesn't even compile) * Fix the thread issue like in the ralink pcmcia Utility driver diff -Naur RT25USB-SRC-V2.0.7.0.old/LINUX_RACONFIG_V2.0.0.7/qhexvalidator.cpp RT25USB-SRC-V2.0.7.0/LINUX_RACONFIG_V2.0.0.7/qhexvalidator.cpp --- RT25USB-SRC-V2.0.7.0.old/LINUX_RACONFIG_V2.0.0.7/qhexvalidator.cpp 2006-07-02 01:41:26.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/LINUX_RACONFIG_V2.0.0.7/qhexvalidator.cpp 2006-07-02 01:10:14.000000000 -0300 @@ -31,6 +31,7 @@ #include #include +#include #include "qhexvalidator.h" diff -Naur RT25USB-SRC-V2.0.7.0.old/LINUX_RACONFIG_V2.0.0.7/raconfig2500.pro RT25USB-SRC-V2.0.7.0/LINUX_RACONFIG_V2.0.0.7/raconfig2500.pro --- RT25USB-SRC-V2.0.7.0.old/LINUX_RACONFIG_V2.0.0.7/raconfig2500.pro 2006-07-02 01:42:08.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/LINUX_RACONFIG_V2.0.0.7/raconfig2500.pro 2006-07-02 01:10:24.000000000 -0300 @@ -1,5 +1,5 @@ TEMPLATE =app -CONFIG += qt warn_off release +CONFIG += qt warn_off release thread INCLUDEPATH += . HEADERS += RaPropSheet.h \ diff -Naur RT25USB-SRC-V2.0.7.0.old/ReleaseNote RT25USB-SRC-V2.0.7.0/ReleaseNote --- RT25USB-SRC-V2.0.7.0.old/ReleaseNote 2006-07-01 14:24:05.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/ReleaseNote 2006-07-03 23:01:04.000000000 -0300 @@ -45,4 +45,18 @@ Version: 2.0.7.0 2006-03-07 ----------------------------------------------------------------- 1. Fix SHA-fun byte reverse (md5.c) in big endian platform -2. usb_unlink_urb instead in greater than kernel 2.6.7 \ No newline at end of file +2. usb_unlink_urb instead in greater than kernel 2.6.7 + +----------------------------------------------------------------- +Version: 2.0.7.1 2006-07-02 +----------------------------------------------------------------- +Patchs applied by David B. Cortarello (Nomius) +1. Fixed: _WIN32_WINNT warnings +2. Fixed: DBG warnings +3. Changed verify_area for access_ok +4. Added a compilation time debug system (To activate or deactivate it see + config.h, DEBUG_NOMIUS 0 means no debuging, a number different than 0 will + enable it). +5. Added stdlib.h to qhexvalidator.h in the Utility driver. +6. Fix the qt thread issue like in Utility driver + diff -Naur RT25USB-SRC-V2.0.7.0.old/config.h RT25USB-SRC-V2.0.7.0/config.h --- RT25USB-SRC-V2.0.7.0.old/config.h 1969-12-31 21:00:00.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/config.h 2006-07-02 00:08:45.000000000 -0300 @@ -0,0 +1 @@ +#define DEBUG_NOMIUS 0 /* 0 means no debuging */ diff -Naur RT25USB-SRC-V2.0.7.0.old/oid.h RT25USB-SRC-V2.0.7.0/oid.h --- RT25USB-SRC-V2.0.7.0.old/oid.h 2006-07-01 14:24:05.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/oid.h 2006-07-02 01:17:25.000000000 -0300 @@ -573,12 +573,14 @@ #define RT_OID_802_11_POWER_MODE (OID_GET_SET_TOGGLE | OID_802_11_POWER_MODE) #define RT_OID_802_11_STATISTICS (OID_GET_SET_TOGGLE | OID_802_11_STATISTICS) -#if DBG +#ifdef DBG + #if DBG #define RT_OID_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 #define RT_OID_802_11_SET_HARDWARE_REGISTER (OID_GET_SET_TOGGLE | RT_OID_802_11_QUERY_HARDWARE_REGISTER) + #endif #endif #define RT_OID_802_11_QUERY_CURRENT_CHANNEL_ID 0x0D710117 - + //Add Paul Chen for Accton #define RT_OID_TX_POWER_LEVEL 0xFF020010 #define RT_OID_SET_TX_POWER_LEVEL (OID_GET_SET_TOGGLE | RT_OID_TX_POWER_LEVEL) diff -Naur RT25USB-SRC-V2.0.7.0.old/rt2570sw.h RT25USB-SRC-V2.0.7.0/rt2570sw.h --- RT25USB-SRC-V2.0.7.0.old/rt2570sw.h 2006-07-01 14:24:05.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/rt2570sw.h 2006-07-03 22:21:15.000000000 -0300 @@ -34,6 +34,7 @@ Name Date Modification logs Jan Lee 2005-06-01 Release */ +#include "config.h" #ifndef __vnetsw_h_OK__ #define __vnetsw_h_OK__ @@ -175,33 +176,48 @@ // // MACRO for debugging information // -#if 1 -extern ULONG RTDebugLevel; - -#define DBGPRINT(Level, fmt, args...) \ -{ \ - if (Level <= RTDebugLevel) \ - { \ - printk(NIC_DBG_STRING); \ - printk(KERN_DEBUG fmt, ## args); \ - } \ -} - -#define DBGPRINT_RAW(Level, fmt, args...) \ -{ \ - if (Level <= RTDebugLevel) \ - { \ - printk(" "); \ - printk(KERN_DEBUG fmt, ## args); \ - } \ -} - +#if DEBUG_NOMIUS == 0 + extern ULONG RTDebugLevel; + #undef DBGPRINT //(Level, fmt, args...) + #undef DBGPRINT_RAW //(Level, fmt, args...) + #define DBGPRINT(Level, fmt, args...) \ + { \ + ; \ + } + + #define DBGPRINT_RAW(Level, fmt, args...) \ + { \ + ; \ + } #else -#define DBGPRINT(Level, fmt, args...) -#define DBGPRINT_RAW(Level, fmt, args...) + #if 1 + extern ULONG RTDebugLevel; + #define DBGPRINT(Level, fmt, args...) \ + { \ + if (Level <= RTDebugLevel) \ + { \ + printk(NIC_DBG_STRING); \ + printk(KERN_DEBUG fmt, ## args); \ + } \ + } + + #define DBGPRINT_RAW(Level, fmt, args...) \ + { \ + if (Level <= RTDebugLevel) \ + { \ + printk(" "); \ + printk(KERN_DEBUG fmt, ## args); \ + } \ + } + #else + #define DBGPRINT(Level, fmt, args...) + #define DBGPRINT_RAW(Level, fmt, args...) + #endif #endif + + # define assert(expr) \ if(unlikely(!(expr))) { \ printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ diff -Naur RT25USB-SRC-V2.0.7.0.old/rtusb.h RT25USB-SRC-V2.0.7.0/rtusb.h --- RT25USB-SRC-V2.0.7.0.old/rtusb.h 2006-07-01 14:24:05.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/rtusb.h 2006-07-01 23:48:06.000000000 -0300 @@ -40,12 +40,15 @@ // // MACRO definitions // -#if (_WIN32_WINNT >= 0x0501) -#define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ - NdisQueryBufferSafe(_NdisBuf, _ppVA, _pBufLen, NormalPagePriority) -#else -#define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ - NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen) + +#ifdef WIN32_LEAN_AND_MEAN + #if (_WIN32_WINNT >= 0x0501) + #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ + NdisQueryBufferSafe(_NdisBuf, _ppVA, _pBufLen, NormalPagePriority) + #else + #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ + NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen) + #endif #endif // MACRO for Ndis packet extra information diff -Naur RT25USB-SRC-V2.0.7.0.old/rtusb_info.c RT25USB-SRC-V2.0.7.0/rtusb_info.c --- RT25USB-SRC-V2.0.7.0.old/rtusb_info.c 2006-07-02 00:41:20.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/rtusb_info.c 2006-07-02 01:33:54.000000000 -0300 @@ -36,6 +36,7 @@ */ #include "rt_config.h" #include +#include extern UCHAR CipherWpa2Template[]; extern UCHAR CipherWpa2TemplateLen; @@ -3983,8 +3984,8 @@ case SIOCGIWPRIV: if (wrq->u.data.pointer) { - if ( verify_area(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab)) ) - break; + if ( access_ok(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab)) ) + break; wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]); if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab))) Status = -EFAULT; diff -Naur RT25USB-SRC-V2.0.7.0.old/rtusb_main.c RT25USB-SRC-V2.0.7.0/rtusb_main.c --- RT25USB-SRC-V2.0.7.0.old/rtusb_main.c 2006-07-03 23:09:15.000000000 -0300 +++ RT25USB-SRC-V2.0.7.0/rtusb_main.c 2006-07-03 23:10:53.000000000 -0300 @@ -36,6 +36,7 @@ */ #include "rt_config.h" +#include "config.h" unsigned long flagg; ULONG RTDebugLevel = RT_DEBUG_TRACE; @@ -92,7 +93,6 @@ static void usb_rtusb_disconnect(struct usb_interface *intf); struct usb_driver rtusb_driver = { - .owner = THIS_MODULE, .name="rtusb", .probe=usb_rtusb_probe, .disconnect=usb_rtusb_disconnect, @@ -1068,12 +1068,11 @@ case OID_802_11_ADD_KEY: DBGPRINT(RT_DEBUG_TRACE, "Set::OID_802_11_ADD_KEY \n"); + NdisStatus = RTMPWPAAddKeyProc(pAdapter, pData); { - int i = 0; - PNDIS_802_11_KEY pkey = (PNDIS_802_11_KEY)pData; - +// int i = 0; +// PNDIS_802_11_KEY pkey = (PNDIS_802_11_KEY)pData; } - NdisStatus = RTMPWPAAddKeyProc(pAdapter, pData); RTUSBBulkReceive(pAdapter); break; @@ -1110,9 +1109,11 @@ if ((cmdqelmt->command != RT_OID_SINGLE_READ_MAC) && (cmdqelmt->command != RT_OID_MULTI_READ_MAC) && (cmdqelmt->command != RT_OID_VENDOR_READ_BBP) && -#if DBG +#ifdef DBG + #if DBG (cmdqelmt->command != RT_OID_802_11_QUERY_HARDWARE_REGISTER) && -#endif + #endif +#endif (cmdqelmt->command != RT_OID_USB_VENDOR_EEPROM_READ)) { if (cmdqelmt->buffer != NULL)