Skip to main content

Wi-Fi and Bluetooth

Wi-Fi

Wi-Fi is a wireless networking technology that uses the IEEE 802.11 protocol. It allows electronic devices like smartphones, wearables, laptops, desktops, and other consumer electronics to connect to the Internet without physical cables.

Operating bands

The AP6256 Wi-Fi chipset supports 2.4 GHz and 5 GHz operating bands.

Operating modes

The Wi-Fi software operates in the following modes.

ModeDescription
STA modeIn STA mode, a device connects to an AP within a Wi-Fi network and communicates with other devices in the network. This mode is standard for wireless devices in a Wi-Fi connection.
Hotspot modeThe hotspot mode enables a device to provide backhaul (Internet) connectivity to Wi-Fi clients using a cellular link (LTE). The device establishes this connection through its lightweight hotspot interface. In hotspot mode, the device can communicate with other Wi-Fi clients connected to the same hotspot, communicate with the hotspot device, and share the WAN connection of the device.

In Station (STA) mode, the device can be connected to an existing Wi-Fi network to access network resources or the Internet.

  1. Scan for nearby Wi-Fi networks using commands.
nmcli dev wifi list 2>&1 | less

note

Type q to exit.

  1. Connect to a Wi-Fi network.
sudo nmcli dev wifi connect <WiFi-SSID> password <WiFi-password>

For example, run the following command.

sudo nmcli dev wifi connect rubikpiwifi password 123456789

WiFi-SSID is rubikpiwifi and WiFi-password is 123456789

Sample output:

Device 'wlan0' successfully activated with 'e8b98f24-3f23-4742-8aa3-0d37c5ee6564'.
note

If you see a network error message when running the command, run one of the following commands to trigger a Wi-Fi scan and verify the target access point (AP).

  • nmcli dev wifi list

  • iw dev wlan0 scan

  1. Check the network status:
nmcli general status

Sample output:

STATE  CONNECTIVITY  WIFI-HW  WIFI    WWAN-HW  WWAN
connected full enabled enabled enabled enabled
  1. To verify the network status, run the following command:

    1. Run the following command to check the device status.
    nmcli dev status

    Sample output:

    DEVICE  TYPE      STATE        CONNECTION
    wlan0 wifi connected RUbikpiWiFi
    eth0 ethernet unavailable --
    eth1 ethernet unavailable --
    can0 can unmanaged --
    lo loopback unmanaged --
    1. Check the additional connection information.
    nmcli device show wlan0

    Sample output:

    GENERAL.DEVICE:                         wlan0
    GENERAL.TYPE: wifi
    GENERAL.HWADDR: 00:03:7F:12:F7:F7
    GENERAL.MTU: 1500
    GENERAL.STATE: 100 (connected)
    GENERAL.CONNECTION: QualcommWiFi
    GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/5
    IP4.ADDRESS[1]: 192.168.117.130/24
    IP4.ADDRESS[2]: 192.168.117.131/24
    IP4.GATEWAY: 192.168.117.126
    1. Verify whether an IP address has been assigned to the wlan0 interface by running the ifconfig wlan0 command in the UART console.
    ifconfig wlan0
    note

    Run the sudo apt install net-tools command to install the ifconfig command.

    1. Verify whether the AP or router is connected to the Internet by pinging the following public DNS IP address.
    ping 8.8.8.8
note
  • If you have connected to a network but want to connect to another one, switch the connection off by specifying the SSID and running the command nmcli con down ssid/uuid. If you have multiple connections with the same SSID, use the UUID.

  • To connect to another saved network, use the up option with the nmcli command-line tool by running the nmcli con up ssid/uuid command.

note

To exit the standard input shell, press Ctrl+C.

For more information about nmcli, refer to https://www.linux.org/docs/man1/nmcli.html and https://networkmanager.dev/docs/api/latest/nmcli.html.

Bluetooth

The Bluetooth® wireless technology is a short-range communications system that facilitates wireless exchange of data between devices. The key advantages of Bluetooth technology are as follows:

  • Replaces the cables connecting portable and fixed electronic devices.

  • Provides robust, power-efficient, and cost-effective solutions.

  • Facilitates flexibility of solutions and their applications.

Prerequisite

  • Run the following command to install the required software packages:
sudo apt install pipewire pipewire-pulse pipewire-audio pipewire-alsa

Open the Bluetooth test application

  • To open the Bluetooth test application, run the following command. All Bluetooth configuration commands should be executed within this application.
bluetoothctl

Sample output

Enable Bluetooth

  • To enable Bluetooth, run the following command:
power on

Sample output

Perform a Bluetooth scan

  • To start a scan for nearby Bluetooth devices, run the following command:
scan on

Sample output

Stop the Bluetooth scan

  • To stop the ongoing Bluetooth scan, run the following command:
scan off

Sample output

Pair with a remote Bluetooth device

Before pairing with the remote device, perform a Bluetooth scan to ensure the remote device is available.

  • To pair with the remote Bluetooth device, run the following command:
pair <bt_address>

To accept the active/passive pairing, enter 'yes'. To reject the active/passive pairing, enter 'no'. The parameter bt_address is the Bluetooth address of the remote device.

Example

To pair with the remote device using <bt_address> 00:25:02:02:7B:A4, run the following command:

pair 00:25:02:02:7B:A4

Sample output

[bluetooth] pair 00:25:02:02:7B:A4
Attempting to pair with 00:25:02:02:7B:A4
[bluetooth]# hci0 device_flags_changed: 00:25:02:02:7B:A4 (BR/EDR)
[bluetooth]# supp: 0x00000001 curr: 0x00000000
[bluetooth]# hci0 00:25:02:02:7B:A4 type BR/EDR connected eir_len 20
[CHG] Device 00:25:02:02:7B:A4 Connected: yes
[OPPO Enco W31]# hci0 new_link_key 00:25:02:02:7B:A4 type 0x04 pin_len 0 store_hint 1
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 Bonded: yes
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 00000001-0000-1000-8000-00805f9b34fb
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 00001107-d102-11e1-9b23-00025b00a5a5
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110f-0000-1000-8000-00805f9b34fb
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 UUIDs: 00001203-0000-1000-8000-00805f9b34fb
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 ServicesResolved: yes
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 Paired: yes
[OPPO Enco W31]# Pairing successful
[OPPO Enco W31]# hci0 00:25:02:02:7B:A4 type BR/EDR disconnected with reason 2
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 ServicesResolved: no
[CHG] Device 00:25:02:02:7B:A4 Connected: no
[bluetooth]# hci0 00:25:02:02:7B:A4 type BR/EDR connected eir_len 20
[CHG] Device 00:25:02:02:7B:A4 Connected: yes
[OPPO Enco W31]# Authorize service
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): yes
[OPPO Enco W31]# Authorize service
[OPPO Enco W31]# 1;39m[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 00000001-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 00001107-d102-11e1-9b23-00025b00a5a5
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110d-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000110f-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 00:25:02:02:7B:A4 UUIDs: 00001203-0000-1000-8000-00805f9b34fb
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [NEW] Endpoint /org/bluez/hci0/dev_00_25_02_02_7B_A4/sep1
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): [NEW] Endpoint /org/bluez/hci0/dev_00_25_02_02_7B_A4/sep2
[agent] Authorize service 0000111f-0000-1000-8000-00805f9b34fb (yes/no): yes
[OPPO Enco W31]#

Get the list of bonded/paired devices

  • To get the list of bonded/paired devices, run the following command:
devices

Sample output

Connect to a remote device

  • To connect to a remote device, run the following command:
connect <bt_address>

The <bt_address> parameter is the Bluetooth address of the remote device.

Example

To connect to a paired remote device using <bt_address> 00:25:02:02:7B:A4, run the following command:

connect 00:25:02:02:7B:A4

Sample output

[bluetooth]# connect 00:25:02:02:7B:A4
Attempting to connect to 00:25:02:02:7B:A4
[bluetooth]# [CHG] Device 66:90:8B:13:9F:50 RSSI: 0xffffffb2 (-78)
[bluetooth]# [CHG] Device 00:25:02:02:7B:A4 AddressType: public
[bluetooth]# [CHG] Device 3F:5B:7D:73:30:9E ServiceData.0000fe95-0000-1000-8000-00805f9b34fb:
[bluetooth]# 70 20 5b 04 5e 9e 30 73 7d 5b 3f 09 04 10 02 ff p [.^.0s}[?.....
[bluetooth]# 00 .
[bluetooth]# [CHG] Device 47:6E:17:4C:2A:3C RSSI: 0xffffffb8 (-72)
[bluetooth]# [NEW] Device 54:38:90:28:DE:0A 54-38-90-28-DE-0A
[bluetooth]# [DEL] Device 28:6B:35:B5:C3:D0 CN8900578W2
[bluetooth]# hci0 00:25:02:02:7B:A4 type BR/EDR connected eir_len 15
[CHG] Device 00:25:02:02:7B:A4 Connected: yes
[OPPO Enco W31]# [NEW] Endpoint /org/bluez/hci0/dev_00_25_02_02_7B_A4/sep1
[OPPO Enco W31]# [NEW] Endpoint /org/bluez/hci0/dev_00_25_02_02_7B_A4/sep2
[OPPO Enco W31]# [NEW] Transport /org/bluez/hci0/dev_00_25_02_02_7B_A4/sep1/fd4
[OPPO Enco W31]# Connection successful
[OPPO Enco W31]# [CHG] Device 00:25:02:02:7B:A4 ServicesResolved: yes
[OPPO Enco W31]# [CHG] Transport /org/bluez/hci0/dev_00_25_02_02_7B_A4/sep1/fd4 State: active

Unpair a device

  • To unpair a device, run the following command:
remove <bt_address>

Sample output

Enable discovery mode

  • To enable discovery mode on the DUT, run the following command:
discoverable on

Sample output

Disable Bluetooth

  • To disable Bluetooth on the device, run the following command:
power off

Sample output

Exit the Bluetooth test program:

exit