PINE64
WiFi dongle MediaTek mt7601u - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Linux on Pine A64(+) (https://forum.pine64.org/forumdisplay.php?fid=6)
+--- Thread: WiFi dongle MediaTek mt7601u (/showthread.php?tid=1626)

Pages: 1 2


WiFi dongle MediaTek mt7601u - Beta_Ravener - 07-03-2016

I have bought a cheap WiFi dongle from ebay, it costs about $2 and looks like this:
[Image: s-l1600.jpg]
As it has no branding or whatsoever, I have run following to identify it (only relevant output is copied):

Code:
> sudo lshw
*-usb:3 UNCLAIMED
 description: Generic USB device
 product: 802.11 n WLAN
 vednor: MediaTek
 physical id: 4
 bus info: usb@1:1.4
 version: 0.00
 serial: 1.0
 capabilities: usb-2.01
 configuration: maxpower=160ma speed=480Mbit/s

>sudo lsusb
Bus 001 Device 006: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter

However, the device doesn't seem to be working 'out of box', as `ifconfig` does not show any wlan interface.
I have tried googling around and found basically 4 options:
1. Building kuba-moo, however this requires kernel 3.19+, while we seem to be at 3.10. Building the code anyway would result in errors as will be shown below in log file regarding unknown struct fields.

2. Downloading original code and patch as suggested here by user289087 and building it (the original code is from mediatek website as the original link in post is dead). Same errors as 1., although now it should not be only for 3.19+ so I'm wondering if the cause is not different.

3. Downloading binary directly and placing it in /lib/firmware (inside that archive it's mcu/bin/MT7601.bin, the archive is the same as in second option). However, I'm not sure about kernel version for which this was built and placing it there does not seem to do anything yet. Is there anything else that needs to be done?
I have found this github issue which references the binary and suggests that the device may need to be enabled in kernel source?

4. Installation through PPA as noted here by Eric Carvalho:
Code:
sudo apt-add-repository ppa:thopiekar/mt7601
sudo apt-get update
sudo apt-get install mt7601-sta-dkms
This fails the same way as 1. and 2. with errors:
Code:
Synaptic output:
Error! Bad return status for module build on kernel: 3.10.102-0-pine64-longsleep (arm64)
Consult /var/lib/dkms/mt7601/3.0.0.4/build/make.log for more information.

The log file is finally linked here and errors are only at the end of file (rest of it is the same warning again and again).


I think there might be something wrong with how I obtained sources as 3 of those options end up in the same error:
1. I have updated kernel to newest version (3.10.102-0-pine64-longsleep) using script
2. Git cloned longsleep's repository (which I checked was the code for the same version of kernel as `uname -r`reports)
3. Run `make menuconfig` (left everything default and saved .config) and `make prepare`
4. Created symbolic link from /lib/modules/3.10.102-0-pine64-longsleep/build to the directory with source code (all the make files I've seen for this driver use this path, only substituting the kernel version with `uname -r` command)

Is there something wrong with this procedure?

Any help in solving this is greatly appreciated.

Edit1: Some more info about supporting this dongle on RPi can be found here.


RE: WiFi dongle MediaTek mt7601u - longsleep - 07-03-2016

Your dkms package seems to lack proper patching for kernel 3.10


RE: WiFi dongle MediaTek mt7601u - Beta_Ravener - 07-03-2016

(07-03-2016, 09:08 AM)longsleep Wrote: Your dkms package seems to lack proper patching for kernel 3.10

Which essentially, I suppose, means that there is no support for this device for the current version of kernel? Or is there something else that can be done considering the other options? From the ask-ubuntu page it seems there was once this project for older kernels but it seems discontinued or the owner just deleted it.


RE: WiFi dongle MediaTek mt7601u - Beta_Ravener - 07-03-2016

I have come closer to building the driver for this device, in fact actually built it by fixing sources a little. I also had to enable loadable module support in `make menuconfig` which was disabled by default and preventing me from generating .ko files.

However, I now have `mt7601Usta.ko` file, which I should load using `insmod`. This fails with "Invalid module format". I'm quite puzzled as this is second module I've built and has such problem (I'm also trying to build another dongle driver in parallel and use the one I first succeed)..

I think the problem is in kernel / headers mismatch. `modinfo` on the mentioned file shows "vermagic: 3.10.102-dirty aarch64". While I have no experience whatsoever building modules (I'm just poor software engineer mostly battling in higher spheres), this doesn't look right compared to what `uname -r` shows. Am I doing something wrong? And would it be possible, by any chance, to simply provide the headers required for these module builds through PPA as usual so that no-one has to go through the hassle of configuring kernel? If this is already possible I'm sorry and could you possibly help me how to get them?


RE: WiFi dongle MediaTek mt7601u - longsleep - 07-04-2016

That's why you have the dkms Module - it does that all for you.


RE: WiFi dongle MediaTek mt7601u - Beta_Ravener - 07-04-2016

(07-04-2016, 12:47 AM)longsleep Wrote: That's why you have the dkms Module - it does that all for you.

But if I understand correctly, dkms still uses sources I have cloned from your repository (and symbolically linked them to a place where dkms will search for them). Also I had to edit those sources for mt7601 to get them to compile. I can't do that in dkms...

Still, I might be wrong about the causation why insmod fails. By all means you did great work getting everything to work and I'm just trying to contribute a little.

And I have just found another github repo of yours whit some script to building the kernel headers and stuff that might be really helpful, so I'll give them a try now and report back.


RE: WiFi dongle MediaTek mt7601u - longsleep - 07-04-2016

If you clone sources then you need to build a complete kernel unless you have set up out of tree compile properly.

The current kernel package has everything in place for that out of the box to let dkms work. That is why you came so far as you did with the log you posted.

The right way would be to fix the dkms package and upload it to launchpad once it works.


RE: WiFi dongle MediaTek mt7601u - Beta_Ravener - 07-04-2016

(07-04-2016, 07:38 AM)longsleep Wrote: If you clone sources then you need to build a complete kernel unless you have set up out of tree compile properly.

The current kernel package has everything in place for that out of the box to let dkms work. That is why you came so far as you did with the log you posted.

The right way would be to fix the dkms package and upload it to launchpad once it works.

Thank you for your help so far.

In the meantime I have followed instructions on building kernel and I had success with getting the original dkms to compile and install. The problem was either working with wrong git branch (I don't know which one is default on kernel source, but the instructions on build are cloning specific one) or what is more plausible that the instructions also include proper kernel configuration (sun50iw1p1smp_linux_defconfig). After successfully configuring and building the kernel and symbolically linking /lib/modules/3.10..../build to these kernel sources, the dkms installation was success without any errors.

However, even after reboot the dongle is still not working, so I'm currently investigating further. I was also able to build sources I got from github for this device so hopefully one way or another I will be able to get this working and report back.


RE: WiFi dongle MediaTek mt7601u - Beta_Ravener - 07-04-2016

Well, the module loads (confirmed by `lsmod`) but that's it. There is no wlan interface (or actually "ra0" as mentioned here). I have followed instructions in that guide, editing the interface and wpa_supplicant files, but this fails to show interface (`ifconfig -a` and `iwconfig` doesn't show anything wireless). Also `ifup ra0` fails with error that "/sbin/wpa_supplicant daemon failed to start".

Is this still module/driver related or is it networking problem now? While the `lsmod` shows the module loaded, the value in "used by" column
is 0. Might this be an indication of a problem?


RE: WiFi dongle MediaTek mt7601u - xalius - 07-04-2016

Hi, can you paste the output of 'dmesg' after you loaded the module? Did you have to supply a firmware image for the stick to load on module insertion?