3 Usage and features

Contents of this section

3.1 How do I tell if it is working?

The cardmgr daemon normally beeps when a card is inserted, and the tone of the beeps indicates the status of the newly inserted card. Two high beeps indicate the card was identified and configured successfully. A high beep followed by a lower beep indicates that the card was identified, but could not be configured for some reason. One low beep indicates that the card could not be identified.

If you are running X, the new cardinfo utility produces a slick graphical display showing the current status of all PCMCIA sockets.

If the modules are all loaded correctly, the output of the lsmod command should look like the following, with no cards inserted:

Module:        #pages:  Used by:
ds                 2
i82365             2
pcmcia_core        4    [ds i82365]

All the PCMCIA modules and the cardmgr daemon send status messages to the system log. This will usually be /usr/adm/messages. This file should be the first place you look when tracking down a problem. When submitting a bug report, you should always include the contents of this file. Cardmgr also records some current device information for each socket in /etc/stab.

3.2 How do I tell cardmgr how to identify a new card?

Assuming that your card is supported by an existing driver, all that needs to be done is to add an entry to /etc/pcmcia/config to tell cardmgr how to identify the card, and which driver(s) need to be linked up to this card. Check the man page for pcmcia for more information about the config file format. If you insert an unknown card, cardmgr will normally record some identification information in /usr/adm/messages that can be used to construct the config entry.

Here is an example of how cardmgr will report an unsupported card in /usr/adm/messages.

cardmgr[460]: unsupported card in socket 1
cardmgr[460]: version info: "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"

The corresponding entry in /etc/pcmcia/config would be:

card "Megahertz XJ2288 V.34 Fax Modem"
  version "MEGAHERTZ", "XJ2288", "V.34 PCMCIA MODEM"
  bind "serial_cs"

You can use ``*'' to match strings that don't need to match exactly, like version numbers. When making new config entries, be careful to copy the strings exactly, preserving case and blank spaces. Also be sure that the config entry has the same number of strings as are reported in the log file.

After editing /etc/pcmcia/config, you can signal cardmgr to reload the file with:

kill -HUP `cat /var/run/cardmgr.pid`

If you do set up an entry for a new card, please send me a copy so that I can include it in sample.config.

3.3 How do I control which interrupts and ports are used by a device?

In theory, it should not really matter which interrupt is allocated to which device, as long as two devices are not configured to use the same interrupt. At the top of /etc/pcmcia/config you'll find a place for excluding interrupts that are used by non-PCMCIA devices.

The ibmcc_cs, de650_cs, 3c589_cs, and serial_cs drivers each have a parameter called irq_mask for specifying which interrupts they may try to allocate. Each bit of irq_mask corresponds to one irq line: bit 0 is irq 0, bit 1 is irq 1, and so on. So, a mask of 0x1100 would correspond to irq 8 and irq 12. To limit a driver to use only one specific interrupt, its irq_mask should have only one bit set. These driver options should be set in your /etc/pcmcia/config file. For example:

device "serial_cs"
  module "serial_cs" opts "irq_mask=0x1100"
  ...

would specify that the serial driver should only use irq 8 or irq 12. Note that Card Services will never allocate an interrupt that is already in use by another device, or an interrupt that is excluded in the config file.

There is no way to directly specify the I/O addresses for a PCMCIA card to use. The /etc/pcmcia/config file allows you to specify ranges of ports available for use by all PCMCIA devices.

After modifying /etc/pcmcia/config, you can restart cardmgr with ``kill -HUP''.

3.4 When is it safe to insert or eject a PCMCIA card?

In theory, you can insert and remove PCMCIA cards at any time. However, it is a good idea not to eject a card that is currently being used by an application program. Kernels older than 1.1.77 would often lock up when serial/modem cards were ejected, but this should be fixed now.

3.5 How do I unload PCMCIA drivers?

To unload the entire PCMCIA package, invoke rc.pcmcia with:

/etc/rc.d/rc.pcmcia stop

This script will take several seconds to run, to give all client drivers time to shut down gracefully. If a PCMCIA device is currently in use, the shutdown will fail.

3.6 How does Card Services deal with suspend/resume?

Card Services can be compiled with support for APM (Advanced Power Management) if you've installed this package on your system. The current release of Stephen Rothwell's APM support package is version 0.5. Unlike the 0.4 release, 0.5 does not require a special patch to work with PCMCIA. The PCMCIA modules will automatically be configured for APM if a compatible version is detected on your system.

Without resorting to APM, you can do ``cardctl suspend'' before suspending your laptop, and ``cardctl resume'' after resuming, to properly shut down and restart your PCMCIA cards. This will not work with a PCMCIA modem that is in use, because the serial driver isn't able to save and restore the modem operating parameters.

APM seems to be unstable on some systems. If you experience trouble with APM and PCMCIA on your system, try to narrow down the problem to one package or the other before reporting a bug.

3.7 How do I turn off a PCMCIA card without ejecting it?

Use either the cardctl or cardinfo command. ``cardctl suspend #'' will suspend one socket, and turn off its power. The corresponding resume command will wake up the card in its previous state.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter