Section 28.4. Objective 4: Configuring PCMCIA Devices


28.4. Objective 4: Configuring PCMCIA Devices

PCMCIA devices have historically been handled fairly well by Linux. For the most part, they will just work as long as your system has the right drivers. If you have a problem, follow the troubleshooting steps given in this section.

PCMCIA hardware is detected when the OS boots. PCMCIA devices are manufactured to relatively strict standards and generally run into few problems. On Red Hat systems, PCMCIA is supported by a module called kernel-pcmcia-cs. Debian-based systems use the pcmcia-cs module. Your PCMCIA devices often require a package called hotplug. This package is responsible for providing a daemon that can:

  • Recognize card insertions and removals as events to be acted upon

  • Load and unload drivers whenever an event is recorded

  • Allow hot swapping of cards

  • Provide the necessary modules for proper recognition of PCMCIA cards

The cardmgr process is watching your PCMCIA/PC-CARD slots. If it sees a 32-bit PC-CARD, the process ignores it. Instead, the kernel hotplug system picks up the insertion event and handles the card. Both cardmgr and hotplug will load the kernel driver module appropriate for the inserted card and then configure it according to the administrative settings. When the card is removed, the driver is taken down and unloaded. Unlike with Windows, you can safely remove cards without telling the operating oystem about it first. But sometimes you may want to. For example, if the device is a network card, you may want to release the DHCP lease before removing the card so that you can get the same IP number back when returning (this will depend on the DHCP server policy). Also, it isn't a good idea to remove a PCMCIA hard disk device while it is in operation.

When it comes to a 32-bit PC-CARD, there is little to configure. They are in reality PCI cards, and like other PCI cards they're automatically configured. PCMCIA devices, on the other hand are more closely related to the old ISA bus, and there are many things to handle. The rest of this chapter assumes that card services are installed and start on boot.

28.4.1. PCMCIA configuration files

Several configuration files govern cardmgr. When a PCMCIA card card is first inserted, its identification is read and looked up in /etc/pcmcia/config . This causes the correct module or modules to be loaded and a script corresponding to the device class to be run to do setup work. The scripts are stored in /etc/pcmcia. The classes found in the config file are currently network, isdn, cdrom, ftl, serial, parport, ide, iccc, and teles. Not all these have scripts. The scripts further consult files called /etc/pcmcia/*.opts to fetch user/administrator settings, such as IP numbers for network cards.

28.4.1.1. /etc/pcmcia/config

This file contains the card database, which maps card identifiers to drivers. A card's identification can be shown by cardctl as shown here:

 # cardctl ident Socket 0:   product info: "3Com", "Megahertz 589E", "TP/BNC LAN PC Card", "005"   manfid: 0x0101, 0x0589   function: 6 (network) Socket 1:   product info: "Lucent Technologies", "WaveLAN/IEEE", "Version 01.01", ""   manfid: 0x0156, 0x0002   function: 6 (network) 

Based on this, you can look the card up in the config file. If you search for the first two strings, you will find this:

 card "Lucent Technologies WaveLAN/IEEE Adapter"   version "Lucent Technologies", "WaveLAN/IEEE"   bind "orinoco_cs" 

The bind "orinoco_cs" tells cardmgr to bind the card to the drivers defined for orinoco_cs. This is defined earlier in the file:

 device "orinoco_cs"   class "network" module "hermes", "orinoco", "orinoco_cs" 

This shows that the card is a network card and lists the relevant driver modules. cardmgr will load these in sequence, with appropriate options. Then the /etc/pcmcia/network script will run to initialize the device.

If you have a PCMCIA card that you know to be supported by some existing driver but that is not listed in the file, insert the card, check its identification, and write in a card section corresponding to the card. If needed, also write in a device section enumerating the drivers, if this is not already present. After changing the file, you must restart cardmgr, because it reads the file only once, at startup.

28.4.1.2. /etc/pcmcia/config.opts

This file is actually included from /etc/pcmcia/config, but as with the other .opts files, it is a local configuration file. It should be installed only the first time the packages are installed, not when they are overwritten. The most important configuration options here are toward the top. On some machines, the defaults in the file do not match the actual hardware and will need tweaking.

 ... # System resources available for PCMCIA devices include port 0x100-0x4ff, port 0x800-0x8ff, port 0xc00-0xcff include memory 0xc0000-0xfffff include memory 0xa0000000-0xa0ffffff, memory 0x60000000-0x60ffffff # High port numbers do not always work... # include port 0x1000-0x17ff # Extra port range for IBM Token Ring include port 0xa00-0xaff # Resources we should not use, even if they appear to be available # First built-in serial port exclude irq 4 # Second built-in serial port #exclude irq 3 # First built-in parallel port exclude irq 7 ... # Examples of options for loadable modules # To fix sluggish network with IBM Ethernet adapter... #module "pcnet_cs" opts "mem_speed=600" ... 

If your host has an extra parallel port to support an extra printer, you should also exclude the IRQ this hardware is using. Because of hardware conflicts, a few PCMCIA adapters work better if the port ranges and memory ranges are adjusted.

28.4.1.3. /etc/pcmcia/network.opts

Network configuration options are fetched from this script by /etc/pcmcia/network, which does the actual setup work. On Red Hat and systems derived from that distribution, this file is not used, because the system gets network parameters from its own configuration system instead. If you look in the /etc/pcmcia/network script, it should be clear whether this file is included or not. The usual setup here is that the script tests the current "scheme" and the card hardware address and sets things according to those values. Schemes can be set with cardctl scheme name, where name is something like home or work. That way you easily have different configurations for the same network card when you are at home and at work. About 20 different options can be set in this file, some of them quite uninteresting. A very abbreviated excerpt is reproduced here to illustrate what can be done:

 # The address format is "scheme,socket,instance,hwaddr". ... case "$ADDRESS" in *,*,*,00:10:5A:FB:F0:D2) ...     # Use DHCP (via /sbin/dhcpcd, /sbin/dhclient, or /sbin/pump)? [y/n]     DHCP="y"     # If you need to explicitly specify a hostname for DHCP requests     DHCP_HOSTNAME="lorbanery"     # Host's IP address, netmask, network address, broadcast address     IPADDR=""     NETMASK="255.255.255.0"     NETWORK="10.10.10.0"     BROADCAST="10.10.10.255"     # Gateway address for static routing     GATEWAY="10.10.10.1"     # Things to add to /etc/resolv.conf for this interface     DOMAIN=""     SEARCH=""     DNS_1=""     DNS_2=""     DNS_3="" ... 

In Debian, this file can be managed by the pcnetconfig command. In Red Hat, the corresponding files are /etc/sysconfig/network-scripts/ifcfg-*, one for each interface. These can be managed with Red Hat's netconfig command.

28.4.1.4. /etc/pcmcia/*.opts

The other class scripts and the attendant *.opts scripts are patterned along the same lines. They are all well-commented, and the *.opts files contain at least one complete example, which is also often used as the default configuration. There are too many options and details in these scripts to repeat here or to test on a exam. If you insert a card and the drivers are loaded but it seems not to work, you should visit and customize these files to fix it.

28.4.2. PCMCIA commands

As shown in the previous sections, two commands that manage PCMCIA cards are cardmgr and cardctl.


Syntax

 cardmgr [ -q ] [ -d ] 


Description

cardmgr does its work as a daemon. When invoked, it goes into the background. When it detects the insertion or removal of a PCMCIA card, it installs or removes the corresponding drivers according to the driver database in /etc/pcmcia/config.

The -q (quiet) option stops cardmgr from beeping when cards are inserted and removed. The -d option causes cardmgr to use modprobe to load modules instead of insmod.

In Red Hat you can set the default options in /etc/sysconfig/pcmcia; on Debian the filename is /etc/pcmcia.conf. Use the CARDMGR_OPTS variable.


Syntax

 cardctl scheme [ name ] cardctl command [ socket ] 


Description

cardctl checks and manipulates PCMCIA cards. The first form is used to set the desired configuration scheme, which some distributions support. The second form takes one of several commands, the most likely of which are:


ident

Identify the card in the given socket. If no socket is given, all cards are identified.


eject

Shut down the driver and cut power to the socket.


insert

Enable power to the socket and perform the insertion procedure.


Examples

Change the scheme to work:

 cardctl scheme work 

Check the identification of the card in PCMCIA slot number 1:

 cardctl ident 1 

28.4.3. PCMCIA Troubleshooting

Here are some steps to take when your PCMCIA devices don't work as expected.

28.4.3.1. Steps for troubleshooting PCMCIA devices

While the system is running, try the following:

  1. Use the cardmgr and cardctl commands, as described earlier, to determine manufacturer information. This information will help you determine whether you are using the correct drivers.

  2. Issue the cardinfo command, which shows you all of the PCMCIA slots that exist. The command provides a graphical utility that provides information about each of your system's PCMCIA slots. It shows whether the device has been suspended, whether it is receiving power, whether it is compatible with the system, and whether the device is write-protected. If not run as root, cardinfo will only report information. Run as root, cardinfo allows you to suspend, resume, and eject devices, when those operations are supported.

  3. Review and, when necessary, edit the /etc/pcmcia/config file: This file contains the drivers that configure the card. Uncomment sections relevant to your card (e.g., orinoco_cs).

  4. Verify that you have the proper drivers installed.

  5. Determine that the proper devices are supported. You may need to install the Atmel or package, which in turn installs the /etc/pcmcia/atmel.conf file. You may even need to update this file after it is installed. Such additions and edits allow the system to recognize additional devices that have different firmware. Other packages may need to be installed, depending upon your card. For example, to support Linksys cards, you may need to install the WPC11 package.

  6. After you have made the necessary changes, restart PCMCIA through /etc/init.d/pcmcia restart.

  7. Use the iwconfig, ifup, or ifconfig command to configure the system.

  8. Review the /var/log/messages and /var/log/syslog files for information (e.g., tail -f /var/log/messages). If you discover a message that reads something similar to "unsupported card in socket 0," you need to map the right driver to the correct device in the /etc/pcmcia/config file.

  9. Manually load possible modules. The modules that you can install using the modprobe command include pcmcia_core, yenta_socket, and ds. In some cases, you will have to install the i82092 or i82365 modules.

  10. Beware the probe feature: if can cause problems when PCMCIA card modules are loaded. To isolate this problem, modify the modprobe command with the following argument:

 PCMCIA_CORE_OPTS="probe_io=0 setup_delay=10" 

28.4.3.2. Boot problems

At times, a system will hang during the boot process when PCMCIA devices are scanned. This problem is sometimes caused by conflicts with the ACPI subsystem. To resolve such problems quickly, boot the system to LILO or GRUB, and then enter the following at the boot prompt:

 NOPCMCIA=yes 

You can also enter interactive mode to load PCMCIA modules one at a time at boot time. This will help you isolate the problem and create a fix.

28.4.3.3. Common PCMCIA errors

Several types of errors occur in regard to PCMCIA cards :


The system does not respond to card insertion.

ACPI is often the culprit. Reboot the system and pass the following parameter at boot time: pci=noacpi.


The system responds to the card, but fails to recognize it as valid.

If the system fails to respond at all, it's generally because no driver is assigned, or a driver mismatch has occurred. Use the command cardctl ident to determine the nature of the card. Review the card's information and settings. You can then edit the /etc/pcmcia/config file (and related files) to resolve the problem. Look in /lib/modules/kernel-version to see what modules you may have missed.


The driver does not load.

In such cases, your system will recognize the card, but it will not function. The /var/log/messages file will contain entries related to this problem. It means you are using the wrong driver for the card. It is also possible that the PCI card containing the PCMCIA interface is experiencing an IRQ conflict. If you suspect this is the case (and such cases are rare), use the lspci command to determine what IRQ and I/O port is used. Devices can share IRQs, but not I/O ports.


Improper configuration.

Fix the configuration with the getcfg command.

28.4.3.4. Kernel upgrades

When upgrading the kernel, make sure that you select the "Network device support" and "Pocket and portable adapters" portions of the kernel configuration menu. These ensure that PCMCIA support is enabled.

You may find that your PCMCIA card no longer works after upgrading your kernel. This might be because you have forgotten to install the modules for that kernel. Before taking any further action, upgrade your kernel modules to see if this resolves the problem.



LPI Linux Certification in a Nutshell
LPI Linux Certification in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596005288
EAN: 2147483647
Year: 2004
Pages: 257

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net