THIS IS COMPLETE BULLSHIT. the rt5370 dongel is just broken.
This weekend I stripped the default raspberry pi linux (weezy) to the bone. Removed all Xorg related stuff. But through some dependency thing I removed a bit to much I think. Because after the setup the wifi stopped working. Specific my RT5370 (I bought for less then 5 euro incl shipping on ebay) stopped working. With messages in /var/log/syslog like:
ioctl[SIOCSIWENCODEEXT]: Invalid argument
and messages like:
raspberrypi ifplugd(wlan0)[2078]: Initialization complete, link beat not detected. raspberrypi wpa_supplicant[1880]: wlan0: CTRL-EVENT-TERMINATING - signal 15 received
Weard thing, my asus n10 (based on some realtec chip) worked fine. After a lot of thinking and tinkering, I installed the package iw. That installed also 2 dependend packages: crda and wireless-regdb. Short: the rt5370 works again. At boot time I also see something that was missing in previous boots: Lines with cfg80211 With mention of "Calling CRDA to update world regulatory domain"
[ 7.709655] cfg80211: Calling CRDA to update world regulatory domain [ 7.918504] cfg80211: World regulatory domain updated: [ 7.933982] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) [ 7.952816] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) [ 7.971097] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm) [ 7.989326] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm) [ 8.007498] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) [ 8.025536] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Let's find out what that CRDA and wireless-regd do (grep some lines from dpkg -l)
ii crda 1.1.2-1 armhf wireless Central Regulatory Domain Agent ii wireless-regdb 2011.04.28-1 all wireless regulatory database
From internet:
Central Regulatory Domain Agent
CRDA acts as the udev helper for communication between the kernel and userspace for regulatory compliance. It relies on nl80211 for communication. CRDA is intended to be run only through udev communication from the kernel. The user should never have to run it manually except if debugging udev issues.
The regulatory database: CRDA requires a regulatory database (Web view or gitweb) to be build and maintained.
[source]
Ok understood. In my rage of destroying all Xorg I destroyed the wireless database. It's not realy needed
And about iw. That is needed for the nl80211 api (whereas iwconfig is needed for wext). Perhaps that's also part of the solution. The rt5370 is a nl80211 device and the asus n10 (realtec) still uses that deprecated wext api.
What package really solved the problem (iw crda or the database) can not be concluded here. Only that 'everything' works after installation of these packages.
Unfortunately, this morning the ioctl[SIOCSIWENCODEEXT]: Invalid argument came back again.