Please note: this page was mirrored from http://bigbang.vtc.vsc.edu/fmradio/fmlinux.html

 

Installing the Linux device driver

Note:

The Aztech/Packard Bell driver is now included in the standard Linux kernel tarball, as of kernel 2.1.105! (We found out kind of late...) This means that it will probably end up in (non-experimental) kernel 2.2 as well, and therefore be in every linux distribution! Hooray!

Much thanks go to rkroll@(no_spam)exploits.org (remove the "(no_spam)") for cleaning up the code, porting it kernel 2.1, and making it conform to the new standard TV/Radio tuner API. He did a lot of work, essentially re-writing the whole driver based on our tuning code. Thanks so much, Russell! See his website at http://aztech.exploits.org/.

You can still use the driver found here for kernel 2.0.x.



The Easy Way

We have precompiled a loadable module that you may be able to use. The easiest way to find out is to try it. NOTE: This could potentially crash your machine (maybe). Don't try it on a machine that is actually doing something useful (like your web server).
    First, download the Radio Card driver here (USA). Uncompress the archive.

    Type:

    insmod radio.o
    If it says "Aztech Radio Card module loaded" or something like that, then it probably worked. You should hear sound from the card and everything! However, you will have to do this each time you reboot, so it's probably best to find a permanent home for radio.o (/usr/src/linux/modules may be a good idea), and put the above command in an rc file somewhere.

    Go to your /dev directory, and create a special file for the radiocard. Since the module uses major number 39 (minor 0), use the following command:

    mknod radiocard c 39 0
    Note: The module was compiled under the following conditions (this may be useful for you to know):
  1. Try the card!

The Not-So-Easy way.

    First, you need the Linux kernel source and the Radio Card driver distribution. Uncompress your linux kernel source. The best (and most popular) to place it is in /usr/src.

    Un-gz and un-tar the driver distribution. Uncompress them anywhere, and move the file radio.c to your /usr/src/linux/drivers/char directory, and the file radio.h in the /usr/src/linux/include/linux directory.

    Edit the file /usr/src/linux/drivers/char/Config.in. This file tells linux what to ask when you do a make config. You need to tell the kernel makefile to ask about the radio card.

    Add the following near the end of this file (just before the endmenu ):

    tristate 'Aztech/Packard Bell FM Radio Card support' CONFIG_AZRADIO
    Edit the file /usr/src/linux/drivers/char/Makefile. This is the Makefile for all of the character device drivers. By adding the radio driver to this file, you ensure that the driver will actually be compiled and linked into the kernel, or that a loadable module will be properly generated.
    Add the following to the file. Place it somewhere where it looks like it should go. Traditionally, I place it right after the endif closing off the FTAPE block, but it could go anywhere in that section:
      ifeq ($(CONFIG_AZRADIO),y)
      L_OBJS += radio.o
      else
        ifeq ($(CONFIG_AZRADIO),m)
        M_OBJS += radio.o
        endif
      endif
    Edit the file mem.c. This file contains a function that is called by the kernel when booting. Placing the initialization function in this file makes the kernel initialize the card at boot.

    Add the following to the end of the file, but before the return 0; :

      #ifdef  CONFIG_AZRADIO
              radio_init ();
      #endif
    Edit the file /usr/src/linux/include/linux/major.h. Look for an unused major number. We use 39, for reasons I don't remember. If you choose to use this number (if it's not used by something else, go ahead), add this line where number 39 would go:
    #define AZRADIO_MAJOR    39
    If you set up your card to use port $358 instead of the default $350, you will have to make a small modification to /usr/src/linux/drivers/char/radio.c. Find the following line in the file:
    #define RADIOPORT       0x350
    and change 0x350 to 0x358.

    That's almost everything! At this point you should try compiling your kernel (make config, make xconfig, etc.). If it gives no errors, install your new kernel and reboot.

    Now, you've rebooted and all is well. Go to your /dev directory, and create a special file for the radiocard. If you used major number 39, use the following command:

    mknod radiocard c 39 0

Try it out!

You should now be able to tune your radio card by something similar to the following:
echo 106.1 > /dev/radiocard
As you probably guessed, this tunes the card to 106.1 MHz. Use a similar command to tune your favorite station.
echo {command} > /dev/radiocard
Commands
stereo allows stereo tuning if possible
mono forces reception in mono
on turns the volume on
off mutes the volume
+ turns the volume up one notch
- turns the volume down one notch
{number} tunes the receiver

If you are really inspired by this, maybe you could code a decent client!


Back to The Packard Bell/Aztech FM Radio Card
jlewis@vtc.vsc.edu