We don’t have enough LAN sockets at work (part-time job) so I decided to just use WiFi in my desktop there. So I bought a cheap USB Network Adapter for WiFi from CD-R King (150Mbps Wireless-N USB Network Adapter WU-NETA-025(A)-CC).
Unfortunately, Fedora (and it seems other Linux distributions too) don’t have the needed driver for its chipset (MT7601U from Ralink Tech Inc., which seems to be based on RT2870 chipset), so I have to compile it on my own. The package has a CD inside which has the driver for Windows and the source code of the driver for Linux (which you could also get here).
But the driver won’t compile 😮
CC [M] /home/kyoushuu/DPO_MT7601U_LinuxSTA_18.104.22.168_20130913/os/linux/../../os/linux/rt_linux.o ... /home/kyoushuu/DPO_MT7601U_LinuxSTA_22.214.171.124_20130913/os/linux/../../os/linux/rt_linux.c: In function ‘__RtmpOSFSInfoChange’: /home/kyoushuu/DPO_MT7601U_LinuxSTA_126.96.36.199_20130913/os/linux/../../os/linux/rt_linux.c:1121:20: error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’ pOSFSInfo->fsuid = current_fsuid(); ^ /home/kyoushuu/DPO_MT7601U_LinuxSTA_188.8.131.52_20130913/os/linux/../../os/linux/rt_linux.c:1122:20: error: incompatible types when assigning to type ‘int’ from type ‘kgid_t’ pOSFSInfo->fsgid = current_fsgid(); ^ ... make: *** [/home/kyoushuu/DPO_MT7601U_LinuxSTA_184.108.40.206_20130913/os/linux/../../os/linux/rt_linux.o] Error 1 make: *** [_module_/home/kyoushuu/DPO_MT7601U_LinuxSTA_220.127.116.11_20130913/os/linux] Error 2 make: Leaving directory `/usr/src/kernels/3.13.6-200.fc20.x86_64' make: *** [LINUX] Error 2
Seems like it doesn’t support my current kernel which is Linux 3.13.6.
After some searches in Google, I found out that Linux changed some structs around version 3.8. Some fields changed from int to kuid_t and kgid_t. I only changed two lines in a struct, and finally, it compiled :D.
Here’s the patch. And here’s the complete instructions on how to compile it:
$ su -c 'yum install kernel-devel' $ tar xjf ~/DPO_MT7601U_LinuxSTA_18.104.22.168_20130913.tar.bz2 $ cd DPO_MT7601U_LinuxSTA_22.214.171.124_20130913/ $ patch -p0 < ~/rt2870-mt7601Usta-kuid_t-kgid_t.patch $ make
(This assumes that the source tarball and the patch is in your home directory. Change the paths if necessary.)
Install the default settings:
$ su -c 'mkdir -p /etc/Wireless/RT2870STA/' $ su -c 'cp RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.dat'
Then load the driver:
$ su -c '/sbin/insmod os/linux/mt7601Usta.ko'
Insert the WiFi adapter to a USB port. Check if you could connect to a network using the WiFi adapter.
If it works, install the driver:
$ su -c 'make install'
You could also read the file README_STA_usb in the root of the tarball for these instructions, though it says “rt2870sta.ko” instead of “mt7601Usta.ko”.
Note that you have to reinstall the driver when you update your kernel, since we are not using DKMS here. I don’t know how to use that though.