Logo ©1994-2007 Kevin Boone
My professional interests
Computing
Law
Education
Science and research

My leisure interests
Martial arts
Heritage railways
Garden railways
Motorcycles
DIY

Downloads
Linux downloads
Windows downloads
Java downloads
Perl downloads
Home automation downloads

About me
Home & family
My CV

Site info
Contact the author
Download policy
Keyword index

  Home > Computing > Linux > Archos PMA430 (and other Archos AV) stuff

pma_httpd -- a web server for the Archos PMA430

Last modified: Fri Aug 3 08:43:04 2007

Now with Qtopia installer!

Version 0.01, (c)2004-2005 Kevin Boone, Based in part on mini_httpd v1.96, (c)1995-2003 Jef Poskanzer

What is this?

This is a small, highly simplified HTTP (Web) server for the Archos PMA430. It allows the PMA's contents to be examined and downloaded by a Web browser. pma_httpd also has some PMA430-specific features, including the ability to examine the calendar and to-do list, and play audio files

Installation and startup

Download the installer from here. Copy the installer pma_httpd_0.01_pma430.ipk to the PMA430's Documents directory. Install from the Qtopia application manager in the usual way. You should get an icon labelled pma_httpd in the Applications tab of the launcher.

Ensure that the network link (wireless or wired) is started before trying to talk to the server from a browser.

pma_httpd creates a main window, but the main window doesn't do anything. No user interaction is required, or useful, once the program is running. The main window is only presented at all so you can close the server when you've finished with it (by clicking the `close' icon in the corner of the window).

When executed from the launcher, the server listens on port 80. There is no way to change this at present. If you prefer, you can run the server from the command line, like this:

# /opt/Qtopia/bin/pma_httpd &
A number of command-line switches are available, including settings for security, port number, document root, etc. I will consider adding the ability to configure these things to the Qtopia user interface if there is demand.

Document root and index handling

The document root defaults to /media. If you put an index.html file in this directory (over the USB connection, for example), then that file will be delivered when the browser makes a request for the root document. If there is no index.html, either in the document root or any other reachable directory, the browser will get a listing of directory contents instead.

PMA430-specific features

If your browser issues a request for the URLs /today, /week, /month, or /year, the server will return a list of calendar events that fall within the specified time period. It will also return all the active to-do list entries (regardless of time).
      There is also rudimentary audio support. If you list a directory containing .mp3 or .wma files, these files will have a `play' link appended. If you click this link, the file will be played through the PMA's built-in media player. If the media player user interface is displayed before launching an audio file this way, then the user interface will show the playback progress. If the play mode of the built-in audio player is `folder' or `playlist', and playback is already in progress when you launch an audio file from the web browers, then when the selected file has been played, the media player will move on to the the next file in its own playlist. If the user interface is not displayed, playback will be entirely in the background.

CGI support

pma_httpd has rudimentary CGI support. Any file that contains the string `.cgi' in its name will be executed as a CGI script when requested by the brower, and the output of the script routed back to the browser. This can be quite a handy way of running scripts on the PMA430, as its built-in file browser has no mechanism for doing so (as far as I know). The usual rules apply: the script must output the string content-type:text/plain (or whatever the content type is) as its first line, followed by a blank line. Please bear in mind that the script gets only a minimal environment, so don't assume that variables like PATH or QTDIR are set to anything.
      Here is an example of a script which enables an external USB mouse. If you put this script somewhere on the PMA's media area, and navigate to it using a browser, you can click it to enable the mouse.
#!/bin/sh
echo content-type:text/plain
echo
                                                                                
export LD_LIBRARY_PATH=/opt/Qtopia/lib
export QTDIR=/opt/Qtopia
/opt/Qtopia/bin/qcop 'QPE/System' 'setMouseProto(QString)' 'IntelliMouse:/dev/inecho Mouse switched on

Differences from the original mini_httpd

The original mini_httpd program was very simple, and pma_httpd is even simpler, to reduce its memory usage to the absolute minimum.
  • There is no htpasswd (directory-level security) functionality at all. I have removed the executable and all the code in mini_httpd that processes .htpasswd files. Instead, one user ID and password applies to the entire server, and these credentials must be specified on the command line -- no user interface configuration is possible at present
  • No configuration file is processed.
  • SSL is not supported at all (the necessary infrastructure does not exist on the PMA430)
  • The document root directory defaults to /media, rather than the current directory. Under Qtopia, current directory is something of a meaningless concept.
  • No log files are written

Bugs and limitations

Here are the most obvious ones.
  • When pma_httpdprogram is closed, any current media playback will stop, whether playback was launched from this program or otherwise. This is because the program has no way to tell whether it launched the playback or something else did. Because playback might be in the background, if this program did not stop playback on exit, you could be left with content playing that cannot be stopped.
  • The fact that this program does not raise the media player's user interface, if it is not already visible, is not really a feature. It is an odd consequence of the way the Archos multimedia API works.
  • The processing of the PMA's PIM data is crude. Certain types of data will confuse it. I haven't done much to deal with unusual cases (such as calendar events that start at the end of the year and wrap over onto the next year).
  • USB synchronization might not work properly if pma_httpd is running when the USB cable is connected. This is a peculiarity of the way that the Qtopia sync mechanism works.
  • No icon is displayed in the Qtopia taskbar. If you switch away from this program and want to switch back, you'll have to use the icon in the launcher. This won't start another instance of the program if one is already running. I don't know why this is -- this program isn't written or packaged any differently from others I have produced.
  • Error messages are in English only. But since you can't see them anyway (unless you run the program from the prompt), that may not be a problem it itself :)
  • There is no way to manipulate the playlist of the built-in media player using this application, nor any one to play more than one file. Archos has not documented how to do this from an application.

Legal stuff

pma_httpd is distributed according to the GNU Public Licence. In short, you may do whatever you wish with this code, provided that the original authors continue to be acknowledged, and the original source code is made available.

   
Search

WebThis site

Shameless plug

By the author of this site. Buy on-line from Amazon USA | UK

Editorial
So you want to be a university lecturer? Read this first!

Speak like your boss: new developments in managerese

Computing features
File handling in the Linux kernel: an in-depth look at how Linux handles files, filesystems, and file I/O

All sorts of Linux stuff

Confused about CLASSPATH? answers are here

First steps in EJB using jBoss (recently revised for jBoss 3.2)