WIFI & Ethernet

Introduction

This page introduces how to use the network for Firefly-PX3-SE. Currently, you can only use the function of WIFI and WIFI hotspots in the setting app, while the ethernet function is not supported for the moment(we may add it later).

Still, you can use the shell script to configure and realize all the above functions. The following section describes how to configure the WIFI and Ethernet to implement networking for reference learning.

WIFI

You can use the WIFI connection and configuration tool wpa_supplicant to configure the wireless network. The tool contains two applications: wpa_supplicant and wpa_cli.

Enable WIFI

# echo 1 >/sys/class/rkwifi/driver
# ifconfig wlan0 up

Once the WIFI enabled successfully, you can execute ifconfig to see wlan0 nodes.

Start wpa_supplicant progress

# wpa_supplicant -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf -B

Created if the file /etc/wpa_supplicant.conf does not exist, modified to the following code:

ctrl_interface=/var/run/wpa_supplicant
update_config=1

Configure WIFI via wpa_cli

Common commands:

# wpa_cli -i wlan0 scan             // Scan the nearby WIFI network(s).
# wpa_cli -i wlan0 scan_result      // Print the scanned WIFI network(s).
# wpa_cli -i wlan0 add_network      // Add a network connection.

If you want to use [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS](wpa encryption)for the connection, and the WIFI name is “name” and the WIFI password is “psk”, please run the following commands:

# wpa_cli -i wlan0 set_network 0 ssid '"name"
# wpa_cli -i wlan0 set_network 0 psk '"psk"'
# wpa_cli -i wlan0 enable_network 0    //Enable WiFi

If you want to use[WEP][ESS](wep encryption) for the connection, and the WIFI name is “name” and the WIFI password is “psk”, please run the following commands:

# wpa_cli -i wlan0 set_network 0 ssid '"name"'
# wpa_cli -i wlan0 set_network 0 key_mgmt NONE
# wpa_cli -i wlan0 set_network 0 wep_key0 '"psk"'
# wpa_cli -i wlan0 enable_network 0

If you want to use[ESS](no encryption) for the connection and the WIFI name is “name”, please run the following commands:

# wpa_cli -i wlan0 set_network 0 ssid '"name"'
# wpa_cli -i wlan0 set_network 0 key_mgmt NONE
# wpa_cli -i wlan0 enable_network 0

Save the WIFI connection information

# wpa_cli -i wlan0 save_config

Connect to the saved networks

# wpa_cli -i wlan0 list_network        // list all the saved networks.s
# wpa_cli -i wlan0 select_network 1     // connect to the first saved network.
# wpa_cli -i wlan0 enable_network 1      // enable the connection to the first saved network.

Turn off WiFi

# ifconfig wlan0 down

Ethernet

Enable Ethernet

# ifconfig eth0 up

Dynamic acquisition of IP address

Please execute the following command to acquire IP address dynamically based on WIFI.

# udhcpc -i wlan0 -R

Please execute the following command to acquire IP address dynamically based on Ethernet.

# udhcpc -i eth0 -R

Set static IP address

Set static IP address based on Ethernet:

# ip addr flush dev
# ip addr add 168.168.100.78/255.255.0.0 dev eth0  #ip address/subnet mask
# ip route flush dev eth0
# ip route add 168.168.0.1 dev eth0		           #gateway
# ip route add default via 168.168.0.1 dev eth0    #add default route
# echo -e "nameserver 114.114.114.114\nnameserver 8.8.8.8" > /tmp/resolv.conf #set DNS(temporary)

You can use the same way to set static IP address based on WIFI.