How To Use Wireless Networking

Overview

Wireless networking on an embedded Linux system is slightly more complicated than wired. This additional complexity is caused by two factors: most wireless networks are encrypted, and many wireless drivers contain proprietary code. Due to the encryption, we need some means of conveying authentication information to the wireless router. Proprietary code means that the drivers cannot simply be patched into the kernel — they must be built separately and loaded at run time.

This document details the tools available from Timesys that allow you to work with wireless drivers on a number of platforms. The first section describes a number of userspace tools that deal with configuring wireless networks, while the second section focuses on specific drivers.

Userspace Tools

ifupdown

ifupdown is a generic networking tool that allows you to specify device configurations for your system that are retained from session to session. In Timesys-built root filesystems, it uses the /etc/network/ directory to store this information. This directory contains a number of subdirectories that specify scripts that can run during various stages of an interface's startup/shutdown, as well as a configuration file, interfaces.

You can add scripts to this system to automatically load external modules and firmware whenever an interface is brought-up, and remove them when it is disabled.

Please see the manpage for more information.

wpa_supplicant

wpa_supplicant is a service that acts as a mediator for encryption and authentication between host and client in a wireless network. If you are not using WPA encryption, you do not need to use this software.

wpa_supplicant is fairly easy to configure. The default Factory installation includes an example /etc/wpa_supplicant.conf file that shows a number of different ways to configure your network. You should choose one that most closely resembles your wireless router's settings.

wpa_supplicant also includes a command line utility for configuring an interface called wpa_cli. You must start the wpa_supplicant daemon before you can use it.

Starting the Daemon

The wpa_supplicant package contains an init script, S25-wpa_supplicant. It is hard-coded to enable the daemon for wlan0 with the wext (Wireless Extensions) driver. You can modify this file if you have a different setup.

To manually start wpa_supplicant, use the following command:

wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

Once the daemon has been started and properly configured, you can treat the interface as any other network interface.

Example Settings

The following are some examples that will work with most consumer wireless networks. For more complex examples, please see the wpa_supplicant.conf file installed by the Factory.

Unsecured

network={
        ssid="Network Name" 
        key_mgmt=NONE
}

WEP

network={
        ssid="Network Name" 
        key_mgmt=NONE
        wep_key0="abcde" 
        wep_key1="0102030405" 
        wep_key2="1234567890123" 
        wep_tx_keyidx=0
        priority=5
}

WPA/WPA2

network={
        ssid="Network Name" 
# ASCII Keys must be in quotes, hex can be outside
        psk="ASCII Key" 
        priority=5
}

wireless-tools

wireless-tools are a suite of applications that were created as the reference implementation for userspace access to the Linux Wireless Extensions interface. They allow you to modify the various properties of the wireless communications (e.g. rate, channel, network SSID, authentication).

The following page has a nice tutorial for using wireless-tools: http://www.ghacks.net/2009/04/14/connect-to-a-wireless-network-via-command-line/

The typical method for enabling the wireless interface with wireless tools is:

  1. Load your wireless driver.
  2. Bring the interface up with ifconfig:
    ifconfig wlan0 up
  3. Scan for wireless networks using iwlist:
    iwlist wlan0 scanning
  4. Set up your interface using iwconfig:
    iwconfig wlan0 essid <network name>
  5. Configure your network interface using ifconfig or a dhcp client:
    ifconfig wlan0 192.168.0.20
    udhcpc -iwlan0

iwlist

iwlist contains a number of functions for displaying information about your wireless interface. The most useful function is scanning, which will scan the area for broadcast SSIDs.

iwlist <interface> scanning

Other functions include rate, encryption, and channel. Run iwlist --help for a complete list.

iwconfig

iwconfig is the wireless version of the ifconfig command. It allows you to specify the SSID, key, channel, and other properties of your wireless interface. It takes the following format:

iwconfig <interface> <command> <value> <command> <value> ...

Once your wireless network is configured, you can use ifconfig to set up the standard networking properties, such as IP address, netmask, etc.

Drivers

SX-SDMAN2

  • HOWTO Use SX-SDMAN2 on the iMX6

Digi ConnectCore Wi.MX51 JS Redpine Wifi Module

The Digi ConnectCore Wi.iMX51 JS Development Kit includes a WiFi module from Redpine. The source code for the driver is proprietary, so Timesys may only provide binary drivers. The Factory contains a package that will install these modules into your RFS, along with a startup script to install them at boot time.

To use the Digi Wifi Drivers:

  1. In the Factory workorder, select the following packages:
    • ccwmx51js-redpine-wifi
    • wpa_supplicant
    • ifupdown
  2. Build your Factory project.
  3. Once your RFS is installed, modify the following files in your RFS:
    • /etc/init.d/S15-redpine-wifi — There are a number of options that affect the functionality of your WiFi module. The defaults should be acceptable
    • /etc/wpa_supplicant.conf — Modify the settings to match your network
    • /etc/init.d/S25-wpa_supplicant — Modify to match your device name and wireless driver
    • /etc/network/interfaces — Add the interface IP connection information
  4. If configured properly, your wireless device will be enabled at startup.

External Links