Manually Configuring Wireless Adapter

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
nothing
Posts: 11
Joined: Tue Apr 05, 2022 11:02 pm
Has thanked: 1 time
Been thanked: 2 times

Manually Configuring Wireless Adapter

Unread post by nothing »

Hi I have a combo BT/WF5 device that is not working with the wifi script in the scripts directory.

Says "Failed to bring up wlan0."

-- the device shows up in linux
/root# lsusb
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 006: ID 0bda:c820 Realtek Semiconductor Corp. 802.11ac NIC
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

-- from dmesg
[ 5075.329407] usb 1-1.4: USB disconnect, device number 6
[ 5081.375883] usb 1-1.1: new high-speed USB device number 7 using dwc2
[ 5081.464673] usb 1-1.1: New USB device found, idVendor=0bda, idProduct=1a2b, bcdDevice= 2.00
[ 5081.464694] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5081.464708] usb 1-1.1: Product: DISK
[ 5081.464717] usb 1-1.1: Manufacturer: Realtek
[ 5082.082041] usb 1-1.1: USB disconnect, device number 7
[ 5082.374876] usb 1-1.1: new high-speed USB device number 8 using dwc2
[ 5082.463798] usb 1-1.1: New USB device found, idVendor=0bda, idProduct=c820, bcdDevice= 2.00
[ 5082.463819] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5082.463832] usb 1-1.1: Product: 802.11ac NIC
[ 5082.463842] usb 1-1.1: Manufacturer: Realtek

[ 5082.463888] usb 1-1.1: SerialNumber: 123456

-- wpa_supplicant.conf
/media/fat/Scripts# cat /media/fat/linux/wpa_supplicant.conf
network={
ssid="Happy"
psk="$password"
}

-- the device's radio can see my wifi

Code: Select all

/media/fat/Scripts# iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: FA:DA:0C:XX:XX:31
                    ESSID:"DIRECT-vE-XBR-43X800E"
                    Protocol:IEEE 802.11gn
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:on
                    Bit Rates:144 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: DD330050F204104A00011010440001021049000600372A0001201011000B5842522D343358383030451054000800070050F2040001
                    Quality=21/100  Signal level=4/100
                    Extra:fm=0001
          Cell 02 - Address: 08:9E:08:XX:XX:1E
                    ESSID:"Happy"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.462 GHz (Channel 11)
                    Encryption key:on
                    Bit Rates:144 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=72/100  Signal level=1/100
                    Extra:fm=0001
          Cell 03 - Address: 08:9E:08:XX:XX:50
                    ESSID:"Happy"
                    Protocol:IEEE 802.11AC
                    Mode:Master
                    Frequency:5.745 GHz
                    Encryption key:on
                    Bit Rates:867 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=39/100  Signal level=24/100
                    Extra:fm=0001
          Cell 04 - Address: 08:9E:XX:F5:XX:11
                    ESSID:"Happy" 
                    Protocol:IEEE 802.11AC
                    Mode:Master
                    Frequency:5.745 GHz
                    Encryption key:on
                    Bit Rates:867 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=22/100  Signal level=15/100
                    Extra:fm=0001
          Cell 05 - Address: 08:9E:08:XX:XX:1A
                    ESSID:"Happy"
                    Protocol:IEEE 802.11AC
                    Mode:Master
                    Frequency:5.745 GHz
                    Encryption key:on
                    Bit Rates:867 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=69/100  Signal level=57/100
                    Extra:fm=0001
          Cell 06 - Address: 62:45:B7:XX:XX:27
                    ESSID:""
                    Protocol:IEEE 802.11b
                    Mode:Master
                    Frequency:5.825 GHz
                    Encryption key:on
                    Bit Rates:0 kb/s
                    Quality=90/100  Signal level=52/100
                    Extra:fm=0001
          Cell 07 - Address: 88:DE:A9:XX:XX:67
                    ESSID:""
                    Protocol:IEEE 802.11AC
                    Mode:Master
                    Frequency:5.745 GHz
                    Encryption key:on
                    Bit Rates:867 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: DD520050F204104A0001101044000102104700102221020304050607080988DEA90C6E671049000600372A0001201054000800060050F2040001101100164449524543542D726F6B752D3439362D434239304246
                    Quality=17/100  Signal level=11/100
                    Extra:fm=0001
          Cell 08 - Address: 0A:9E:08:XX:XX:51
                    ESSID:""
                    Protocol:IEEE 802.11AC
                    Frequency:5.745 GHz
                    Encryption key:on
                    Bit Rates:867 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac080000
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : unknown (8)
                    Quality=36/100  Signal level=25/100
                    Extra:fm=0001
/etc/network# cat interfaces
# interface file auto-generated by buildroot

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
udhcpc_opts -t 10
wpa-ssid Happy
wpa-psk $password
gateway 192.168.86.1
dns-nameservers 1.1.1.1 192.168.86.1
pre-up [ -f /media/fat/linux/wpa_supplicant.conf ]
pre-up wpa_supplicant -s -B -P /run/wpa_supplicant.$IFACE.pid -i $IFACE -D nl80211,wext -c /media/fat/linux/wpa_supplicant.conf
post_up sleep 2
post-down killall -q wpa_supplicant

/media/fat/Scripts# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wlan0 unassociated Nickname:"WIFI@RTL8821CU"
Mode:Managed Frequency=5.745 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

/media/fat/Scripts# ./check_drivers.sh
eth0 [02:03:04:05:06:07]: (up)
lo [00:00:00:00:00:00]: (unknown)
wlan0 [00:13:25:xx:xx:68]: 8821cu (down)

its using 8821cu driver

I can get this device to work on linux without issue, but it seems to have an issue on the mister. I understand mister is scaled down version but its still linux, it should work.

I can get it to work 100% if make/modprobe were on the mister os; Is there a way to download linux packages from a repo on mister?

Or do you have any idea how to get this to work right?
nothing
Posts: 11
Joined: Tue Apr 05, 2022 11:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Manually Configuring Wireless Adapter

Unread post by nothing »

These commands failed too:
/media/fat/Scripts# ip link set wlan0 up

-- from this output it looks like it cannot get an ip from the dhcp "server"
/media/fat/Scripts# ifup wlan0
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, failing
Failed to bring up wlan0.
nothing
Posts: 11
Joined: Tue Apr 05, 2022 11:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Manually Configuring Wireless Adapter

Unread post by nothing »

/media/fat/Scripts# udhcpc -i wlan0 -f -r 192.168.86.226 -F MiSter
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover

Just keeps discovering forever unless you use -n or ctrl c to break out of it.
nothing
Posts: 11
Joined: Tue Apr 05, 2022 11:02 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Manually Configuring Wireless Adapter

Unread post by nothing »

Could it be that the stock de10 nano power supply does not have enough juice to power it?
PelayoM
Posts: 3
Joined: Fri Nov 11, 2022 9:06 am

Re: Manually Configuring Wireless Adapter

Unread post by PelayoM »

I'm afraid I have the exact same issue:

"Failed to bring up wlan0."
lsusb
Bus 001 Device 004: ID 0bda:c820 Realtek Semiconductor Corp. 802.11ac NIC

iwconfig
wlan0 unassociated Nickname:"WIFI@RTL8821CU"
Mode:Managed Frequency=5.24 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Device can scan wifis but it seems that it can't join the ESSID (/var/log/messages):

Nov 11 11:33:00 MiSTer daemon.notice wpa_supplicant[593]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="Happy"
Nov 11 11:33:00 MiSTer daemon.notice wpa_supplicant[593]: wlan0: Trying to associate with b4:75:0e:60:b9:e3 (SSID='Happy' freq=5240 MHz)
Nov 11 11:33:00 MiSTer daemon.err wpa_supplicant[593]: nl80211: kernel reports: Authentication algorithm number required
Nov 11 11:33:00 MiSTer daemon.notice wpa_supplicant[593]: wlan0: CTRL-EVENT-STARTED-CHANNEL-SWITCH freq=5240 ht_enabled=1 ch_offset=-1 ch_width=80 MHz cf1=5210 cf2=0
Nov 11 11:33:01 MiSTer daemon.notice wpa_supplicant[593]: wlan0: CTRL-EVENT-ASSOC-REJECT status_code=1
Nov 11 11:33:01 MiSTer daemon.notice wpa_supplicant[593]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Happy" auth_failures=5 duration=75 reason=CONN_FAILED

The exact same wpa_supplicant.conf works with another dongle without issues (and using the same SSID/network/...)

It seems that WPA authentication is buggy (for 8821cu) or wpasupplicant.conf needs extra configuration for this device.

Any help/gudance will be appreciated.
HalleysCometMan
Posts: 4
Joined: Fri Nov 25, 2022 10:25 pm

Re: Manually Configuring Wireless Adapter

Unread post by HalleysCometMan »

Me too. Bought this adapter after it was recommended in a YouTube video on Mister.

BackDrift
Posts: 10
Joined: Wed Dec 21, 2022 8:06 pm
Been thanked: 1 time

Re: Manually Configuring Wireless Adapter

Unread post by BackDrift »

Same issue seens like it can find my router but when I try the wifi script it says unable to bring up wlan0

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Manually Configuring Wireless Adapter

Unread post by Malor »

Just as a sanity check, you're both using 5 volt, 4 amp power supplies? The DE-10's included AC adapter is too weak to run most peripherals. I don't know how much that card needs, but doing both WiFi and Bluetooth, it seems likely to be somewhat power-hungry.

BackDrift
Posts: 10
Joined: Wed Dec 21, 2022 8:06 pm
Been thanked: 1 time

Re: Manually Configuring Wireless Adapter

Unread post by BackDrift »

Malor wrote: Fri Jan 06, 2023 2:23 am

Just as a sanity check, you're both using 5 volt, 4 amp power supplies? The DE-10's included AC adapter is too weak to run most peripherals. I don't know how much that card needs, but doing both WiFi and Bluetooth, it seems likely to be somewhat power-hungry.

Yes I have an upgraded power supply.
this one to be exact.
https://www.meanwell-web.com/en-gb/ac-d ... 25b05--p1j

jamespo
Posts: 10
Joined: Sat Nov 19, 2022 1:37 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Manually Configuring Wireless Adapter

Unread post by jamespo »

Do you have a "normal" linux box (or failing that windows) you can test it in?

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Manually Configuring Wireless Adapter

Unread post by Malor »

You know, I just twigged to an incomplete memory; someone else was having a vaguely similar problem, and needed to add another argument to one of their config files. But my aging brain can't remember what it was. I remember thinking it was a little weird that you needed to....

Oh, I remembered! Have you specified your country code? We were seeing weird problems in this thread, and @8BitAndy ended up figuring out that his wpa_supplicant.conf needed to look like this:

Code: Select all

ctrl_interface=/run/wpa_supplicant
update_config=1
country=US

network={
ssid="MySSID"
psk="password"
}

He was getting a different error, but it couldn't hurt to try?

BackDrift
Posts: 10
Joined: Wed Dec 21, 2022 8:06 pm
Been thanked: 1 time

Re: Manually Configuring Wireless Adapter

Unread post by BackDrift »

I got it to connect once but it seemed random and did not even update it. wifi script was also working after rebooting it stopped working again..

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Manually Configuring Wireless Adapter

Unread post by Malor »

Did you try "country=US" in your wpa_supplicant.conf?

Post Reply