28.4. Objective 4: Configuring PCMCIA DevicesPCMCIA 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:
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 filesSeveral 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/configThis 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.optsThis 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.optsNetwork 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/*.optsThe 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 commandsAs shown in the previous sections, two commands that manage PCMCIA cards are cardmgr and cardctl.
28.4.3. PCMCIA TroubleshootingHere are some steps to take when your PCMCIA devices don't work as expected. 28.4.3.1. Steps for troubleshooting PCMCIA devicesWhile the system is running, try the following:
PCMCIA_CORE_OPTS="probe_io=0 setup_delay=10" 28.4.3.2. Boot problemsAt 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 errorsSeveral types of errors occur in regard to PCMCIA cards :
28.4.3.4. Kernel upgradesWhen 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. |