System:

Computer: Asus G1S laptop
OS: Slackware 13.1.0
Kernel: Custom/optimized 2.6.38, however 2.6.36.2, 2.6.35.7 and 2.6.33.4 have also been tested.
WLAN adapter: 03:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61), using kernel module iwlagn


Problem:

When I attempt to use my WLAN adapter the following issue occurs:

Code:
x86# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf 
ioctl[SIOCGIWSCAN]: Resource temporarily unavailable
ioctl[SIOCSIWSCAN]: Device or resource busy
Failed to initiate AP scan.
^CCTRL-EVENT-TERMINATING - signal 2 received
x86#
Also, when I try by hand to simply scan manually for available networks:

Code:
x86_20# iwlist wlan0 scan
wlan0     Interface doesn't support scanning : Network is down

x86_20# ifconfig wlan0 up
x86_20# iwlist wlan0 scan
wlan0     Interface doesn't support scanning : Device or resource busy

x86_20# iwlist wlan0 scan
wlan0     Interface doesn't support scanning : Device or resource busy

x86_20# iwlist wlan0 scan
wlan0     Scan completed :
I.e. it seems to work only sporadically.

However I'm completely unable to associate with an AP, even when I specify the MAC address and frequency of the AP. This is not an issue with the AP itself, as it happens on several different APs that have no issues with being used by other STAs.


Past issues with the system:

The following past issues are known for this computer.

Issue with CRDA:

Code:
wlan0: authenticate with xx:xx:xx:xx:xx:xx (try 1)
wlan0: authenticated
wlan0: associate with xx:xx:xx:xx:xx:xx (try 1)
wlan0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x421 status=0 aid=2)
wlan0: associated
wlan0: deauthenticating from xx:xx:xx:xx:xx:xx by local choice (reason=3)
cfg80211: Calling CRDA to update world regulatory domain
cfg80211: World regulatory domain updated:
    (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
    (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
    (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
    (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
    (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
    (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
I.e. it seems that whenever the kernel attempts to use the CRDA subsystem to fetch world regulatory domain information, it would deauthenticate with the AP, hence closing my connection.

A hack around this issue was to simply use wpa_supplicant which will instantly reassociate with the AP whenever this happened; although it could at times happen in a more continuous manner, causing the connection to be somewhat unstable.

I never found a proper solution for this issue, even though I even tried to modify the kernel source to avoid using the CRDA subsystem altogether.


Possible solutions:

I have already attempted to use different ucodes for the WLAN adapter, to no avail. I also tried this for the CRDA issue.

I attempted to use ndiswrapper as an alternative to the native kernel driver. The problem with this is that it simply does not compile, as such:

Code:
make -C driver
make[1]: Entering directory `/temp_install/ndiswrapper-1.56/driver'
make -C /usr/src/linux-2.6.38 M=/temp_install/ndiswrapper-1.56/driver
make[2]: Entering directory `/usr/src/linux-2.6.38'
  CC [M]  /temp_install/ndiswrapper-1.56/driver/iw_ndis.o
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1966: error: unknown field 'num_private' specified in initializer
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1966: warning: initialization makes pointer from integer without a cast
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1967: error: unknown field 'num_private_args' specified in initializer
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1967: warning: excess elements in struct initializer
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1967: warning: (near initialization for 'ndis_handler_def')
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1970: error: unknown field 'private' specified in initializer
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1970: warning: initialization makes integer from pointer without a cast
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1970: error: initializer element is not computable at load time
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1970: error: (near initialization for 'ndis_handler_def.num_standard')
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1971: error: unknown field 'private_args' specified in initializer
/temp_install/ndiswrapper-1.56/driver/iw_ndis.c:1971: warning: initialization from incompatible pointer type
make[3]: *** [/temp_install/ndiswrapper-1.56/driver/iw_ndis.o] Error 1
make[2]: *** [_module_/temp_install/ndiswrapper-1.56/driver] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.38'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/temp_install/ndiswrapper-1.56/driver'
make: *** [all] Error 2
It seems there have been some changes to some structs in the kernel which ndiswrapper does not take account for.