Skip to main content

Start the Wi-Fi subsystem

If the device is started in STA mode, Wi-Fi is active by default, that is, the Wi-Fi host driver and wpa_supplicant are launched during the boot process of the device.
  1. Ensure that the device is connected to the host over UART by performing the steps listed in Connect to a UART shell.
  2. To confirm if the Wi-Fi host driver is loaded, run the following command on the debug UART console:
    iw dev
    
  3. Search for the wlan0 interface in the output: Sample output
    root@qcm6490:~# iw dev
    phy#0
    Interface wlan0
    ifindex 5
    wdev 0x1
    addr 12:78:04:00:ae:15
    type managed
    channel 60 (5300 MHz), width: 80 MHz, center1: 5290 MHz
    txpower 20.00 dBm
    multicast TXQ:
    qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes   tx-packets
     0       0       0     0     0     0       0        0         0
    
  4. To verify if wpa_supplicant is active, run the following command:
    ps -ef | grep wpa_supplicant
    
    The following output indicates that the wpa_supplicant has been successfully enabled:
    root        1415       1  0 00:00 ?        00:00:00 wpa_supplicant -Dnl80211 -iwlan0 -ddd -c /etc/wpa_supplicant.conf -f /tmp/wpa_supplicant-log.txt
    
Note:
As Predictable Network Interface Names enabled by default:
  • For non-PCIe interfaces, the WLAN interface name is wlanX (RB3GEN2, Shikra).
  • For PCIe interfaces, wlanX is renamed to wlpXsY, where:
    • X = PCIe port index + 1
    • Y = device index

Scan for Wi-Fi APs

A Wi-Fi scan finds the APs listed in the vicinity that must be initiated through the nmcli command line tool. To initiate a Wi-Fi scan using nmcli run the following command:
nmcli dev wifi list 2>&1 | less
Sample output
IN-USE  BSSID              SSID           MODE   CHAN  RATE        SIGNAL  BARS SECURITY
        20:DB:AB:98:57:EE  JioPrivateNet  Infra  9     130 Mbit/s  89          ****             WPA2 802.1X
        20:DB:AB:98:57:EF  JioNet         Infra  9     130 Mbit/s  89          ****              --
        20:DB:AB:98:57:E1  JioPrivateNet  Infra  44    270 Mbit/s  80          ***              WPA2 802.1X
        20:DB:AB:98:57:E0  JioNet         Infra  44    270 Mbit/s  77          ***               --
        F0:61:C0:FB:96:A1  QGuest         Infra  11    260 Mbit/s  75          ***               --
        F0:61:C0:FB:96:A0  Hydra          Infra  11    260 Mbit/s  75          ***              WPA2
        20:DB:AB:9E:CA:CF  JioNet         Infra  5     130 Mbit/s  72          ***           --
        F0:61:C0:FB:96:B0  Hydra          Infra  140   540 Mbit/s  72          ***              WPA2
        F0:61:C0:FB:96:B1  Pandora        Infra  140   540 Mbit/s  72          ***              WPA2 802.1X
        F0:61:C0:FB:96:B2  QGuest         Infra  140   540 Mbit/s  72          ***               --
        20:DB:AB:9E:CA:CE  JioPrivateNet  Infra  5     130 Mbit/s  69          ***
Note To exit from the standard input shell, press CTRL+C.

Set up a Wi-Fi station

In the STA mode, the device operates as a client and it can connect to a wireless hotspot or router. Establish a wireless connection through the nmcli command line tool. To set up the Wi-Fi in STA mode, perform the following steps:
  1. Ensure that the device is connected to the host over UART by performing the steps listed in Connect to a UART shell.
  2. To establish a connection to an AP, run the following command:
    nmcli dev wifi connect <WiFi-SSID> password <WiFi-password>
    
    For example, run the command
    root@qcs6490-rb3gen2-vision-kit:~# nmcli dev wifi connect QualcommWiFi password 1234567890
    
    where, the Wi-Fi SSID is QualcommWiFi and the Wi-Fi password is 1234567890. Sample output
    Device 'wlan0' successfully activated with 'df4250eb-45f6-4ce2-bd90-a2513e016536'
    
    Note If you see a network error message while running the command, then run one of the following commands to trigger the Wi-Fi scan and verify the intended AP.
    nmcli dev wifi list
    
    iw dev wlan0 scan
    
  3. To verify the connection state, run the following command:
    root@qcs6490-rb3gen2-vision-kit:~# nmcli general status
    
    Sample output
    STATE  CONNECTIVITY  WIFI-HW  WIFI    WWAN-HW  WWAN
    connected  full     enabled  enabled  enabled  enabled
    
  4. To verify the connection status, perform the following steps:
    1. To view the device status, run the following command:
      root@qcs6490-rb3gen2-vision-kit:~# nmcli dev status
      
      Sample output
      DEVICE  TYPE      STATE        CONNECTION
      wlan0  wifi      connected    QualcommWiFi
      eth0    ethernet  unavailable  --
      eth1    ethernet  unavailable  --
      can0    can       unmanaged    --
      lo      loopback  unmanaged    --
      
    2. To view the additional connection information, run the following command:
      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
      IP4.ROUTE[1]:                           dst = 192.168.117.0/24, nh = 0.0.0.0, mt = 3005
      IP4.ROUTE[2]:                           dst = 192.168.117.0/24, nh = 0.0.0.0, mt = 600
      IP4.ROUTE[3]:                           dst = 0.0.0.0/0, nh = 192.168.117.126, mt = 3005
      IP4.DNS[1]:                             192.168.117.126
      IP6.ADDRESS[1]:                         2401:4900:658c:d8b0:3a86:b071:fd59:7ade/64
      IP6.ADDRESS[2]:                         2401:4900:658c:d8b0:37d5:d37f:675c:3313/64
      IP6.ADDRESS[3]:                         fe80::c930:1be0:3ac0:496c/64
      IP6.ADDRESS[4]:                         fe80::28a6:3dc0:f535:75f1/64
      IP6.GATEWAY:                            fe80::14c1:74ff:feef:f40f
      IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256
      IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 1024
      IP6.ROUTE[3]:                           dst = 2401:4900:658c:d8b0::/64, nh = ::, mt = 3005
      IP6.ROUTE[4]:                           dst = ::/0, nh = fe80::14c1:74ff:feef:f40f, mt = 3005
      IP6.DNS[1]:                             2401:4900:658c:d8b0::dc
      standard input
      
    3. Verify if the IP address is assigned on the wlan0 interface by running the ip addr show wlan0 command in the UART console.
      root@qcs6490-rb3gen2-vision-kit:~# ip addr show wlan0
      
      Sample output
      2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
          link/ether 00:03:7f:12:f7:f7 brd ff:ff:ff:ff:ff:ff
          inet 192.168.117.131/24 brd 192.168.117.255 scope global dynamic wlan0
             valid_lft 86242sec preferred_lft 86242sec
          inet6 2401:4900:658c:d8b0:3a86:b071:fd59:7ade/64 scope global dynamic
             valid_lft 86242sec preferred_lft 14242sec
          inet6 fe80::c930:1be0:3ac0:496c/64 scope link
             valid_lft forever preferred_lft forever
      
    4. Verify if the AP or router is connected to the Internet by pinging the following public DNS IP:
      root@qcs6490-rb3gen2-vision-kit:~# ping 8.8.8.8
      
      Sample output
      PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
      64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=174 ms
      64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=96.9 ms
      64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=84.8 ms
      ^C
      --- 8.8.8.8 ping statistics ---
      3 packets transmitted, 3 received, 0% packet loss, time 2003ms
      rtt min/avg/max/mdev = 84.809/118.472/173.684/39.352 ms
      
      Note If you are connected to one network, but want to use a different connection, you can disconnect by switching the connection to down by specifying the SSID nmcli con down ssid/uuid. Alternatively, if you have multiple connections with the same SSID, use the UUID. Note To connect to another saved connection, simply pass the up option in the nmcli command line tool by running the following command.
      nmcli con up ssid/uuid
      
      Ensure that you specify the SSID or UUID of the new network that you want to connect to. Note To exit from the standard input shell, press CTRL+C. For more information about nmcli, see https://www.linux.org/docs/man1/nmcli.html and https://networkmanager.dev/docs/api/latest/nmcli.html.

Set up a Wi-Fi hotspot

Ensure that you enable SSH by following the steps listed in Sign in using SSH. Set up a Wi-Fi hotspot in SoftAP mode by performing the following steps: Run the SSH using the following command:
ssh root@<device_IP_address>
For example, if the IP address of the device is 192.168.1.22, run the following command:
ssh root@192.168.1.22
Note If there is a WCN6750 chipset, ensure that the Wi-Fi SoftAP operating channel configured on the Qualcomm Dragonwing RB3 Gen 2 Development Kit is the same as the one on the Wi-Fi STA operating channel (excluding the DFS channel). Note Use either STA or SAP with a DFS channel because STA+SAP SCC DFS concurrency is currently unavailable. By default the hostapd.conf file is available at /etc location. This file configures the RB3 Gen 2 device as a Wi-Fi SoftAP operational mode with SSID as QSoftAP and password as 1234567890.
  1. Add the Wi-Fi SoftAP operational mode interface by running the following command:
    iw dev wlan0 interface add wlan1 type managed
    
  2. Reconfigure Wi-Fi SoftAP operational mode by performing the following steps:
    1. Open a new command prompt/terminal.
    2. Pull the default hostapd.conf file from the device by running the following command:
      scp -r root@<IP_address>:<source_file_path> <destination_file_path>
      
      To pull a file to the current file path, enter the <destination_file_path> as . in the command. For example, the IP address of the device is 192.168.1.22, to pull hostapd.conf from /etc, run the following command:
      scp -r root@192.168.1.22:/etc/hostapd.conf .
      
    3. Update the hostapd.conf file with the required SSID, password, and relevant hostapd configurations. Note Update hw_mode accurately while modifying the Wi-Fi channel. For more information about hostapd configuration, see https://w1.fi/cgit/hostap/plain/hostapd/README.
    4. Push the file to the device by running the following command:
      scp -r hostapd.conf root@192.168.1.22:/etc
      
    5. To verify that the configuration parameters are updated, run the following command in the device for the hostapd.conf file:
      <cat /etc/hostapd.conf>
      
  3. Set a MAC address for wlan1 on the Qualcomm Dragonwing RB3 Gen 2 Development Kit that has a WCN6750 Wi-Fi chipset. The following example can be used as a reference while setting up a MAC address.
    ip link set wlan1 address 00:03:7F:12:B5:B6
    
  4. To set up the SoftAP, run the following command in the ssh shell:
    hostapd -B /etc/hostapd.conf
    
    The following output indicates that the AP is set up:
    U:\>ssh root@192.168.1.22
    The authenticity of host '192.168.1.22 (192.168.1.22)' can't be established.
    ED25519 key fingerprint is SHA256: FikBVhxqv9RX0rCP8FP3x0Fr1zGWhgaNhLtD5/7xAJA.
    This key is not known by any other names
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '192.168.1.22' (ED25519) to the list of known hosts.
    Last login: Sun Jan 6 00:06:18 1980
    root@qcm6490:~#
    root@qcm6490:~#
    root@qcm6490:~# iw dev wlan0 interface add wlan1 type managed
    root@qcm6490:~# hostapd -B /etc/hostapd.conf
    wlan1: interface state UNINITIALIZED->COUNTRY_UPDATE
    wlan1: interface state COUNTRY_UPDATE->HT_SCAN
    root@qcm6490:~# ps -ef | grep hostapd
    root   1726       1   0  00:14 ?      00:00:00 hostapd -B /etc/hostapd.conf
    root   1762    1674   0  00:15 pts/0  00:00:00 grep hostapd
    root@qcm6490:~# |
    
  5. To start the Dynamic Host Configuration Protocol (DHCP) server on the Wi-Fi hotspot interface, run the following commands:
    brctl addbr br0
    
    brctl addif br0 wlan1
    
    ip addr add 192.168.225.1/24 dev br0
    ip link set br0 up
    
    killall dnsmasq
    
    dnsmasq --conf-file=/etc/dnsmasq.conf --dhcp-leasefile=/var/run/dnsmasq.leases --addn-hosts=/data/hosts --pid-file=/var/run/dnsmasq.pid -i br0 -I lo -z --dhcp-range=br0,192.168.225.20,192.168.225.60,255.255.255.0,43200 --dhcp-hostsfile=/data/dhcp_hosts --dhcp-option-force=6,192.168.225.1 --dhcp-script=/bin/dnsmasq_script.sh
    
  6. To establish a connection with the hostapd_cli, run the following command in SSH:
    hostapd_cli -i wlan1 -p /var/run/hostapd
    
    Monitor the hostapd_cli console for the Wi-Fi STA connection notifications such as AP-STA-CONNECTED, EAPOL-4WAY-HS-COMPLETED. Sample output
    root@qcm6490:~# hostapd_cli -i wlan1 -p /var/run/hostapd
    hostapd_cli v2.11-devel
    Copyright (c) 2004-2022, Jouni Malinen <j@wl.fi> and contributors
    This software may be distributed under the terms of the BSD License.
    See README for more details.
    Interactive mode
    > <3>AP-STA-CONNECTED aa: a4: fd: 8b: ec: 90
    <3>EAPOL-4WAY-HS-COMPLETED aa: a4: fd: 8b:ec:90
    > list_sta
    aa: a4: fd: 8b:ec:90
    
  7. To verify the connection status, connect to SoftAP from other devices. For example, connect to SoftAP from a mobile device by performing the following steps:
    1. On the mobile device, go to the Wi-Fi settings.
    2. Wait for the Wi-Fi STA to detect SoftAP (with the SSID QSoftAP).
    3. Select SoftAP and enter the corresponding wpa_passphrase that was configured for SoftAP on the RB3 Gen 2 device, then connect. Sample output
      > status
      state=ENABLED
      phy=phyR freq=2412
      num_sta_non_erp=0
      num_sta_no_short_slot_time=0
      num_sta_no_short_preamble=0
      olbc=0
      num_sta_ht_no_gf=0 num_sta_no_ht=0
      num_sta_ht_20_mhz=0
      num_sta_ht40_intolerant=0
      olbc_ht=0
      ht_op_mode=0x0
      hw_mode=g
      country_code=US
      country3=0x20
      cac_time_seconds=0
      cac_time_left_seconds=N/A
      channel=1
      edmg_enable=0 edmg_channel=0
      secondary_channel=0
      ieee80211n=1
      ieee80211ac=0
      ieee80211ax=0
      ieee80211be=0
      beacon_int=100
      dtim_period=2
      ht_caps_info=000c
      ht_mcs_bitmask=ffff0000000000000000
      supported_rates-02 04 0b 16 0c 12 18 24 30 48 60 6c
      max_txpower=30
      bss[0]=wlan1
      bssid[0]=00:03:7f:95:8e:8e
      ssid [0]=QSoftAP
      num_sta[0]=1
      > |
      
    4. To verify the connection, ping the IP address of the mobile from the RB3 Gen 2 device in the ssh shell. The following output indicates that the Wi-Fi connection has been established successfully and the data transfer has begun:
      sh-5.1# ping 192.168.1.42
      PING 192.168.1.42 (192.168.1.42): 56 data bytes
      64 bytes from 192.168.1.42: seq=0 ttl=64 time=11.175 ms
      64 bytes from 192.168.1.42: seq=1 ttl=64 time=14.528 ms
      64 bytes from 192.168.1.42: seq=2 ttl=64 time=29.735 ms
      64 bytes from 192.168.1.42: seq=3 ttl=64 time=223.822 ms
      64 bytes from 192.168.1.42: seq-4 ttl=64 time-23.675 ms
      ^C
      192.168.1.42 ping statistics ---
      7 packets transmitted, 5 packets received, 28% packet loss
      round-trip min/avg/max = 11.175/60.587/223.822 ms
      sh-5.1#
      
      Alternatively, you can verify the Wi-Fi connection status in the Settings of the connected device. For example, to get the IP address of a mobile device connected to the RB3 Gen 2 SoftAP, perform the following steps:
      1. Go to Settings > Wi-Fi.
      2. Verify the SSID of the AP.

Stop a Wi-Fi hotspot

Note Ensure that the Wi-Fi hotspot has been set up. To stop the hotspot, do the following in SSH:
  1. Stop the hostapd by performing the following steps:
    1. To stop the hostapd process, run the following command:
      killall hostapd
      
    2. To disable the interface, run the following command:
      ip link set wlan1 down
      
  2. To delete ctrl_interface, run the following command:
    rm -rf /var/run/hostapd/wlan1
    
    The Wi-Fi hotspot stops successfully.