WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Problem connecting to WiFi via a Mediatek USB Dongle  (Read 3574 times)

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Problem connecting to WiFi via a Mediatek USB Dongle
« on: March 04, 2022, 10:59:49 AM »
Hi,
I have been trying to connect a Model B pi using a Mediatek dongle based on the MT7601u chip.
I based my setup on information from this https://climberg.de/post/tiny_linux_for_raspberry_pi since I could not find complete details on this forum. Unfortunately this did not work but after installing a couple of other tcz extensions I have managed to get to the stage were sudo wifi.sh comes up with a list of possible networks to connect to but when I duly inserting the correct wireless key the software is unable to confirm the connection.

I am communicating with the board via a headless connection through eth0 to the same modem.

Regards
xuraax

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #1 on: March 04, 2022, 12:01:03 PM »
Hi, xuraax. For that dongle to work you need to load two extensions: wireless-KERNEL.tcz and firmware-mediatek.tcz (the first contains the necessary driver, the second contains the necessary firmware). wifi.sh should work after that.

If you'd like to try an alternative to wifi.sh, feel free to try my autowifi script, which is available here: https://gitlab.com/GNUser/autowifi
Note that to use the script you need to load two additional extensions: iw.tcz and eiwd.tcz
« Last Edit: March 04, 2022, 12:02:43 PM by GNUser »

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #2 on: March 04, 2022, 12:10:45 PM »
Have seeing this before and when it was some ssid password with some bad special characters.
Check your wifi.db file if it contains the correct ssid and password.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #3 on: March 04, 2022, 12:17:07 PM »
Hi @GNUser

Hi, xuraax. For that dongle to work you need to load two extensions:

Don't think so because @xuraax says:
- wifi.sh comes up with a list of possible networks to connect to

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #4 on: March 04, 2022, 01:19:07 PM »
I confirm what @patrikg said above.

wifi.sh is recognising 6 networks in the vicinity. Also dmesg |grep mt7601u responds with:

[   28.116089] usbcore: registered new interface driver mt7601u.

Where does wifi.db reside?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #5 on: March 04, 2022, 01:33:14 PM »
Hi xuraax
I believe  wifi.db  is in your home directory (/home/tc/wifi.db).

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #6 on: March 04, 2022, 01:59:10 PM »
I am afraid it is not.

the find command did not find it either.
By the way the password just consists of uppercase characters and numbers. Also same issue when i tried to connect to another network with similarly simple password.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #7 on: March 04, 2022, 05:00:16 PM »
You could create the file yourself.
Create a file /home/tc/wifi.db which has the following line in it with the 3 fields tab separated:
Code: (bash) [Select]
Wifi_SSID    Wifi_Password  WPABack it up with:
Code: (bash) [Select]
filetool.sh -bTry to run this command that will take the first line of wifi.db and try to connect with that ssid and password.
Code: (bash) [Select]
sudo wifi.sh -a

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #8 on: March 05, 2022, 01:15:12 AM »
@patrikg,

Thank you for your help.

Unfortunately still no success since ifconfig did not report any connection to wlan0.
However iwconfig reported this:

tc@box:~$ iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11  ESSID:off/any 
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

Does this mean anything to any of you?

Incidentally when I ran: sudo wifi.sh -a
 the program tried to connect directly to the  SSID in the file wifi.db so I guess that is not the issue.

Regards


Offline vinceASPECT

  • Hero Member
  • *****
  • Posts: 808
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #9 on: March 05, 2022, 02:01:16 PM »
Hello F,

Oh  .............massive semiconductor corp   MEdiaTek.

...........perhaps , the doctrines of such enterprises are "abstraction"of
Hardware abstraction Layers" of requiring specific information access
of drivers only "they" supply .........This could  allow global devices to interface
with other semiconductor brands and devices...

Hynix.......and others dominate memory semiconductors.........

The big "A" have their own Hardware semiconductor silicon...........so their angle is
implicit to their corp

.........global PC platforms and MSOFT and main board hardware........that's "Bootstrap Legals" for who's hardware can interface to the IBM architecture PC hardware "through" the  platform (MSOFT)  offer............. that is a legal licensing that the buyer of hardware and their OS signs up to when they interact,

Regards
C
« Last Edit: March 05, 2022, 04:06:05 PM by Rich »

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #10 on: March 12, 2022, 12:56:48 AM »
Hi,

I have finally managed to get my RPI to confirm  a wifi connection with the modem. Here is what I did:

I went back to the original procedure outlined in the website I showed in my first post but instead of doing this:

Code: [Select]
network={
    ssid="<ssid>"
    proto=WPA
    key_mgmt=WPA-PSK
    pairwise=TKIP
    group=TKIP
    psk=<psk>
}

I altered the above to include this:
Code: [Select]

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=<Insert 2 letter ISO 3166-1 country code here>
update_config=1

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}


Of course the proper country code, wireless name and password were duly inserted. At the same time wifi.db was retained.

I am not certain whether the above did the trick or it was just luck but after this, connection was achieved repeatedly.

I hope someone can explain.

Thanks and regards

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14845
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #11 on: March 12, 2022, 01:13:33 AM »
That should be "GROUP=staff" or omitted, no?

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #12 on: March 13, 2022, 08:49:09 AM »
I am afraid my previous update may give the wrong impression of why things worked. Here is why.
Following the successful connection with what, I had hoped, were the changes I made above I tried to replicate the setup for another wifi extender. This time round things did not work.

The first thing I noticed was that the changes I had hoped I had made in the previous post were not there. This is probably due me failing to carry out the proper backup to disk using the filetool.sh command. This is not the first time it has happened to me.

Any changes I tried including the suggestions by @Juanito failed to achieve a successfull connection. udhcpc kept reporting "reason = WRONG_KEY"

Finally it should be noted that reverting back the original contents to the files wifi.db and wpa_configure.conf re established to the connection to the original wifi extender effortlessly.

Thank and regards

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #13 on: March 13, 2022, 04:40:36 PM »
hi  xuraax,

I have a vague memory that normally wpa_supplicant.conf is recreated dynamically from wifi.db each time you boot piCore.

I don't believe country code is required in piCore.

Tiny Core/piCore is not your typical Linux distribution.

regards
Greg

Offline xuraax

  • Newbie
  • *
  • Posts: 37
Re: Problem connecting to WiFi via a Mediatek USB Dongle
« Reply #14 on: March 14, 2022, 12:15:36 PM »
@Greg,
You are correct the country code is not required in piCore. In fact all the 3 lines I inserted later outside this:
Code: [Select]
network={
    ssid="<ssid>"
    proto=WPA
    key_mgmt=WPA-PSK
    pairwise=TKIP
    group=TKIP
    psk=<psk>
}
are not needed at all. Also when I removed the file wifi.db and rebooted piCore still connected to the one wifi extender with which I had success. It seems reasonable to conclude that wifi.db is used solely in conjunction with wifi.sh.

 I then experimented with connecting to 4 different wifi extenders in my possession altering only the above code. I had success with 2 but the other 2 continued to fail. I then investigated the internal setup of each extender and noted that each had a different "Security Mode" setup. The results were as follows:

Extender_1        WPA-PSK                    success
Extender_2        WPA+WPA2 PSK        success
Extender_3        WPA2 Personal           fail
Extender_4        WPA2 PSK                  fail

In Extender_3 I could change the Security Mode setup to "WPA Personal" after which the rpi connected successfully and repeatedly. Unfortunately in Extender_4 which also happens to be my newest and also the main Modem,  you do not get any other security mode than WPA2 so still no joy. Again it seems reasonable to conclude that the differences between WPA and WPA2 are the reasons why I had problems connecting.

The question now comes down to how can one alter the code above to cater for this and why do most other hardware I have, don't have an issue adapting to Security Mode variations while piCore has?

Regards