Affix on the iPAQ H3870 with integrated bluetooth

Last updated on Wednesday, 01-Sep-2004 08:28:19 UTC.

Note: Even though this page was written with the H3870 model in mind, most of the instructions and tools can (probably) be used to compile and use affix on any other arm based machine (with other bluetooth adapters), eg. any iPaq with a pcmcia/cf sleve and a pcmcia/cf Bluetooth card.

Contents:

Setting up affix

The iPAQ H3870 has an integrated bluetooth radio which can be used with affix. The radio is by default in BCSP mode which affix doesn't support (Update: since version 1.2.1 affix supports BCSP, so the rest of this paragraph is only of interest if you use a version of affix less than 1.2.1) , which means that the firmware of the bluetooth radio needs to be programmed to use H4 mode which affix supports. This can be accomplished with the pskey program (can be found as a package in the familiar distribution). You can find instructions how to do this here (steps 3-6).

At the moment (Jun 20 2002), support for the BT radio on the H3870 is under heavy development, so be sure to get the very latest version of affix that you can find. Update: support is quite stable now, any version after 1.00pre5 should work fine.

If you don't have affix compiled for the ipaq, you can either use my cross compilation environment to compile it (here's an example config.mk file), or the precompiled version. If you decide to compile affix on your own, you will need a linux source tree which is patched correctly for the ipaq (more info to come, meanwhile you can use my linux source tree for the ipaq (25MB)). Note that if you also use my cross compilation environment, you can remove the asm and linux directories from the /usr/local/arm/2.95.3/arm-linux/include/ directory, and make symlinks to your linux source tree (linux/include/asm and linux/include/linux)

To start using the BT radio in BCSP mode (affix version >= 1.2.1) on the ipaq, issue the following commands:

modprobe affix_uart
btctl open_uart /dev/ttySB0 bcsp 230400

If you want to start using the BT radio in H4 mode (affix version < 1.2.1), issure the following command after loading the modules:

btctl open_uart /dev/ttySB0 csr 115200

After this, (if you don't get any errors) the command btctl should show you the bluetooth device information.

To make things easier you can put this script in /etc/init.d/ (and make the relevant symlinks to /etc/rc?.d/) to start affix functionality at bootup, and stop it at shutdown.

For affix version 1.00pre5 or older, you will also need to create a /var/local/obex directory on the ipaq if you want to be able to make obex connections to it.

Restoring windows functionality

If you have changed the radio to H4 mode and want to have it back to BCSP mode (the unlikely case that you want to reinstall windows) start pskey with

pskey -d/dev/ttySB0 -s 115200
and give the following two commands:
0191 03b0 0006 00fa 0014 0004 0000 0004 001e 0064 000a
01f9 0001

Cross compilation environment

I found that there weren't any good cross compilation toolchains out there which would have all libraries which are needed for development on the ipaq (it was quite a pain to get some libraries compiled for arm, eg. glib and xlib). Now that I finally have a working environment, I thought it would be helpful for others struggling with the same problems to distribute it on the web. So here it is: cross-jh.tar.bz2 (39MB).

Contents

Installation instructions

I don't think it matters where you unpack the tarball, but to get the same environment I have, do the following:

mkdir /usr/local/arm
cd /usr/local/arm
tar jvfx /path/to/cross-jh.tar.bz2

After unpacking you will find the compiler and other tools in /usr/local/arm/2.95.3/bin/. If you want to install new libraries to the toolchain, they should go in /usr/local/arm/2.95.3/arm-linux/.

Using the toolchain

The latest versions of affix have nice support for cross compiling. When the affix config script asks you for the cross compilation tools prefix, just enter /usr/local/arm/2.95.3/bin/arm-linux-. I have put an example config.mk file for affix here.

Many programs that use a configure script (created by autoconf) before the actual compilation procedure support a so-called config.site file. If you download this file and make the environment variable CONFIG_SITE point to it before running configure, you should have a much easier time compiling programs.

Programs which need glib or gtk+ can use the gtk-config and glib-config scripts in /usr/local/arm/2.95.3/arm-linux/bin/ to get the correct compiler and linker parameters for cross compiling.

AFE

AFE is a nice gtk+ based frontend to affix made by Jakub Pavelek <jakub.pavelek@nokia.com>. It can be compiled to use a special layout tailored for the ipaq's small screen. To compile it you need to first edit the Makefile in afe/src/ to point to the correct glib-config, gtk-config, affix source directory and your cross compiler. You should also set the EMBEDDED variable in the Makefile to "1" so that the "Pocket GUI" layout is built. Here's an example Makefile that I have been using.
A couple of screenshots of afe running on the ipaq:
AFE Screenshot  OBEX Transfer

Precompiled stuff

If you are have a linux distribution on your PDA which uses ipkg, such as familiar (the sharp zaurus also has ipkg support), you will probably want to use ipkg packages which can be installed by adding the following line to /etc/ipkg.conf:

src affix http://affix.sourceforge.net/feeds/unstable

After doing ipkg update, you can get the list of affix ipkg's with the following command:

ipkg list|grep affix

For everyone else, I have put a precompiled version of affix for the ipaq here (cvs version from Jul 11 2002). A matching kernel (including modules) can be found here. The kernel version is 2.4.18-rmk3-hh12.

Installation instructions (non-ipkg install)

  1. Move possibly existing modules out of the way (mv /lib/modules/2.4.18-rmk3 /lib/modules/2.4.18-rmk3.orig)
  2. Unpack the kernel tarball in the root (/) directory.
  3. Unpack the affix tarball in the root (/) directory.
  4. run ldconfig
  5. make a symlink from /boot/zImage to /boot/zImage_jh
  6. remove any unnecessary modules from /lib/modules/2.4.18-rmk3, as well as the tarballs to free up some space.
  7. run depmod -a
  8. reboot.
Both the normal kernel as well as affix are built against my linux source tree (25MB). Here's the .config. You will also need openobex and libglib1.2 installed to make affix work on the iPAQ.

Copyright © 2002 Johan Hedberg <johan.hedberg@nokia.com>
WEB style by Miklos Quartus <miklos.quartus@nokia.com>

Powered by SourceForge Logo