# MediaTek MT7601U not working

## Sllyth

i have a usb wifi adapter, "lsusb" shows:

```

Bus 001 Device 005: ID 2717:4106 Xiaomi Inc. MediaTek MT7601U [MI WiFi]

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 002: ID 8087:0a2b Intel Corp. 

Bus 001 Device 003: ID 04f2:b59a Chicony Electronics Co., Ltd 

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

```

so i choose in kernel:

```

Device Drivers --->

  [*] Network device support --->

    [*] wireless lan --->

      [*] MediaTek devices --->

        <M> MediaTek MT7601U (USB) support

```

after rebooting, "ifconfig" shows:

```

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 624  bytes 51872 (50.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 624  bytes 51872 (50.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp0s20f0u2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether f0:b4:29:37:3c:be  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.188  netmask 255.255.254.0  broadcast 192.168.1.255

        inet6 fe80::53b5:6bc2:1298:aa19  prefixlen 64  scopeid 0x20<link>

        ether a0:c5:89:17:aa:98  txqueuelen 1000  (Ethernet)

        RX packets 17483  bytes 9033383 (8.6 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 12240  bytes 2089491 (1.9 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

but when i run "wpa_supplicant -i wlp0s20f0u2 -B -c /etc/wpa_supplicant/wpa_supplicant.conf", it can not connect to internet

"lsmod" shows:

```

Module                  Size  Used by

mt7601u               110592  0

iwlmvm                331776  0

btusb                  49152  0

btrtl                  16384  1 btusb

btbcm                  16384  1 btusb

btintel                20480  1 btusb

bluetooth             421888  5 btrtl,btintel,btbcm,btusb

x86_pkg_temp_thermal    16384  0

iwlwifi               278528  1 iwlmvm

ecdh_generic           24576  1 bluetooth

efivarfs               16384  1

```

that means "mt7601u" did not work ? i found in kernel:

```

Device Drivers --->

  [*] network device support --->

    <*> USB Network Adapters --->

```

should i choose some options in that?

what can i do to get my usb wifi working?

----------

## fturco

According to https://github.com/kuba-moo/mt7601u you need to install a firmware.

What's the output of:

```
dmesg | grep mt7601u
```

?

----------

## Sllyth

fturco, thank you for replying!

"dmesg | grep mt7601u" shows, 

```

[ 1493.297106] mt7601u 1-2:1.0: ASIC revision: 76010001 MAC revision: 76010500

[ 1493.301016] mt7601u 1-2:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____

[ 1493.663695] mt7601u 1-2:1.0: EEPROM ver:0d fae:00

[ 1493.663902] mt7601u 1-2:1.0: EEPROM country region 01 (channels 1-13)

[ 1493.860550] usbcore: registered new interface driver mt7601u

[ 1493.863585] mt7601u 1-2:1.0 wlp0s20f0u2: renamed from wlan0

```

tomorrow i will try the code from github, hope it's usefull

----------

## NeddySeagoon

Sllyth,

So far there is nothing wrong but it appears that your Wifi has not started.

After you have tried to start Wifi, please put all of dmesg onto a pastebin site.

----------

## Sllyth

NeddySeagoon, thanks for replying. 

here is pastebin, https://pastebin.com/in2dwpmN

----------

## fturco

As far as I remember, running wpa_supplicant is not enough for connecting to the internet. You also probably need to get an IP address with DHCP in some way...

----------

## NeddySeagoon

Sllyth,

dmesg shows that there has been no attempt to start your WiFi.

```
[  245.504036] IPv6: ADDRCONF(NETDEV_UP): wlp0s20f0u2: link is not ready
```

There are no authenticating or associated entries.

Getting Wifi running is a two step process. The first step is authenticating and associated with the Access Point.

Once that's done, the ordinary tools used with wired network work to establish the network setup.

Its unusual to try to do in all with wpa_supplicant, or even run wpa_supplicant with a command, except for debugging.

It more usual to use a tool that does it all, including running wpa_supplicant.

There are no errors, what you have done so far is correct, you just haven't done all the steps yet. 

Maybe this Wiki page helps?

----------

## Sllyth

NeddySeagoon, i now know there are two steps. but i still not know how to finish the first step.

should i use some tools to authenticate  the access point?

fturco, i think you are right. maybe what you said is the same thing that NeddySeagoon said. so i need to use dhcpcd to get ip?

For another adapter in my laptop, i only use dhcpcd and wpa_supplicant to connect to internet, dhcpcd even not be configured by myself, i just emerge it...

----------

## NeddySeagoon

Sllyth,

There are several ways to manage your network interfaces in Gentoo.

Which one do you intend to use?

That it is a two step process will be invisible once you choose and configure the tool you want to use.

You must choose at most, one, as the various tools are unaware of each other and with two or more running, none can get control of the interface.

----------

## Sllyth

i saw the wiki "Network management" (https://wiki.gentoo.org/wiki/Network_management#Available_software) , it mentions dhcpcd. and i emerge dhcpcd in my laptop, so is that possible to  use it to authenticate the network interface? for the wifi adapter in my laptop, i did not configure dhcpcd, it works after emerge. therefore i thought if i run wpa_supplicant, it can connect to internet....  :Embarassed: 

----------

## fturco

For testing purposes, you can simply run:

```
dhcpcd wlp0s20f0u2
```

There are several wiki articles about dhcpcd:

https://wiki.gentoo.org/wiki/Network_management_using_DHCPCD

https://wiki.gentoo.org/wiki/Dhcpcd

----------

## Sllyth

```
rc-update del wpa_supplicant
```

then reboot, two interfaces are not authenticated

if i run 

```
wpa_supplicant -i wlp1s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
```

the interface in my laptop will be authenticated

but if i run

```
wpa_supplicant -i wlp0s20f0u2 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
```

the usb interface will not be authenticated

although both outputs are

```
Successfully initialized wpa_supplicant
```

So, maybe my usb interface is damaged...

----------

