9. Using Your New System

Once your psion boots into linux, you have a basic, functional linux system. This section discusses some of the more useful things you can do, or get set up, as they might pertain to OpenPsion, but this document is not meant to be a tutorial on linux - in other words, if you have a specific problem, or task you want to do, you might consult the linux literature (man pages, HOWTO's, etc.) on the issue.

9.1. Mounting /proc and Compactflash Partitions

If your compactflash partitions are not mounted automatically, you can mount them:

mount -t msdos /dev/hda1 /mnt/disk1
mount -t ext2 /dev/hda2 /mnt/disk2
where /mnt/disk1,2 are used as examples of places where you might mount these partitions. If the above actions do not happen automatically for your system, you could set up those actions to happen at bootup using an /etc/rc.d file of some sort.

You can also do dmesg to see the system messages, or perhaps more primitively: dmesg < /mnt/dmesg.txt.    cat /var/log/messages can also be useful and fun to take a look at, assuming system logging is set up.

9.2. The Keyboard and Setting Keys

The keyboard is same as for Psion 5.

Keyboard features. The Psion keyboard is very different from the standard PC keyboard. At the moment, the flavor of linux kernel you download sets the type of keyboard (UK, US, or DE). We use the following special key assignments (UK keyboard):

Table 1. Psion and PC Keys

PCAltGrAlt|` (backtick)Alt-F1 (VC1, etc.)SysRqRebootBacklight on/offPower on/off

Changing these default keys using the "loadkeys" and a keymap file might make these special keys inoperable (the newest kernel has supposedly fixed that). "dumpkeys > filename" will dump out a set of key mappings that you can take a look at. "loadkeys filename" will then load in that keymap (with whatever modifications you have made to it). You have trouble saving your special keys functionality, you can comment out or delete the lines for the special keys (e.g., the space key) to preserve their special functions (e.g., the backlight).

The Shift, Ctrl, Alt, and AltGr keys are "sticky" by default. They behave as illustrated in the following example:

Table 2. Key Behavior

Shift down, up, AaAA
Shift down, up, down, up, Aaaa
Shift down, A, A Shift upA AA aA A

"Fn M" or "Fn ." will lighten or darken the screen as for EPOC (although there seem to be lingering problems with the screen colors (or video modes).

The psion will likely start several terminals that can be selected using "Menu 1", "Menu 2", etc. You can go back and forth between the various screens at will, and so multiprocess (unlike Windoze).

9.3. Setting the Font

You can change the font and font size using the "consolechars" program (assuming your system has this installed). (I find the default fontsize to be too small.) The fonts are in the "/usr/share/consolefonts" directory. For example,

consolechars -f default8x9
consolechars -f default8x16
consolechars -f lat4u-19
will change the font to increasingly larger sizes, and
consolechars -d
will change to the default font. Each console has to be set independently. You might set your favorite font in your ~/.profile file.

9.4. Setting Framebuffer Depth

Use fbset -a 2bpp, fbset -a 4bpp, or fbset -a mono to set the framebuffer depth. In earlier kernel versions, the colormaps of the framebuffer still needed fixing, so that the system default is 4bpp, appeared to be faded. A work around was to change to 2bpp, but you'd be better off upgrading your kernel. (lynx seems to work better in mono.) To change the framebuffer depth, you must have the file /etc/fb.modes configured. This file might consist of:

  #Video modes for Psion 5mx

   mode "default"
  # D: 3472.222 MHz, H: 5425.347 kHz, V: 22605.613 Hz
   geometry 640 240 640 240 4
   timings 288 0 0 0 0 0 0
   grayscale true

   mode "4bpp"
 # D: 3472.222 MHz, H: 5425.347 kHz, V: 22605.613 Hz
   geometry 640 240 640 240 4
   timings 288 0 0 0 0 0 0
   grayscale true

   mode "2bpp"
 # D: 3472.222 MHz, H: 5425.47 kHz, V: 22605.613 Hz
   geometry 640 240 640 240 2
   timings 288 0 0 0 0 0 0
   accel true
   grayscale false

   mode "mono"
 # D: 3472.222 MHz, H: 5425.347 kHz, V: 22605.613 Hz
   geometry 640 240
   640 240 1
   timings 288 0 0 0 0 0 0
   accel true
   grayscale false

9.5. Pointers and Things that Work

RESET. The screen can be refreshed by typing "reset". A "reset" can sometimes be very effective at curing what ails your psion.

BC/DC bc is a simple line calculator type thing - try man bc. dc is similar, but more reverse polish like. Calculate pi to arbitrary many decimals; if that isn't useful, what is?

EDITORS. In the editor department, OpenPsion is still rather limited. vi (vim) certainly works, as does zile, a slimmed-down emacs clone (emacs itself could be installed, if you wanted to use the diskspace for it). However, the touchscreen is does not work for any of the console editors, so you can't point and click your way along with an editor. X is now supported supported, however, together with the touchscreen and all of the X applications, including more advanced editors.

COMPILERS. The *.deb files for the compilers gcc, g77 can be installed and they work o.k., although a little slowly. You need available disk space to install these.

REBOOTING. One can now easily reboot the psion without having to use the paper clip to press the secret button for a hard reset. "Ctrl Menu Del" or shutdown -r now will both probably work, and properly (maybe... at least it can be set up to work properly) shutdown the linux system. NOTE that you will lose everything from memory on the EPOC side of things - all of your set up parameters, serial port settings, the date and time, etc.

USING LYNX. lynx, a simple terminal-based web browser, seems to be set up to use colors which are not available for the psion. I tried to set things up in /etc/lynx.conf so that the colors are black and white. You can also change the frame buffer color depth to "mono" using fbset -a mono. lynx may work better with mono. You can browse www.nytimes.com and download a package or two from ftp.debian.org. Also check out: The BBC News PDA Page. Also check out the browsers that work in X.

X. The X window system can now be installed on the 5MX - see the section on X11 in this HOWTO. Installation of X brings with it all of the X applications.

PRINTING There is nothing to stop you from installing the lpr package, setting up the PPP network connection to the desktop computer (see below), and then setting up network printing through the desktop. This will require running the lpd printer daemon, and setting up the /etc/printcap file. With this you can print from your psion to the printers that are connected (local or network) to your desktop computer.

However, a simpler way to print a file is: dd if=filename | rsh desktop 'lpr -'. Perhaps better for a 115200 baud connection: gzip -c filename | rsh desktop 'gunzip -c | lpr -' Or perhaps gzip -c filename | rsh desktop 'gunzip -c | enscript --filter-stdin=-' (and so forth...).

9.6. /etc Adjustments

Most of the configuration of linux is set up in the /etc directory. If you have disabled passwords, be sure the /etc/pam.d directory does not exist, or you will have to use a password. Check out your /etc/rc.d and /etc/inittab files. Also cron files are there; cron works fine, assuming your clock is set correctly. You may also have a /etc/halt file that gives to procedure for shutting down the system.

9.7. /proc Adjustments

There are a number of useful setting in the /proc directory tree. These allow you to set various screen or power configurations. The /proc/cpuinfo file shows the cpu type. The directory /proc/psionw has files particular to the 5MX:

backlight case contrast cpu lcd mains powerhook sleep state uart1 uart2
which can be used to list or set various states of the 5MX.

Some of these files can be used to set the degree or amount of things: The sleep file can be used to set the number of seconds of idle before the 5MX turns itself off: echo 600 > /proc/psionw/sleep. While echo 60 > /proc/psionw/contrast sets the contrast.

Some files can be used to turn things on or off: backlight or lcd can be set to 0 or 1 for "off" or "on", respectively.

While other files just report the state of things: mains is 0 or 1 depending on if the external power is connected or not. I suppose uart1 (ttyAM1) and uart2 (ttyAM0 - IR) are the same way - 0 or 1 if they are off or on; case is 1 if open, perhaps.

The powerhook file is a new addition to the kernel. A path to an executable can be entered into this file which will then be executed when the 5MX goes to or from sleep. The executable obtains a single flag, either 0-sleep, or 1-wakeup. This executable can be used for, e.g., checking the battery status or alarm settings. As an example,

echo "/etc/powerhook.sh" > /proc/psionw/powerhook
will enter the script powerhook.sh to be executed at sleep and wake up. This script might look like:
# /etc/powerhook.sh
# $1=0 Power off
# $1=1 Power on

if [ $1 -eq 0 ]; then #Power off
  #Here is place to set /dev/rtc to wakeup

  #Real poweroff
  echo 0 > /proc/psionw/state
else #Power on
  #Battery check
  if [ -f /proc/apm ]; then
    P=`cut -d" " -f7 /proc/apm`
    if [ $P -le $BATT_LOW_TRESHOLD ]; then
      echo "Battery low $P%" | wall

  #Here is place to wakeup your remainder/calendar prog
Which will check the battery status at wakeup and give a warning if the battery is low, and also run the script of your choice at wake up as well (such as play a sound to wake you up, or start the coffee pot).

The cpu file reports cpu frequency - I gather this was meant to set the cpu frequency (for over or underclocking...), but it doesn't seem to work.

Is there a setting for the time idle seconds before auto-off of lcd or backlight? I don't know...

The 2.4.27 and later kernels include a way to read battery status. Just cat /proc/battery to see the status (this has recently been moved to /proc/psionw). One could set up a script that can runs regularly to check the battery and give a console warning about an impending low battery.

Then there is /proc/sys/vm/laptop_mode which is usually set to 0. There are a number of webpages concerned with setting this to 1, and other options for power savings on laptops - is this of any use on a 5MX? Dunno.

The /proc/apm file was added to the 5MX kernel to provide compatibility with existing tools. The plan may have been to provide the same output as i386 /proc/apm to enable regular APM monitors to work on the Psion. However, since /proc/apm really only shows voltage-level (used above for powerhook), some "smarter" energy handling code would be nice. I think this was discussed on the mailing list a few years ago. As shown above, the small script

  P=`cut -d" " -f7 /proc/apm`
  echo "Battery level is:  $P%"
will display the battery level using the readings in /proc/apm.

9.8. Keeping Time Between Reboots

The resetting of the clock with every reboot is particularly annoying. With every reboot the psion's time get sets back to 1 January 1999 at 5 pm. There might be a way of writing the time to a file that would be written at shutdown and read at boot up by both the psion and linux; you might lose a few seconds with every reboot, but that would not be too bad. Work is in progress on this issue. You can read some notes on this subject, including a crude system for keeping track of the time when rebooting between EPOC and linux at this timekeeping page. The page includes a couple of OPL programs for writing system time to a file in EPOC, as well as setting the system time from a file. There is also an awk script that will let you set the linux system time interactively, rather than try to remember the esoteric date format.

9.9. The Real Time Clock, /dev/rtc

With a kernel that supports the 5MX's real time clock, you can access the hardware clock and its alarm. The alarm is useful because it lets you set a time when the 5MX will wake up from sleep and do something like sound an alarm (see the section on sounds). The traditional way to access the hardware clock's time is using the utility hwclock. N.B.: the Debian Sarge hwclock utility doesn't seem work, while the old Woody version does. The download "alarms.tgz" contains this Woody binary.

One simple C program for setting the alarm is called rtc.c (a quick and dirty, but functional, cut and paste job), which you can download from: alarms.tgz (includes sound samples, source code, ARM binary for rtc.c, and alarm scripts). The program sets the alarm and then waits for the alarm before completing. So you can have a script:

  rtc hour:minute  [or "rtc +hour:minute" to have an alarm hour:minute later than the present time.]
  play a sound
And so get an alarm to go off at hour:minute. And yes, it wakes up the 5MX if you turn it off! It is best to synchronize hardware and system clocks to the same time, and to the same UTC or local time (the real time clock is set to UTC by default).
  hwclock --localtime --systohc
will synchronize the two clocks. To see the settings of the real time clock:
  cat /proc/driver/rtc 

A similar utility to rtc.c is available in the Debian apmd package ("apmsleep"), but that comes with a load of apm baggage. I couldn't find a simple utility for setting an alarm.

One issue with the rtc is that it does not account for the change in date when midnight is crossed. So the alarm may not sound if midnight occurs between the time the alarm is set and the expected wakeup time. A workaround is to first set a wakeup just before midnight, and then reset the alarm to the correct wakeup time after midnight is passed. The alarms.tgz tarball has a script "setalarm" that performs these steps.

9.10. Installing New Packages

New *arm.deb or *.ipk packages can be installed on your psion, depending on if your system is based on dpkg or ipkg. So if you want to install the package mdate_1.0.1-3.deb [a utility for reporting Mayan dates] first get the package from debian.org, making sure it is an ARM binary, copy it to the psion, and execute dpkg -i mdate_1.0.1-3.deb. Remove it by dpkg -r mdate. In some cases, the distribution builder has hacked out large elements of the dpkg system to better compact the distribution, and dpkg will complain, sometimes failing to install things altogether, or installing the binaries but failing to configure things. In the former case, you can manually make whatever file or directories are missing and try to procede that way (i.e., put on your hacking cap.) In the latter case, you have probably successfully installed the binaries, so what are you complaining about? dpkg will also install a great deal of metadata - you may want to find this stuff and delete it to save on disk space.

Distributions based on "Debian Woody" are also "testing" distributions, and so some installations will fail because elements of the distribution (e.g., the libc library) are old. In that case, you have to go about installing or updating the missing elements. Updating can be like a plate of spaghetti. But it also may be a piece of cake.

In most cases, however, new packages will install with little trouble.

Installation of packages with apt-get will work, if a swap space of size ca. 64MB is temporarily set up for additional memory. It is very slow, but it works o.k.

One problem is that dpkg tries to read the file /var/lib/dpkg/available completely into memory. Because the 5MX has only 16 MB memory and /var/lib/dpkg/available is about 11MB, dpkg doesn't have enough memory to do this job. Swap space can resolve this issue somewhat, but it is very slow - sometimes resulting in mere disk thrashing. One solution to the problem is:

mv /var/lib/dpkg/available /var/lib/dpkg/save.available 
touch /var/lib/dpkg/available
The available file contains the packages available from Debian, so removing it disables apt-get. The status file is more important, and contains the status of your system, and cannot be rebuilt. The available file can be cleared and rebuilt with:
dpkg --clear-avail
apt-get update

So, putting it altogether, perhaps the optimal procedure for installing a package is to use the "-d" option for apt-get, which is to download the package and its dependencies only. Then, after downloading is complete, rename the /var/lib/dpkg/available file to something else, and create an empty replacement file as above. Then, cd to /var/cache/apt/archives/, and execute dpkg -i *.deb to install the new downloaded *.debs. Then, clean up the downloaded files with apt-get clean and restore the available file. A simple bash script, called, e.g., dpkginstall, to perform these steps (copy /var/lib/dpkg/available to /var/lib/dpkg/save.available before trying!):

echo "Turning on swap"
swapon -a

echo "Getting the packages"
apt-get -d -y install $1

echo "Shuffling available"
rm /var/lib/dpkg/available
touch /var/lib/dpkg/available

cd /var/cache/apt/archives/
echo "Installing packages"
dpkg -i *.deb

echo "Turning off swap"
swapoff -a

echo "Cleaning packages"
apt-get clean

echo "Copying back available"
cp /var/lib/dpkg/save.available /var/lib/dpkg/available
Execute the script with dpkginstall foo to install package foo. Worked well for me.