TS-4900 yocto wifi

From embeddedTS Manuals
Revision as of 14:58, 1 October 2014 by Mark (talk | contribs) (Created page with "The Yocto distribution includes hostapd which is running by default, so it must first be disabled to use it as a client. <source lang=bash> update-rc.d -f hostapd remove reboo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Yocto distribution includes hostapd which is running by default, so it must first be disabled to use it as a client.

update-rc.d -f hostapd remove
reboot

Once the system boots back up you will have a "wlan0" device in managed mode.

Scan for a network

ifconfig wlan0 up

# Scan for available networks
iwlist wlan0 scan

In this case I'm connecting to "default" which is an open network:

          Cell 03 - Address: c0:ff:ee:c0:ff:ee
                    Mode:Managed
                    ESSID:"default"
                    Channel:2
                    Encryption key:off
                    Bit Rates:9 Mb/s

To connect to this open network:

iwconfig wlan0 essid "default"

You can use the iwconfig command to determine if you have authenticated to an access point. Before connecting it will show something similar to this:

# iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"default"  
          Mode:Managed  Frequency:2.417 GHz  Access Point: c0:ff:ee:c0:ff:ee   
          Bit Rate=1 Mb/s   Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-34 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

If you are connecting using WEP, you will need to define a network key:

iwconfig wlan0 essid "default" key "yourpassword"

If you are connecting to WPA you will need to use wpa_passphrase and wpa_supplicant:

wpa_passphrase the_essid the_password >> /etc/wpa_supplicant.conf

Now that you have the configuration file, you will need to restart the wpa_supplicant daemon:

ifdown wlan0 && ifup wlan0

The wpa_supplicant is started on ifup and /etc/network/interfaces includes the configuration to automatically use dhcp. It must be changed to automatically bring up the interface on startup:

# Wireless interfaces
auto wlan0 # this needs to be added to automatically ifup the interface
iface wlan0 inet dhcp
        wireless_mode managed
        wireless_essid any
        wpa-driver wext
        wpa-conf /etc/wpa_supplicant.conf

## If you are using a static ip instead:
#iface wlan0 inet static
#        wireless_mode managed
#        wireless_essid any
#        wpa-driver wext
#        wpa-conf /etc/wpa_supplicant.conf
#        address 192.168.0.50
#        netmask 255.255.255.0
#        gateway 192.168.0.1