Table of Contents
This chapter focuses on the use of Linux on mobile devices — especially on laptops. It covers the configuration of PC cards (PCMCIA), the management of multiple system profiles with SCPM, and wireless communication with IrDA and Bluetooth.
The hardware specifications described in this chapter do not exist on IBM S/390 and zSeries, making this chapter irrelevant for these platforms. ▪
PCMCIA stands for Personal Computer Memory Card International Association. It is used as a collective term for all hardware and software involved.
The essential component is the PCMCIA card. There are two distinct types:
These are currently the most used cards. They use a 16-bit bus for data transmission. These cards are inexpensive and generally very well supported by Linux.
These cards represent a more recent standard. CardBus cards use a 32-bit bus, which makes them faster, but also more expensive. Since the data transfer rate is frequently restricted at some other point, it is often not worth the extra cost. There are numerous drivers for these cards, but some of them are unstable. Whether these cards are well supported also depends on the available PCMCIA controller.
Determine what card is currently inserted with cardctl ident when the PCMCIA service is active. A list of supported cards can be found in /usr/share/doc/packages/pcmcia/SUPPORTED.CARDS. The most recent version of the PCMCIA HOWTO is available in the same directory.
The second essential component is the PCMCIA controller of the PC card or CardBus bridge. These establish the connection between the card and the PCI bus and, in older devices, the connection to the ISA bus as well. These controllers are almost always compatible with the Intel chip i82365. All common models are supported. Retrieve the controller type with pcic_probe. If it is a PCI device, lspci -vt provides additional information.
There are currently two PCMCIA systems — external PCMCIA and kernel PCMCIA. The external PCMCIA system by David Hinds is the older one. It is quite well tested and is subject to ongoing development. The sources of the modules used are not integrated in the kernel sources, which is why it is called external.
Starting with kernel 2.4, a set of alternative modules is contained in the kernel sources forming the kernel PCMCIA system. The basic modules were written by Linus Torvalds. Their support of more recent CardBus bridges is better than that of external PCMCIA.
Unfortunately, the two systems are not compatible. They contain different sets of card drivers. Depending on the hardware involved, only one of the systems may be suitable. The default in SUSE LINUX is the more recent kernel PCMCIA. To change the system, give the variable PCMCIA_SYSTEM in the file /etc/sysconfig/pcmcia either the value external or kernel. Then restart PCMCIA with rcpcmcia restart. To switch only temporarily between systems, use rcpcmcia restart external or rcpcmcia restart kernel. If PCMCIA is not running, use the option start instead of restart to switch the PCMCIA system temporarily. Refer to /usr/share/doc/packages/pcmcia/README.SuSE for detailed information.
The kernel modules for both systems are located in the kernel packages. In addition, the packages pcmcia and hotplug are required. When PCMCIA is started, the modules pcmcia_core, i82365 (external PCMCIA) or yenta_socket (kernel PCMCIA), and ds are loaded. In some very rare cases, the module tcic is required instead of i82365 or yenta_socket. They initialize the existing PCMCIA controller and provide basic functionality.
As it is possible to change PCMCIA cards while the system is running, a deamon monitors any activity in the PCMCIA slots. Depending on the chosen PCMCIA system and hardware, this task is performed by the card manager or the hotplug system of the kernel. With external PCMCIA, only the card manager is used. For kernel PCMCIA, the card manager only handles PC Card cards. CardBus cards are handled by hotplug. The card manager is started by the PCMCIA start script after the base modules have been loaded. Because hotplug manages subsystems other than PCMCIA, it has its own start script.
If a card is inserted, card manager or hotplug determines the type and function of the card then loads the corresponding modules. If this is successful, card manager or hotplug starts certain initialization scripts. Depending on the function of the card, they establish a network connection, mount partitions from external SCSI hard drives, or carry out other hardware-specific actions. The scripts for the card manager are located in /etc/pcmcia. The scripts for hotplug can be found in /etc/hotplug.
If the card is removed, card manager or hotplug terminates all card activities using the same scripts. Finally, the modules that are no longer required are unloaded.
Both the start process of PCMCIA and card events are recorded in the system log (/var/log/messages). It records which PCMCIA system is currently used and which daemons have been used by which scripts to set up things. Removing a PCMCIA device should work smoothly, at least in theory. This works very well for network, modem, or ISDN cards as long as there are no active network connections. It does, however, fail if mounted partitions of an external hard drive or NFS directories are used. In such cases, ensure that these units are synchronized and cleanly unmounted. This is no longer possible if the card has already been removed. In case of doubt, cardctl eject can help safely eject the card. This command deactivates all cards still inserted in the laptop. To deactivate only one card, specify the slot number, for example: cardctl eject 0.
Specifies the PCMCIA system to use.
Contains the name of the module that addresses the PCMCIA controller. Normally, the start script should detect the module automatically. If this automatic detection fails, enter the name of the desired module here. Otherwise, this variable should be left empty.
This was originally designed to contain parameters for the pcmcia_core module, which are rarely used. Refer to the manual page of pcmcia_core for more information about these options.
Parameters for the module i82365. Refer to the manual page of i82365. If yenta_socket is used, these options are ignored, because yenta_socket has no options.
Card manager refers to the files /etc/pcmcia/config and /etc/pcmcia/*.conf for the assignment of drivers to PCMCIA cards. First, config is read then the *.conf files in alphabetical order. The last entry found for a card is used. Refer to the manual page of pcmcia for details on the syntax of these files.
These can be set up with YaST like normal network cards. Select as the card type. All other details about setting up the network can be found in Section 21.4. “Network Integration”. Read the notes there about hotpluggable cards.
Even for ISDN PC cards, configuration is done to a large extent using YaST, as with other ISDN cards. It is not important which PCMCIA card offered there is chosen, but only that it is a PCMCIA card. When setting up hardware and provider, make sure the operating mode is set to hotplug and not to onboot.
ISDN modems also exist for PCMCIA cards. These are modem cards or multifunction cards with an additional ISDN connection kit. They are treated like an ordinary modem.
There are also “soft modems” for PCMCIA cards. As a rule, these are not supported. If there is a driver, it must be individually integrated into the system.
The corresponding driver module is loaded by the card manager or hotplug. When a SCSI or IDE card is inserted, the devices connected to it are available. The device names are detected dynamically. Information about existing SCSI or IDE devices can be found in /proc/scsi or /proc/ide.
External hard drives, CD-ROM drives, and similar devices must be switched on before the PCMCIA card is inserted into the slot. Use active termination for SCSI devices.
|Removing IDE or SCSI Cards|
If you intend to remove a SCSI or IDE card, properly unmount all partions on these devices. Otherwise you would not be able to access these devices after a reboot of the system.
You can also install Linux entirely on external hard drives. However, the boot process is a bit more complicated. You will always need a boot disk containing the kernel and an initial RAM disk (initrd). More information about this can be found in Section 10.3. “Booting with the Initial RAM Disk”.
The initrd contains a virtual file system that includes all required PCMCIA modules and programs. The boot disk (rather, the boot disk image) is designed in a similar fashion. Using these, you could always boot your external installation. It is, however, tiresome to load the PCMCIA support every time by hand. Advanced Linux users can create a customized boot disk for their own system. For more information about this topic refer to the PCMCIA HOWTO, section Booting from a PCMCIA Device.
Most problems arising with certain laptops or cards using PCMCIA can be solved with little trouble provided you approach the problem systematically.
|Loading Kernel Modules by Hand|
Kernel and external PCMCIA cannot be used at the same time, but they exist in parallel in SUSE LINUX. Keep this in mind when loading kernel modules by hand. The modules names of both PCMCIA systems are the same, but they are located in different subdirectories under /lib/modules/<kernelversion>. The subdirectories are pcmcia for kernel PCMCIA and pcmcia-external for external PCMCIA. The subdirectory must be specified when loading modules manually:
modprobe -t <directory> <modulename>
First, find out if the problem is with the card or with the PCMCIA base system. For this reason, always start the computer first without the card inserted. Only insert the card when the base system appears to function correctly. Use tail -f /var/log/messages to monitor the system log while searching for the cause of the PCMCIA failure. With this approach, the problem is narrowed down to one of the two following cases.
If the system hangs at boot time showing the message PCMCIA: Starting services or other strange things happen, PCMCIA can be prevented from being started at the next system boot by entering NOPCMCIA=yes at the boot prompt. To further isolate the error, load the three base modules of the PCMCIA system with the following commands by hand (as user root).
For external PCMCIA, execute modprobe -t <dir> pcmcia_core and modprobe -t pcmcia-external i82365. For kernel PCMCIA, execute modprobe -t pcmcia yenta_socket instead of the second command. In very rare cases, you may need to execute modprobe -t <dir> tcic and modprobe -t <dir> ds. The critical modules are the first two.
If the error occurs while pcmcia_core is loaded, refer to the manual pages for pcmcia_core for further information. Use the options described there for a first testing with modprobe. For example, switch off the APM support for the PCMCIA module. In a few cases, there could be problems with this. Use the setting do_apm=0 to deactivate power management:
modprobe -t <dir> pcmciacore do_apm=0
If the chosen option is successful, write it to the variable PCMCIA_CORE_OPTS in /etc/sysconfig/pcmcia to use it permanently:
Checking free I/O areas may lead to problems if other hardware components are disturbed by this. Avoid this by using probe_io=0.
If several options should be used, separate them by spaces:
If errors occur while loading the i82365 module, refer to the manual page of i82365. A problem in this context is a resource conflict — if an interrupt, I/O port, or memory area is occupied twice. Although the module i82365 checks these resources before they are made available to a card, sometimes just this check leads to problems. Checking the interrupt 12 (PS/2 devices) on some computers leads to the mouse or keyboard hanging. In this case, the parameter irq_list=<List of IRQs> can help. The list should contain all IRQs to use. For example, enter the command modprobe i82365 irq_list=5,7,9,10 or permanently add the list of IRQs to /etc/sysconfig/pcmcia:
In addition, there are /etc/pcmcia/config and /etc/pcmcia/config.opts. These files are evaluated by card manager. The settings made in them are only relevant when loading the driver modules for the PCMCIA cards. In /etc/pcmcia/config.opts, IRQs, I/O ports, and memory areas can be included or excluded. The difference from the option irqlist is that the resources excluded in config.opts are not used for a PCMCIA card, but are still checked by the base module i82365.
Here, there are basically three variations: the card is not detected, the driver cannot be loaded, or the interface made available by the driver is set up incorrectly. Determine whether the card is managed by the card manager or hotplug. For external PCMCIA, card manager always takes control. For kernel PCMCIA, card manager manages PC card cards and hotplug manages CardBUS cards. Here, only card manager is discussed.
The message Unsupported Card in Slot x in /var/log/messages indicates that card manager has failed to assign a driver to the card. The card and driver assignment is done by checking the files /etc/pcmcia/config or /etc/pcmcia/*.conf. They function as the driver database. This driver database can easily be extended using existing entries as reference. Use cardctl ident to find out how the card identifies itself. Refer to the PCMCIA HOWTO (Section 6) and the manual page of pcmcia for further details on this procedure. After modifying /etc/pcmcia/config or /etc/pcmcia/*.conf, reload the driver assignment with the command rcpcmcia reload.
Wrong assignments of cards and drivers in the driver database may result in a driver not being loaded. This may happen if a vendor uses a different chip in an apparently unchanged card. Alternative drivers may also offer better support for a particular card than the default assignment. In these cases, precise information about the card is required. If needed, obtain further help from the Advanced Support Service or by asking on a mailing list.
A resource conflict may be another reason for a driver not being loaded. For most PCMCIA cards, it is irrelevant with which IRQ, I/O port, or memory area they are operated, but there are exceptions. First test only one card and, if necessary, switch off other system components, such as the sound card, IrDA, modem, or printer. The allocation of system resources can be monitored with the command lsdev (it is quite normal for several PCI devices share the same IRQ).
One possible solution would be to use a suitable option for the module i82365 (see PCMCIA_PCIC_OPTS). Many card driver modules also have options. Find these using the command modinfo /lib/modules/<pcmcia directory>/<driver>.o (the complete path is needed to locate the correct driver). Most of the modules ship with a manual page. rpm -ql pcmcia | grep man lists all manual pages contained in the pcmcia package. To test the options, the card drivers can also be unloaded manually. Again, ensure that the module is using the correct PCMCIA system.
When a solution has been found, a specific resource can be allowed or forbidden in the file /etc/pcmcia/config.opts. You may even specify option for card drivers. If, for example, the module pcnet_cs should be exclusively operated with IRQ 5, the following entry is required:
module pcnet_cs opts irq_list=5
One problem that sometimes occurs with 10/100-Mbit network cards is incorrect automatic identification of the transmission method. Use the command ifport or mii_tool to view and modify the transmission method. To have these commands run automatically, the script /etc/pcmcia/network must be adjusted.
In this case, it is recommended to check the configuration of the interface to eliminate configuration errors. For network cards, the verbosity of the network scripts can be increased by assigning the value DEBUG=yes to the variable in /etc/sysconfig/network/config. For other cards or if this is of no help, there is still the possibility of inserting the line set -x into the script run by card manager (see /var/log/messages). With this, each individual command of the script is recorded in the system log. If you have found the critical part in a script, the corresponding commands can be entered in a terminal and tested.
PCMCIA is already for installation if you want to install over a network or if the CD-ROM relies on PCMCIA. To do this, start with a boot floppy. In addition, one of the module floppy disks is required.
After booting from floppy disk (or after selectingbooting from CD), the program linuxrc starts. Select + . Two entry fields appear in which to enter options for the modules pcmcia_core and i82365. Normally, these fields can be left blank. The manual pages for pcmcia_core and i82365 are available as text files on the first CD in the directory docu.
SUSE LINUX is then installed with the external PCMCIA system. During the installation, system messages are sent to various virtual consoles. Switch to them using Alt-function key. Later, when a graphical interface is active, use Ctrl-Alt-function key.
During installation, several terminals are available on which commands can be run. As long as linuxrc is running, use console 9 (a very spartan shell). After YaST starts, a Bash shell and many standard system tools are available on console 2.
If the wrong driver module for a PCMCIA card is loaded during installation, the boot floppy must be modified manually. This requires a detailed knowledge of Linux, however. When the first part of the installation is finished, the system is partially or completely rebooted. In rare cases, it is possible that the system will hang when PCMCIA is started. At this point the installation has reached an advanced stage. You can then start Linux in text mode without PCMCIA using the NOPCMCIA=yes boot option. See also Section 16.1.4. “Troubleshooting”. You can even change some system settings on the second console before the first part of the installation is completed to make sure the reboot will be successful.
cardctl is an essential tool for obtaining information from PCMCIA and carrying out certain actions. In cardctl, find many details. Enter just cardctl to obtain a list of the valid commands.
The main functions can be controlled with the graphical front-end cardinfo. For this to work, the pcmcia-cardinfo package must be installed.
Additional helpful programs from the pcmcia package are ifport, ifuser, probe, and rcpcmcia. These are not always required. To find out about everything contained in pcmcia, use the command rpm -ql pcmcia.
To update the kernel, use the kernel packages provided by SUSE LINUX. If it is necessary to compile your own kernel, the PCMCIA modules must also be recompiled. It is important that the new kernel is already running when these modules are recompiled, because various information is extracted from it. The pcmcia package should already be installed, but not started. In case of doubt, run the command rcpcmcia stop. Install the PCMCIA source package and enter rpm -ba /usr/src/packages/SPECS/pcmcia.spec
The new packages will be stored in /usr/src/packages/RPMS. The package pcmcia-modules contains the PCMCIA modules for external PCMCIA. This package must be installed with the command rpm --force, because the module files belong officially to the kernel package.
For more information about specific laptops, visit the Linux Laptop home page at http://linux-laptop.net. Another good source of information is the Mobilix home page at http://tuxmobil.org/. The SUSE LINUX Support Database features several articles on the use of SUSE LINUX on mobile devices. Go to http://portal.suse.de/sdb/en/index.html and search for laptop.