Advanced Wifi

From WebOS Internals
Revision as of 18:56, 1 November 2012 by Zigi004 (talk | contribs) (extended automatization section + link to wrapper script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This page is about advanced Wifi configurations. You should know some Terminal and Linux for this.

Disclaimer

Most of you won't need this guide as the pre connects to the usual Wireless networks. This guide is for those of you who know what you are doing. This guide comes as is, I have no resposibility if anything happens during using this guide including impact of meteorites and the return of the dinosaurs.

Introduction

Our university uses eduroam for wireless lan access. This is a Enterprise WPA(2) network with TTLS as authentication, featuring an anonymous identity and whatever else. As Palm obviously did not think of working on WPA Enterprise authentication, I had to do it myself. BTW, iOS connects flawlessly.

Connecting

Command line wpa_supplicant

Connection via wpa_supplicant works as follows:

# # kill the running wpa_supplicant
# killall wpa_supplicant
# # start a new one
# wpa_supplicant -i eth0 -D wext -c /tmp/wpa_supplicant.conf
# # obtain IP Adress
# dhclient eth0
# # Some DNS problems may occur, so for testing add google DNS Servers:
# echo nameserver 8.8.8.8 > /etc/resolv.conf

This is everything you need to test connection via wpa_supplicant. For an example configuration read the manpage or check the configuration at the end of this article.

Problem with webOS

Connection via command line works for the system underneath, but you will receive the "No network connection" message when you try to use some webOS internet app without another ( i.e. 3G ) connection.

Solution

We need to "inject" the wpa_supplicant configuration while webOS connects to the network. This sounds somewhat crazy but it works. Create a working configuration and a small script. Also you need some debian packages.

Packages

Go to http://packages.debian.org and download the wpasupplicant packages. You only need the /sbin/wpa_cli binary from there. Also you need the file libreadline.so.6. Download the arm binaries, as this is the architecture of the pre.

Script

Create a script somewhere with the following contents:

#!/bin/bash
cp .wpa_supplicant.conf /tmp
chmod a-w /tmp/.wpa_supplicant.conf
./wpacli reconfigure

You need to be able to execute it quickly.

Testrun

Fire up the Palm Wifi Manager. Click the network you want to connect to. As username/password you need to enter anything, as these won't be used anyway. IMMEDIATELY switch to a terminal on your pre and execute the above script. You may need some tries to get the timing. Afterwards your pre should connect to the network AND think he's connected. Congratulations.

Automatization

While this simple approach may work, it is not an long-run solution. At least on WebOS 2.1.2 process called PmWiFiService injects it's own configuration at random intervals and eventually will mess things up.

So we need a better way to inject our own configuration, and insist on it. Thus I wrote small wrapper wpa_supplicant.wrapper

Installation and usage:

  1. turn off wifi
  2. connect to Your WebOS device and copy original binary file:
    # cp /usr/sbin/wpa_supplicant /usr/sbin/wpa_supplicant.real'
  3. put this file on wpa_supplicant's place and rename it:
    # cp /media/internal/wpa_supplicant.wrapper /usr/sbin/wpa_supplicant
  4. put customized config in /media/internal/.wpa_supplicant.conf or any other convenient place. Remember - passwords are stored in that file.
  5. Update configuration file location in WPA_CONFIG variable
  6. from [1] download package with correct architecture (HP veer uses armel)
  7. extract wpa_cli binary and copy it in place e.g.:
    # cp /media/internal/wpa_cli /usr/sbin
  8. correct permisions:
    # chmod 755 /usr/sbin/wpa_supplicant /usr/sbin/wpa_cli

Instalation is now completed

All networks defined in original wifi application will continue working and can be managed through original interface. Network settings in custom config file will overwrite definitions in built-in application. So for any configuration change in custom networks edit configuration file by Your favorite editor

To use it:

  • first define new network in the configuration file, use any option You wish, use wpa_supplicant config file format:
    • every option on single line,
    • "network={" and "}" and comment also in single line
    best way for now is to export settings from another system
  • then turn on wifi
  • from WiFi Preferences applet select "Join network"
    • enter name of the network You just configured
    • select security type - Open

Enjoy new wifi connection


Sample Configuration

network={
ssid="eduroam"
mode=0
proto=WPA2
key_mgmt=WPA-EAP
auth_alg=OPEN
eap=TTLS
identity="xxxxxxxxxxxxxxx"
anonymous_identity="anonymous@university.xx"
password="xxxxxxxxxxxxxxx"
ca_cert="/home/root/cert.pem"
phase2="auth=PAP"
priority=5
}