Page MenuHomeFreeBSD

mt7601U
Needs ReviewPublic

Authored by jsm on Mon, May 13, 4:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 20, 2:29 AM
Unknown Object (File)
Mon, May 20, 2:00 AM
Unknown Object (File)
Sun, May 19, 9:50 PM
Unknown Object (File)
Sun, May 19, 5:55 PM
Unknown Object (File)
Fri, May 17, 2:25 AM
Unknown Object (File)
Thu, May 16, 9:38 AM
Unknown Object (File)
Wed, May 15, 5:36 PM
Subscribers

Details

Reviewers
None
Group Reviewers
wireless
Summary

Importing if_mtw from OpenBSD

Test Plan

local manual testing

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jsm requested review of this revision.Mon, May 13, 4:44 PM

Also add mtw to /usr/src/sbin/devd/devd.conf it escaped my diff.. The firmware port is at https://people.freebsd.org/~jsm/mt7601u-firmware-kmod.tar.gz (It should have the license file set just for ref for now)

oh, interesting! does 11n work on this driver in openbsd? I see some 11n stuff is commented out here.

I'll add the back reference to the PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247545

And leave my comment here: based on the comments there this driver was written based on GPL-only sources (at least I could not find anything else). For whatever that means I do not know.

share/man/man4/mtw.4
3

Are we sure that is correct?

39

There's a lot of blank lines everywhere...

79

"based on"?

sys/modules/usb/mtw/Makefile
1

Normally we do not add this to Makefiles but if you do can you add the SPDX tag in the first line so it matches the teemplate in /usr/share/examples/etc/bsd-copyright (typed from the top of my head)?

I haven't had time to look at the code, but tested on my Xiaomi mini USB WiFi:

mtw0 on uhub1
mtw0: <MediaTek MI WLAN Adapter, class 0/0, rev 2.01/0.00, addr 3> on usbus0
mtw0: version:0x7601
mtw0: loaded firmware ver 30272.256
mtw0: timeout waiting for MCU to initialize
mtw0: /usr/src/sys/dev/usb/wlan/if_mtw.c:3000 USB_ERR_CANCELLED
device_attach: mtw0 attach returned 6

Unfortunately it doesn't work.

My /boot/loader.conf:
mt7601u_fw_load="YES"
if_mtw_load="YES"

I haven't had time to look at the code, but tested on my Xiaomi mini USB WiFi:

mtw0 on uhub1
mtw0: <MediaTek MI WLAN Adapter, class 0/0, rev 2.01/0.00, addr 3> on usbus0
mtw0: version:0x7601
mtw0: loaded firmware ver 30272.256
mtw0: timeout waiting for MCU to initialize
mtw0: /usr/src/sys/dev/usb/wlan/if_mtw.c:3000 USB_ERR_CANCELLED
device_attach: mtw0 attach returned 6

Unfortunately it doesn't work.

My /boot/loader.conf:
mt7601u_fw_load="YES"
if_mtw_load="YES"

Thanks for testing. I did not manage to get hold of any other devices than a noname one where I never got usb err canceled loading firmware.
. . Is it consistent when unplugging/replugging the device. Can you perhaps post a usbconfig dump and a usbdump. Thanks.

sys/dev/usb/wlan/if_mtw.c
140

This list is too short.

Here's one to add:

ugen0.2: <MediaTek Edimax Wi-Fi> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (160mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0201 
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x7392 
  idProduct = 0x7710 
  bcdDevice = 0x0000 
  iManufacturer = 0x0001  <MediaTek>
  iProduct = 0x0002  <Edimax Wi-Fi>
  iSerialNumber = 0x0003  <1.0>
  bNumConfigurations = 0x0001
146

If you need to do "eject" handling; we added a USB Quirk for that a while ago (I think for a Zyxel) which also has firmware "on board" and shows up as cd0 first and only when that was ejected the wifi device would show up. Found it 9d2d04462d1080f4a4b84f674de90a895ce1bcc1 . Hope that helps.

sys/modules/usb/Makefile
48

There's a blank at the end of the line (now).