Ralink Tech MT7601U Wireless Adapter on Xubuntu

I've found the solution (and it is not the one suggested by the message that appeared to me ten times to which I replied no, other ten times.. maybe I have overrated the community..).

I think this solution will work with Debian/Ubuntu/Xubuntu/Lubuntu (and similar) with Kernel version up to 4.4.x.y

Reading the README.md find inside the minidisc provided with the Adapter box I find out an unofficial driver here

According to the driver these USB devices are supported:

2955:1003
2955:1001
2955:0001
2A5F:1000
148F:760B
148F:7601
148F:6370
148F:7650 

You can verify if driver it's suitable for your device by plugging in the adapter and launching lsusb

Now, to download and install the driver, follow these steps:

sudo add-apt-repository ppa:thopiekar/mt7601
sudo apt-get update
sudo apt-get install mt7601-sta-dkms

Install will end with some error incompatible-pointer-types and incompatible argument passed to a function.

Than the Adapter still not works, to workaround I have follow these steps:

1) Check your Kernel Version by launching uname --kernel-release

2) Download corresponding kernel source from Kernel Archive -> you will see a unordered list of Kernel Version -> click on corresponding version (Example: if you have 5.0.0-23-generic click v5.x/) -> from the next page search for the file linux-5.0.tar.xz -> download it

3) From archive unpack just folder drivers/net/wireless/mediatek/mt7601u

4) Find and Edit file phy.c. Find function mt7601u_init_cal (row 1116) and comment out call mt7601u_mcu_calibrate(dev, MCU_CAL_RXIQ, 0); (line from 1156 to 1161) as follows:

// ret = mt7601u_mcu_calibrate(dev, MCU_CAL_RXIQ, 0); 
// if (ret) 
// return ret;
// ret = mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->dpd_temp); 
// if (ret) 
// return ret;

5) Find function mt7601u_phy_recalibrate_after_assoc (row 587) and comment out call mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->curr_temp); (row 589) as follows:

void mt7601u_phy_recalibrate_after_assoc(struct mt7601u_dev *dev)
{ 
// mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->curr_temp);
   mt7601u_rxdc_cal(dev); 
}

6) Open a terminal and go to mt7601u folder path

7) Build module by tiping:

make -C /lib/modules/$(uname -r)/build M=$(pwd) modules

8) If the Adapter is plugged in remove it and (from the same path) type:

sudo su
rmmod mt7601u (can output "module not loaded". if yes, ignore it and continue)
insmod ./mt7601u.ko

9) Insert device

10) Now Adapter should works but If you restart the pc you have to reload module again. Than to make change persistent till next kernel upgrade: backup original module and replace with compiled. To find out where is original module run modinfo mt7601u (view string filename: /lib/modules/_KERNEL_VERSION_/kernel/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko).

10.1) If after reboot the Adapter is not recognized you have to follow these steps:

cd /etc/modprobe.d
ls
  • If you find a file named blacklist-mt7601u.conf remove it.

Then type nano /etc/modules and write a single line with module name mt7601u (without .ko)

reboot the system. Enjoy.

Hope helps... to solve the problem and to learn how to write a usefull problem solution..