TS-4900 yocto wifi: Difference between revisions

From embeddedTS Manuals
(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...")
 
No edit summary
Line 54: Line 54:
</source>
</source>


Now that you have the configuration file, you will need to restart the wpa_supplicant daemon:
Now that you have the configuration file, you will need to start the wpa_supplicant daemon:
<source lang=bash>
<source lang=bash>
ifdown wlan0 && ifup wlan0
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
</source>
</source>
The wpa_supplicant is started on ifup and /etc/network/interfaces includes the configuration to automatically use dhcpIt must be changed to automatically bring up the interface on startup:
 
Now you are connected to the network, but this would be close to the equivalent of connecting a network cableTo connect to the internet or talk to your internal network you will need to configure the interface.  See the [[#Configuring the Network]] for more information, but commonly you can just run:
<source lang=bash>
<source lang=bash>
# Wireless interfaces
dhclient wlan0
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
</source>
</source>

Revision as of 18:04, 13 April 2015

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 start the wpa_supplicant daemon:

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

Now you are connected to the network, but this would be close to the equivalent of connecting a network cable. To connect to the internet or talk to your internal network you will need to configure the interface. See the #Configuring the Network for more information, but commonly you can just run:

dhclient wlan0