Introduction to Hamlib
When browsing through the owners manual of that new radio, the pages
devoted to the computer commands seem like an afterthought. While the
manufacturers are not interested in becoming software houses, they do
adequately document the computer control capabilities which allow
independent control software to be written. With the myriad possibilities
of radios and manufacturers available, writing that ultimate logging or
PSK31 application can be a daunting task if even basic
radio control support is desired. The Ham Radio Control Libraries project
aims to develop a solution to this problem.
Overview of Hamlib
Hamlib itself is not an end-user application for radio
control. Rather, it is a collection of libraries, both shared, or
dynamic linked libraries, if you will, and static libraries that
provide end-user applications with
a common means of acessing and controlling radios (and perhaps other
ham radio related peripheral devices in the future) directly connected
to a computer or remotely over a network. Hamlib is currently being
developed on the Linux operating system, but plans include it being
usable on various flavors of UNIX and
Windows, or whatever platform GNU autoconf
will support.
Hamlib consists of several parts. The application programming
interface, API, shared library is
libhamlib-&curver;.so which is installed in
/usr/local/lib by default.
For ease of use when linking,
libhamlib.so is provided as a
symbolic link to the latest version of Hamlib installed. Of course,
the installation directory may be changed by passing the proper
option to the configure script in the base
directory of the source distribution. While the static library is
libhamlib.a and installed in /usr/local/lib as well.
The second main part of Hamlib consists of a number of
"backend" libraries each able to communicate to a specific radio.
For example, libhamlib-ft747.so is the shared
backend library that provides Hamlib access to the Yaesu FT-747
radio. By default the backend libraries are also installed in
/usr/local/lib. Both shared
and static libraries are provided by the default
installation.
Hamlib is Free Software
The Hamlib libraries are Free
Software licensed under the GNU Public License, GPL,
version 2. It is important to be aware that use of Hamlib in a
proprietary program has severe restrictions placed on it by the
GPL. As a result one must carefully consider
what kind of license to use for your program. Of course we
encourage using the GPL for your program as it
adds to the pool of available Free Software to the ham
community.
The advantages of Free Software are multitude, but the primary ones
include accessability of your code to others who can fix problems or
add new functionality. Another advantage is that your code is
always available to be studied by other experimenters and your code
has a much lower chance of becoming dead bits that can't be used on
newer operating systems. For an experimenter's hobby like ham
radio, Free Software offers many more advantages than disadvantages
to you and the ham community.
Hamlib development resources
If you are interested in working on Hamlib development itself,
there exist a few resources on the World Wide Web. The main project
page is at http://sourceforge.net/projects/hamlib/.
A homepage is currently in development at http://hamlib.sourceforge.net
A development mailing list is hosted by http://sourceforge.net. Subscription information and an archive
can be accessed through the Hamlib project main page.
Getting Hamlib
At this time Hamlib is not included as a binary package in any
major distribution that we're aware of (hopefully this will change
soon). Until then you may retrieve the source from the Hamlib project
page at http://sourceforge.net/projects/hamlib/.
Latest stable version
The latest stable version is &curver;. Currently the project is
in its early stages and only a few backend libraries are included.
Hamlib is currently in heavy development.
Latest development version
The latest development code is available via anonymous
CVS through the
project
page.
Accessing anonymous CVS
The following instructions are copied from the
Sourceforge website
(modified with hamlib in the right places) and did work for me.
Anonymous CVS instructions
Hamlib's SourceForge CVS repository can be checked out through
anonymous (pserver) CVS with the following instruction set. When
prompted for a password for anonymous, simply
press the Enter key.
myhost:~/src $ cvs -d:pserver:anonymous@cvs.hamlib.\
> sourceforge.net:/cvsroot/hamlib login
myhost:~/src $ cvs -z3 -d:pserver:anonymous@cvs.hamlib.\
> sourceforge.net:/cvsroot/hamlib co hamlib
Working with long commandlines
Long commands like those above are difficult to work with
because once the line wraps the bash(1) shell
seems to start doing weird things. The trick is breaking the line
into two (or more) parts with the \
character.
When the right edge of the screen is reached simply add
\ to the end of the text you are typing and
then press
Enter. You will receive a >
from bash(1) and you may continue typing the
command. If there is no space character in the command you are
typing, be sure you don't add a space before the \
or at the beginning of the next line. If you break the line where
a space would exist in the command, either putting the space before
the \ or at the beginning of the next line.
bash(1) will splice the lines together to form one
command once it receives a Enter character not
preceded by a \.
Updates from within the hamlib directory do not need the
-d parameter.
If you get the following error:
cvs login: failed to open /home/user/.cvspass for reading:
No such file or directory
cvs [login aborted]: fatal error: exiting
You can probably solve this by using the touch
command to create the file .cvspass in your home
directory:
myhost:~ $ touch .cvspass
Building Hamlib
Building Hamlib from source isn't as daunting as it may seem
at first, thanks to GNU autoconf, a tool used by
the developers that generates the configure
script found in the base directory of the source distribution.
Running configure will test your system to be
sure that any required packages for building Hamlib are present.
While configure checks for many components, the
only critical dependency is that the C library development header
files are installed. Of course, you'll need a C compiler and its
associated libraries.
Unpacking the source archive
While my favorite method of unpacking
.tar.gz files is to use the Linux version of
the Swiss Army Knife, Midnight Commander, the instructions
provided are for using tar at the command
prompt.
Using tar to extract the archive
The first order of business is choosing a location for the
source distribution. Some may choose to place the archive under
/usr/local/src, or may
prefer to work within their home directory. The disadvantage of
working in /usr/local/src
is that one must either be logged in as root or
be a member of a group such as staff that has
write permissions on the directory. The advantage of working in
one's home directory is that writing and deleting files can be
done with much lower risk of damage to the system areas of the
filesystem. Either way, you will need to be logged in as
root to install the libraries after compiling.
On with unpacking the archive.
For this example I will make a few assumptions, the archive
is downloaded and stored in ~/Download
and the source distribution will be installed in ~/src.
Interpreting ~
If you are new to UNIX type
systems, you may be puzzled just what ~
prepended to a path name means. It is simply a short hand for
your home directory. If your user name is
fred, then ~ refers to
/home/fred on most
systems, of course there are exceptions. If you are logged in
as root then ~ refers to
/root.
The following sequence of commands will get the Hamlib
archive to the right place (substitute your paths in the
examples). First we'll move the archive into the directory where
it will be extracted then use the tar command to extract the
archive into its own directory.
myhost:~ $ mv Download/hamlib-&curver;.tar.gz src
myhost:~ $ cd src
myhost:~/src $ tar xvfz hamlib-&curver;.tar.gz
Now you should have a directory called hamlib-&curver;
in the directory you executed the tar command.
This would be a good time to familiarize yourself with the files in
the archive.
Compiling Hamlib
Thanks to the clever design of GNU autoconf
compiling Hamlib is as easy as running:
myhost:~/src/hamlib-&curver; $ ./configure
The configure script checks for the presence of
the proper development files required to build Hamlib. After the checks
configure then creates the Makefiles from the
included templates in the archive. The next step is to compile
Hamlib:
myhost:~/src/hamlib-&curver; $ make
Now there should be considerable output to the screen during
the compile process. The main thing here is to make sure that
gcc doesn't fail while reporting an error. The most
common failure is a message saying that a certain file cannot be
found. Most likely the named file will have a .h
extension which means the development files of a required library
aren't installed on your system. As of this writing only the glibc
development files are required.
Summary
Hamlib is a tool for software authors wishing to take advantage of
the computer control capabilities of modern transceivers and other
devices used around the radio shack. When Hamlib reaches maturity
it will likely be available in your favorite packaging format and
manually compiling it won't be necessary unless you wish to customize
Hamlib itself.
The remainder of this manual assumes a working knowledge of
UNIX type systems. If you are new to Linux,
I suggest getting a copy of Running Linux by O'Reilly and Associates
from your local bookstore. You can preview this excellent reference
on the Web at http://www.oreilly.com/catalog/runux3/.