Bug 247545 - add Tenda W311Ma (Chipset mt7601u) Ralink support
Summary: add Tenda W311Ma (Chipset mt7601u) Ralink support
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.0-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-25 18:45 UTC by Mc James
Modified: 2024-01-19 16:17 UTC (History)
7 users (show)

See Also:


Attachments
windows driver INF file (829.54 KB, text/plain)
2020-07-01 21:23 UTC, Mc James
no flags Details
MT7601U lsusb -v output (4.91 KB, text/plain)
2020-10-12 09:39 UTC, mailto1979@rediffmail.com
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mc James 2020-06-25 18:45:23 UTC
today after a failed  attempt here https://forums.freebsd.org/threads/tp-link-tl-wn823n-v2-device-not-showing-up.75923/ 
I went and bought a "tenda w311ma" which in freebsd froum was suggested and praised. but It is not working.

dmesg :

 ugen7.2: <MediaTek 802.11 n WLAN> at usbus7

this device is supposed to be Ralink RT5370 which I can't figure out what t is what I have.
do we have any support for this?
ugen7.2: <MediaTek 802.11 n WLAN> at usbus7, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (160mA)
Comment 1 Mc James 2020-06-25 18:47:30 UTC
/boot/loader.conf >> 
if_run_load="YES"
runfw_load="YES"
if_ral_load="YES"
if_ural_load="YES"
if_rum_load="YES"
if_ral_load="YES"
and I can't to make it work

it is the exact picture of the device:
https://www.aliexpress.com/i/32692482931.html
Comment 2 Mc James 2020-06-26 15:53:21 UTC
the MT7601U is <<Chipset Ralink RT5370>> just a rebrand name.
and RT5370 is supported under freebsd for sometimenow. So if the devs do a bit of adjustment it will work.
Comment 3 vidwer+fbsdbugs 2020-06-26 16:10:50 UTC
(In reply to Mc James from comment #2)

What's the device ID? See https://github.com/freebsd/freebsd/blob/master/sys/dev/usb/usbdevs#L3947
You can retrieve this using the 'usbconfig' tool.

I could provide a patch, which ideally would land in -CURRENT so you will have to patch and recompile things manually.
Comment 4 vidwer+fbsdbugs 2020-06-26 16:13:03 UTC
(In reply to vidwer+fbsdbugs from comment #3)

https://github.com/freebsd/freebsd/search?q=rt5370&unscoped_q=rt5370
Comment 5 Mc James 2020-06-26 22:35:33 UTC
hello;
In debian this is what I have:
lsusb:
Bus 004 Device 004: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter
dmesg:
[   12.545023] mt7601u 4-3:1.0: ASIC revision: 76010001 MAC revision: 76010500
[   12.579310] mt7601u 4-3:1.0: firmware: direct-loading firmware mt7601u.bin
[   12.580842] mt7601u 4-3:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____
[   12.992777] mt7601u 4-3:1.0: EEPROM ver:0d fae:00
[   13.250784] usbcore: registered new interface driver mt7601u
[   13.259271] mt7601u 4-3:1.0 wlx502b73e93f56: renamed from wlan0

usbconfig freebsd 12.1 amd 64 : 
ugen7.2: <MediaTek 802.11 n WLAN> at usbus7, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON


https://lists.freebsd.org/pipermail/freebsd-drivers/2020-June/002289.html
Comment 7 Mc James 2020-06-26 22:39:30 UTC
(In reply to Mc James from comment #6)
https://www.tendacn.com/en/download/detail-2515.html
Comment 8 Mc James 2020-06-26 22:41:40 UTC
In windows

Ralink Technology, Corp. MT7601U Wireless Adapter USB\VID_148f&PID_7601
Comment 9 Mc James 2020-07-01 21:18:26 UTC
I installed a windows XP in virtualbox. I went to install the drivers and the driver that worked in XP is rt2870. that is contradictory from what I see on the web.
I tried to ndisgen the driver, although the process was successful the driver will cause kernel crash after load.
I'll attach the windows file here.
BUT it changes nothing cause [[[[ rt2870 ]]]] is also supported from 2009 ....
Comment 10 Mc James 2020-07-01 21:23:39 UTC
Created attachment 216118 [details]
windows driver INF file
Comment 11 Mc James 2020-07-02 01:00:14 UTC
windows driver INF file

https://gofile.io/d/K8q1tG
Comment 12 mailto1979@rediffmail.com 2020-10-12 09:39:53 UTC
Created attachment 218685 [details]
MT7601U lsusb -v output

This is the output of #lsusb -v with MT7601U specific parts.
Comment 13 mailto1979@rediffmail.com 2020-10-12 09:40:27 UTC
I have also a cheap Terrabytes MT7601U wireless usb adapter. It works very well in Devuan and Ubuntu Linux distributions since long. In FreeBSD-12.1, no wireless devices found. Only em0 and lo0 loopback are found. Please help us getting this WiFi adapter work. It's really common in many countries.
usbconfig shows:
ugen0.3: <MediaTek 802.11 n WLAN> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (160mA)

dmesg:
ugen0.3: <MediaTek 802.11 n WLAN> at usbus0

I am not really technical. Wonder if the driver sources provided by MediaTek will serve us to get this adapter supported in FreeBSD:
https://github.com/wellfrogliu/Synology-MT7601u
@vidwer+fbsdbugs@gmail.com

Attached is the output of lsusb -v from FreeBSD-12.1
Comment 14 mailto1979@rediffmail.com 2020-10-12 21:45:56 UTC
This is the output of pciconf -lv:

pcib2@pci0:1:0:0:	class=0x060401 card=0x20038086 chip=0x88921283 rev=0x30 hdr=0x01
    vendor     = 'Integrated Technology Express, Inc.'
    device     = 'IT8892E PCIe to PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
Comment 15 Thais Laos 2023-01-30 21:00:32 UTC
/boot/loader.conf >> 
if_run_load="YES"
runfw_load="YES"
if_ral_load="YES"
if_ural_load="YES"
if_rum_load="YES"
if_ral_load="YES"
and I can't to make it work https://hentaila.tv/
Comment 16 Brasuka 2023-07-23 00:40:56 UTC
/boot/loader.conf >>
if_run_load="SIM"
runfw_load="SIM"
if_ral_load="SIM"
if_ural_load="SIM"
if_rum_load="SIM"
if_ral_load="SIM"
e não consigo fazer funcionar
<a href="desenhohentai.com">desenho Hentai</a>
Comment 17 Brasuka 2023-07-23 00:43:15 UTC
boot/loader.conf >>
if_run_load="SIM"
runfw_load="SIM"
if_ral_load="SIM"
if_ural_load="SIM"
if_rum_load="SIM"
if_ral_load="SIM"
e não consigo fazer funcionar
<a href="desenhohentai.com">desenho Hentai</a>
Comment 18 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2023-08-11 12:56:08 UTC
Since OpenBSD got support working for mt7601U, I started porting the OpenBSD work. I have locally association to open networks working, but i cannot ping.
My work will be found here[1], but is currently outdated and useless. I will push a commit when the code is more clean. 

[1] https://github.com/jsm222/mt7601u
Comment 19 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-08-11 13:19:10 UTC
mt7601u is a fully GPL-2.0 only driver in Linux.  I wonder based on what OpenBSD wrote the driver then...
Comment 20 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2023-08-11 13:36:58 UTC
(In reply to Bjoern A. Zeeb from comment #19)
https://bsd.network/@stsp/1074802421530630
I think more or less from their ralink work https://marc.info/?l=openbsd-cvs&m=164000871323401&w=2. I am diffing the two a lot, they are quite the same. Anyway they released under permissive license so we can use the code. The firmware blobs might be licensed somehow though but they are public downloadable. for instance here https://anduin.linuxfromscratch.org/BLFS/linux-firmware/mediatek/
Comment 21 Kevin Lo freebsd_committer freebsd_triage 2023-08-11 14:32:36 UTC
(In reply to Bjoern A. Zeeb from comment #19)
Written based on the vendor driver 
https://www.mediatek.tw/products/broadband-wifi/mt7601u
Comment 22 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2023-08-11 18:29:48 UTC
My latest code it is a little messy still but now on [1], it connects to open networks and can send and receive traffic.


Expect crashes Works with open networks. Only version 7601 is covered now (there is also a 7612 and 7610 not working) I did not include the code for the others yet (I do not own the specific hardware).

[1] https://github.com/jsm222/mt7601u/
Comment 23 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-08-11 20:40:46 UTC
(In reply to Kevin Lo from comment #21)

Cool.  Thanks for the link!  So only the firmware is left but given the idea is to move them mostly to ports anyway and use fwget in the future that's less of a trouble.  If this goes to Phabricator, please add #wireless.
Comment 24 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2023-08-15 20:01:10 UTC
Some more progress I can authenticate to secured networks and get traffic from non qos/wmm enabled APs but not those with qos. I am looking into the why of that.. The code is not on github yet.
Comment 25 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2023-08-17 22:06:18 UTC
New GH code at https://github.com/jsm222/mt7601u.

 Authentication stability and traffic improvements.

 * wme is disabled (qos is disabled)
 * does not crash on every detach
 * wpa2 personal is tested does not work with tkip on
   linksys wrt54gl only aes.
 * Chooses a higher rate but only on assoc which is
   of course wrong
 * n is not enabled only b and g.
Comment 26 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2023-08-20 17:11:45 UTC
New GH update[1], it works for me(TM) now.
Still without WME and 11n since OpenBSD do not have that in their work.

 force_short_xfer=1 for TX_BE seems to give me device timeouts

 so set it to off.
 various improvements to detach crashes
 checks revision for current suppport state e.g 0x7601
 Still crashes can occur when detached while ongoing traffic.
[1] https://github.com/jsm222/mt7601u/commit/ef87e0624e2d6c5250287adc538925dcb0e51ae5
Bye.
Comment 27 ali khanoma 2023-08-25 09:38:51 UTC
MARKED AS SPAM
Comment 28 ali khanoma 2023-08-25 09:40:03 UTC
MARKED AS SPAM
Comment 29 Mark Linimon freebsd_committer freebsd_triage 2024-01-19 16:17:15 UTC
^Triage: note that the github patch has been tested on currently supported releases.