Wifi networking in the 'improved Angstrom' distribution for Archos 5/7

This page describes the design decisions that underlie the WiFi networking support, and explains how it is intended to be used by end users.

Please note that this is a first attempt at WiFi support, and there will inevitably be problems with it.

Design decisions and limitations

  • There is configuration support only for wireless networks with dynamic configuration using DHCP. For wired networks and static configurations, we assume the user knows how to do manual configuration
  • There is configuration support for WPA encryption. Support for WEP is limited at present, but might be improved if there is a demand for it
  • Consequently, we will use wpa_supplicant and its configuration utility wpa_gui to do most of the work. Any kind of networking that can't be managed by wpa_supplicant won't be supported (although, of course, manual configuration remains possible for sophisticated users)
  • Enabling and disabling the WiFi services is an administrative operation. In the longer term, it might be possible to implement some sort of on-demand management system but for now we will make do with on' and off' buttons.
  • If the user suspends the unit, that amounts to an instruction to shut down WiFi services. This is the case even if the unit is dock-powered, when it can't actually be suspended. We can still switch off the display and the WiFi
  • Because there is no on-demand management of the WiFi, we assume that if is enabled, it has been enabled by the user, and for a purpose. Therefore, the unit won't suspend when the user interface appears to be idle so long as the !Wifi is up. The rationale here is that the user might be downloading a large file, or interacting with the unit over a VNC session, or just streaming music. In all these cases the unit will appear to be idle, so far as its user interface is concerned.
  • The configuration system should retain users' network preferences. It should not be necessary to run the configuration often.

Operation

To set up a network connection for the first time, this is the sequence of operations that should work.

  • Raise the archos-helper GUI, by pressing the power button or from its icon on the desktop
  • Select the !Wifi tab
  • Click 'Enable Wifi'. You must do this before trying to configure -- the configuration GUI requires services to be running.
  • As soon as the 'archos-helper' app reports that services are running, click the 'Configure' button. Don't wait for the GUI to indicate that connection has got any further because, of cource, it's can't -- it's unconfigured
  • When the configuration GUI appears (this could take a while -- please be patient) click the 'Manage networks' tab, then 'Scan' (unless you want to enter all the settings manually).
  • Double-tap the desired network (this may need a few goes -- it's a bit fussy about how fast you tap), and fill in the passphrase, etc. You'll need to raise the virtual keyboard, unless you have an external keyboard plugged in.
  • Wait for all the WiFi magic to happen

If everything is OK, the screen should look something like this:

Note that the presence of an IP number in the archos-helper GUI is the signal that you're ready to rock.

Unless you're changing networks you should not need to configure again. Settings should be retained. Just click `Enable WiFi' and wait for the IP number to appear.

For power saving purposes, when you disable WiFi it's really off -- powered right down.

Caveats

Please read this before trying it! This is important!

  • The configuration GUI is based on Qt4 and is slooooooow to start up. The utiltiy itself is very small and straightforward -- but Qt4 is not. When you click the `Configure' button, please allow 20 seconds for the GUI to appear. Hopefully, configuration should be only an occasional need
  • When the WiFi service is up, the unit will not suspend to RAM even if it appears to be idle. This is intentional (see discussion above)
  • You'll probably have to end WPA passwords, etc., using the virtual keyboard. It is easy to make mistakes, especially as characters are not displayed on the screen. If you do get a password wrong, the archos-helper GUI won't tell you -- it will just not connect. The configuration GUI will say that something is amiss, but its messages tend to be cryptic. Treat any message about 'handshake' as likely to indicate a bad key (or a bad authentication method).
  • The WiFi service may well behave badly if you try to stop it and start it at the same time, or start it whilst it's already running. The GUI tries to prevent this happening, but it's not foolproof. Please be patient -- even when a network is properly configured, it can take 10 seconds to establish a connection fully on some networks.
  • !Wifi will shut down automatically if you tell the A5 to suspend. When it wakes up, any apps that were using the connection, and which you didn't close, will most likely have to be restarted.
  • The DHCP client can be a bit erratic directly after waking from suspend. If the connection process appears to get an ESSID but not an IP number, it's probably worth disabling and re-enabling.
  • At present the WiFi radio runs at full power when it's on. In the longer term, it will be necessary to investigate what power saving measures can be implemented when its on that don't badly affect range and bandwidth. But for now, bear in mind that its on full power, and that will have some impact on battery life.

Implementation details

WiFi services are managed by wpa_supplicant. DHCP is implemented by udhcpc. A script /etc/init.d/wifi starts and stops these daemons, as well as initializing the driver (which is more complicated than it ought to be be).

archos-helper should not run as root, but wpa_supplicant has to run as root. Because it runs as root, the configuration GUI wpa_gui also has to run as root (or by a user in a specific, privileged group). Consequently, we need sudo for archos-helper to able to raise and lower WiFi services, and to run the GUI. The icon for wpa_gui on the desktop also uses sudo. So, in short, you need sudo configured such that all users can run /etc/init.d/wifi and /usr/sbin/wpa_gui. Please don't try to make archos-helper run as root -- it is not designed for it, and weird things will happen.

The archos-helper GUI does not run any scripts directly. Instead, it communicates with the archos-helper daemon, which runs the scripts as well as some other stuff. Similarly, the GUI does not query the network status itself -- it relies on the daemon knowing that information. In practice the daemon assumes that network services are running if it can see the socket /var/run/wpa_supplicant/eth0. I can envisage circumstances where failures could leave this file even though wpa_supplicant is not running. In that cases you'd need to delete the file or reboot.

Attachments