Wednesday, March 2, 2016

Installing Tenda W522U in Linux Mint

Installing this in Linux was not straightforward. FYI, if you haven't bought your Wifi adapter yet, check the internet and find something that folks recommend.

I'll go through all what I did. It may be random (really it was more a historical record for whatever clue it may give) than a reasoned one...

In my case, checking Networking in the System Settings or clicking on the connectivity icon in the status bar actually shows my access point SSID, which makes me think that it actually works. ifconfig was showing it too. Nevertheless, I can't connect. It tries but fails...

Although for a different chipset (RT3572 instead of RT3572), this is a good forum post. Or is it 5572? That is what I got compiling... Checking for that info, looks like 3572 and 5572 may be the same (or one a superset of the other).

Some useful commands:
  1. ifconfig
  2. lsusb list all what is connected to the USB ports.
    Bus 002 Device 002: ID 8087:8002 Intel Corp.
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 8087:800a Intel Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 011: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
    Bus 003 Device 010: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
    Bus 003 Device 009: ID 058f:6254 Alcor Micro Corp. USB Hub
    Bus 003 Device 002: ID 093a:2468 Pixart Imaging, Inc. SoC PC-Camera
    Bus 003 Device 013: ID 148f:3572 Ralink Technology, Corp. RT3572 Wireless Adapter
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  3. modprobe -c | grep 3572 not sure for what it is. It will list something like this:
    alias usb:v148Fp3572d*dc*dsc*dp*ic*isc*ip*in* rt2800usb
    alias usb:v8516p3572d*dc*dsc*dp*ic*isc*ip*in* rt2800usb
    but if we do something similar (modprobe -c | grep 5372) for a different chipset we get:
    alias pci:v00001106d00005372sv*sd*bc*sc*i* sata_via
    alias spi:ad5372 ad5360
    alias usb:v148Fp5372d*dc*dsc*dp*ic*isc*ip*in* rt2800usb
    alias usb:v5372p2303d*dc*dsc*dp*ic*isc*ip*in* pl2303
    So, both show up...
  4. lsmod | grep rt2800usb
    rt2800usb 27034  0
    rt2x00usb 20742  1 rt2800usb
    rt2800lib 89076  1 rt2800usb
    rt2x00lib 55307  3 rt2x00usb,rt2800lib,rt2800usb
It seems like the rt2800 should work but it doesn't (properly) so:
$sudo pico /etc/modprobe.d/blacklist.conf

add the following lines:
blacklist rt2x00usb
blacklist rt2x00lib
blacklist rt2800usb
close and save.

$sudo rmmod rt2x00usb (just in case)
$sudo rmmod rt2x00lib (just in case)
$sudo rmmod rt2800usb (just in case)

Now lsmod won't show the rt2x... and my wireless stop working completely...
lsusb still shows it.


Went to Tenda's website and dowloaded their linux driver. That is basically the pure source, so, once untar, followed the instructions in the readme. Basically:
  1. Add the 2 "y" instead of "n" to config.mk (all the other stuff was done already). 
  2. Also had to patch the rt_linux as described here and here (make wasn't working). To apply the patch all what we did was to copy it in the directory where the file we want to patch (rt_linux.h) is (/include/os) and apply patch < rt_linux.h.patch as described here
  3. Then did the make and worked. Generated rt5572sta.o
  4. Do make install
  5. modprobe rt5572sta . This will not work if the install wasn't done. Also, remember that some of these need su privileges.
  6. Notice that if we do modprobe -c | grep rt5 we can get a long list of alias with one line that says:
    alias usb:v148Fp3572d*dc*dsc*dp*ic*isc*ip*in* rt5572sta
    where the highlighted in red is the same we get with the lsusb. I.e., it seems that is saying that for that adapter the rt5572 is the right file.
  7. lsmod will list now the rt5572sta. By the way, if we want to remove it we can use rmmod rt5572sta (or modprobe -r rt5572sta)
  8. ifconfig now is very slow but eventually returns without showing the wireless interface.
  9. I rebooted as the whole thing was dying out... Now with lsusb we can't see the adapter. I guess that is related to the fact that we hide the rt2800usb and has not found the other. lsmod does not see the driver either but we do #5 and now is visible. Still not in lsusb. ifconfig returns also fast but without the adapter.
  10. I unplugged and plug the adapter and sure enough, it shows up in lsusb.
  11. Then it shows up with ifconfig -a
  12. So, now we can even see it in our wireless window (with SSID...) but still never manages to connect to router (like what was happening when using the rt2800...). We can see the LED light up, but nothing...
  13. Also doing lsmod shows cfg80211 which I am not sure was there before...
  14. iwlist scan does show my network with details on encryption type... 
  15. So, we started messing with the NetworkManager.conf file, making ifupdown managed, and somehow that made the service stop after reboot... Then we made managed "false", restart the service (service network-manager restart) and it came back, not only it, but also the wireless!!! Now is connected although I still can not surf the network through wireless ?!? I have no clue what I have done but at least got one step further... Note: eventually, this stopped working but it does work without security or just WEP. So, that points to the WPA... No time to debug now...
  16. Internal ping (192.168.0.1) works but not ping to Google (8.8.8.8)  
  17. Finally got it... I had my router blocking connections by MAC addresses. (0o)". I know... My doubt is at what point some of the errors above where coming from this. Still, I thought I would leave all as is, for anybody's reference...
Notes:
  1. Found this http://ubuntuforums.org/showthread.php?t=1285828
  2. How to see  your IP, change it and few more useful solutions at http://whatismyipaddress.com/
  3. A lot of info on the topic of setting and controlling the network adapter.  

No comments:

Post a Comment