Orange pi подключить wifi

sidward35 / OrangePiWiFiSetup.md

Now that the Orange Pi Zero is working, we can do some initial set up. The following assumes you are logged into your Orange Pi Zero using either SSH or the serial console with your everyday account. Remember to hit the enter key after typing in each line of commands.

First we’ll update Armbian to the latest version:

sudo apt-get update sudo apt-get upgrade 

The first time you use sudo in a session, and periodically thereafter, you will be prompted for your pasword. Depending on the speed of your internet connection and the size of the update, the upgrade process can take a while.

Next we’ll set the time zone to match your location. To do so, enter the following command:

sudo dpkg-reconfigure tzdata 
  1. Use the arrow keys to select your Geographic area and press enter.
  2. Select a city or region within your time zone and press enter.

Your timezone will be updated and you will be returned to the command line.

Lastly, we’ll set up wifi. This is super handy because once set up, our Orange Pi Zero can be placed anywhere within wifi range where it can be provided with power. To do so,

sudo nano /etc/network/interfaces 
  1. Add the following 4 lines to the end of the file, substituting the actual network SSID and WPA password for your wifi network:
auto wlan0 iface wlan0 inet dhcp wpa-ssid <Your Access Point Name aka SSID> wpa-psk <Your WPA Password> 
  1. To save your changes, hit the key combination Control+O.
  2. To quit back to the command prompt, hit the key combination Control+X.
  3. Bring up your wifi connection with the following command:

You can find out the IP address assigned to your wifi connection by typing:

The assigned IP address should appear immediately after the text inet addr:.

You can observe the signal strength and other details of your wifi connection by entering:

To monitor the temperature, CPU speed and other interesting details of your Orange Pi Zero type:

(To quit and return to the command line, hit the key combination Control+C.)

To cleanly exit your PuTTY session while leaving your Orange Pi Zero running, type:

To cleanly shut down your Orange Pi Zero before disconnecting power, type:

To reboot your Orange Pi Zero, type:

Here are just some things you can do now that your Orange Pi Zero is operational:

  • Check out the Fine Tuning section of the Armbian user guide for additional configuration you can perform.
  • Your router could decide to assign a different IP address to your Orange Pi Zero ethernet and wifi interfaces in future. If that happens, you’ll have to rediscover the IP address(es) of your Orange Pi Zero… But many routers have the ability to assign fixed (aka static) IP addresses. To do this, you need to know the hardware address of the interfaces on your Orange Pi Zero. To discover these type:
sudo ifconfig eth0 | grep -i hwaddr sudo ifconfig wlan0 | grep -i hwaddr 

The hardware address will be the jumble of hexadecimal numbers separated by colons, e.g “8c:ff:a3:06:b5:1b”, at the end of the line. In your router configuration you need to add a mapping between the hardware address and the fixed IP address to be assigned to the interface.

  • Add a heatsink to H2+ chip on your Orange Pi Zero — it runs pretty hot without one.
  • Put in your Orange Pi Zero in a nice box.
  • Track aircraft in your area with a cheap USB DVB-T television receiver dongle.
Читайте также:  Точка доступа вай фай карта

Источник

Add a WIFI Connection

The nmtui tool, or NetworkManager Text User Interface , is a component of NetworkManager, and can be used (in a TUI style) to add and select a WIFi network. Nmtui is, however, also capable of managing other types of networks, and depending on your circumstances may not be the best option. This leads is to.

Method 2: nmcli

nmcli , like nmtui , is a component of networkmanager, and has the same features.

To connect to a wireless network, follow these instructions:

1: list wireless networks

To show a list of wi-fi networks, at a sudo-enabled terminal, enter:

sudo nmcli device wifi list

The output should look like this:

 * SSID MODE CHAN RATE SIGNAL BARS SECURITY * Orange-Pi-wifi Infra 11 54 Mbit/s 100 ▂▄▆█ -- A13-Wifi Infra 6 54 Mbit/s 30 ▂___ WPA1 WPA2 2WIRE533 Infra 10 54 Mbit/s 44 ▂▄__ WPA1 WPA2 

Connect to network (without password)

If your network does not require a password (I.E. is not secure), you can connect to it with the following command:

sudo nmcli device wifi connect ‘WiFINetworkName’ ifname wlan0

Give it a few seconds to connect, then verify your connectivity with:

ip -br address show dev wlan0

Connect to network (with password)

However, if your network does require a password (as most should), you may connect to it with the following command, replacing WiFiNetworkName and WiFiNetworkPass with your network name and password, respectively:

sudo nmcli device wifi connect ‘WiFiNetworkName’ password ‘WifiPass’ ifname wlan0

Please do keep in mind that you will not receive feedback while typing the password component of the above command, for security reasons.

Once again, verify your connectivity with:

ip -br address show dev wlan0

Tips and Tricks

  • When using nmcli and connecting to a wi-fi network who’s eSSID (name) is not broadcast (I.E. hidden) you will need to add hidden yes to your connect command.
  • If a wlan0 interface does not exist on the system, please verify that your board has wifi (either via an internal adapter or over USB), that firmware is loaded (if necesary), that your kernel supports wifi, and that it does not have another name (such as wlp3s0). For more info on firmware, please see wifi troubleshooting
  • If the ip -br address show dev wlan0 command does not show an IPV4 address, please verify that a DHCP server is present on your network. If not, please refer to static network configuration for more information.
Читайте также:  Пропадает скорость интернета вай фай

Источник

DiyTronic

В ходе настройки Orange Pi Zero Plus 2 H3 обнаружил, что есть конкретные проблемы с Wi-Fi. В зависимости от используемого дистрибутива Linux имеем либо негрузящайся драйвер, либо работают только первые 11 каналов Wi-Fi, а учитывая, что моих сетей там нет, это проблема, которую пришлось решать. Решение я нашёл и ниже я его вам покажу и расскажу как с этой проблемой бороться.

Итак, хотелось мне запустить эту плату именно в Armbin, но именно этот дистрибутив славился тем, что данная плата в нём Wi-Fi не поддерживала. Но мы не ищем лёгких путей и из-за какого-то там чортова драйвера менять дистрибутив для меня просто унижение. Если драйвер есть и он в принципе работает, то и в Armbian он у меня заработает. Вызов принят!

Получаем проблему

Итак, первым делом накатываем Armbian. На официальной стрaнице образа для данной платы я не нашёл, но зато нашёл где эти сборки выкладываются. В общем качаем отсюда https://fi.mirror.armbian.de/archive/orangepizeroplus2-h3/archive/. Я использовал версию bullseye. Пробовал jammy, но там ровно тоже самое.

Альтернативные драйвера

Они существуют и возможно работают.

Проблема одна — их надо качать, а сети нет. Можно конечно скачать код на другом компьютере, залить на карточку и попытаться собрать на плате, но слишком много возни и вероятно потребуется докачивать зависимости.

Анализируем ошибки

В итоге имеем условно работающий Wi-Fi из каробки с куцым списком доступных сетей и ошибки в логах при загрузке фирмвари данного драйвера.

% dmesg | grep brcm brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.bin failed with error -2 brcmfmac mmc1:0001:1: Falling back to sysfs fallback for: brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.bin brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.txt failed with error -2 brcmfmac mmc1:0001:1: Falling back to sysfs fallback for: brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.txt brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Mar 30 2016 11:30:56 version 7.45.77.h8.4 FWID 01-ee8a6268

Как видно оно пытается загрузить какую-то фирмварь и не может найти нужных файлов. Придётся таки разбираться, что такое firmware и как оно грузится

Linux и firmware

В общем, как выяснилось, для всяких проприетарных драйверов типа Broadcom-а у нас есть бинарные файлы (та самая firmware), которые и подгружаются родным линуксовым драйвером, чтобы всё работало как надо. Но кроме бинарника у нас есть некий конфиг, который есть ни что иное как набор переменных, которые заливаются в NVRAM драйвера.

Что не так в нашем случае

Для нашего случая всё выглядит вот так.

% ls -la /lib/firmware/brcm/*43430* ... /lib/firmware/brcm/brcmfmac43430-sdio.bin # /lib/firmware/brcm/brcmfmac43430-sdio.txt # 

Но как видно из ошибки, драйвер пытается загрузить firmware из файла с суффиксом вендора устройства, то есть /lib/firmware/brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.bin вместо /lib/firmware/brcm/brcmfmac43430-sdio.bin . Поэтому я решил просто создать нужные симлинки.

Забегая вперёд должен отметить, что это оказалось необязательно, а эта ошибка это скорее предупреждение. Походу драйвер таки находит фирмварь и по существующим именам. Но что сделано, то сделано и как минимум убираются сообщения об ошибках при загрузке.

После исправления имеем такую картину.

% ls -la /lib/firmware/brcm/*43430* ... /lib/firmware/brcm/brcmfmac43430-sdio.bin # /lib/firmware/brcm/brcmfmac43430-sdio.txt # /lib/firmware/brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.bin -> /lib/firmware/brcm/brcmfmac43430-sdio.bin /lib/firmware/brcm/brcmfmac43430-sdio.xunlong,orangepi-zero-plus2-h3.txt -> /lib/firmware/brcm/brcmfmac43430-sdio.txt

Теперь при загрузке видим следующее

% dmesg | grep brcm brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 # brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 # brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Mar 30 2016 11:30:56 version 7.45.77.h8.4 FWID 01-ee8a6268

Задаём код региона

Несмотря на успешную загрузку фирмвари, нас осталась ошибка как раз насчёт ограничения каналов и фирмварь ругается на какой-то clm_blob . Это как оказалось ещё один бинарник с региональными настройками для данного драйвера. И с этими самыми настройками полная чехарда. В разное время за это дело отвечали следующие подсистемы.

CRDA (central regulatory domain agent)

С этим связаны рекоммендации поправить регион в /etc/default/crda , но нифига не работает, так как эта тема устарела с версии ядра 4.15

cfg80211

Есть так же рекоммендации передать регион драйверу Linux cfg80211, но это тоже устарело и сегодня каждый драйвер должен сам уметь разбираться с такими делами.

echo "options cfg80211 ieee80211_regdom=US" > /etc/modprobe.d/cfg80211.conf

clm_blob

Это по факту кусок базы данных, типа той, что использовалась в CRDA, но специфичный для данного драйвера. Как оказалось и этот метод устарел и вся информация уже должна содержаться в недрах драйвера. К слову я таки нашёл этот бинарь от Raspberry PI и подсунул для загрузки, но работать лучше не стало.

И что таки делать?

В итоге пришлось лезть в конфиг фирмвари и уже там я обнаружил подозрительную переменную ccode=ALL , поменяв значение которой, после перезагрузки я получил полный список Wi-Fi сетей.

#AP6212_NVRAM_V1.0_20140603 # 2.4 GHz, 20 MHz BW mode # The following parameter values are just placeholders, need to be updated. . xtalfreq=26000 nocrc=1 ag0=255 aa2g=1 ccode=ALL #  extpagain2g=0 . 

Но тут есть проблема — при обновлении пакета с фирмварями этот файл будет перезаписываться.

Всё чудесатее и чудесатее

Гугля по теме обнаружил ссылки на исходники с такими комментариями

/* In some cases the EFI-var stored nvram contains "ccode=ALL" or * "ccode=XV" to specify "worldwide" compatible settings. ccode=ALL is * not understood by the firmware and some of the firmware files in * linux-firmware support only 2.4 GHz and not 5 GHz when ccode=XV. */

Так, что видимо стоит попробовать вместо RU использовать XV. Возможно даже появится диапазон 5ГГц.

Я сдаюсь

Кроме всего прочего искал способ прописать ccode в драйвер через /proc или /sys.
Декомпилировал devicetree в надежде найти там способ перезаписать значения NVRAM.

Все тщетно. Походу эти фирмвари и драйвера для Broadcom писались через жопу, на скорую руку и всё, что нам остаётся это грязно патчить через подмену значения в этом текстовом конфиге.

Итого

Как оказалось в принципе по минимуму достаточно поменять ccode=ALL на ccode=RU в конфиге фирмвари драйвера.

И видимо в автозагрузку придётся добавить скрипт для замены ccode в нужном файле.

Ссылки

Источник

Оцените статью
Adblock
detector