Part IV Linux and Hardware 253 Chapter 10 Linux and Hardware 10.1 Preliminary Notes It is now possible to integrate almost all hardware components into a Linux system with little (or more) trouble. How this is achieved in individual cases and which software is available, is the subject of this chapter. For problems involving printing, see Chapter 12 page 293, for problems concerning faxing see Section 6.10 page 181 and for using ISDN devices, see Section 6.2 page 150. PCMCIA hardware is described in Chapter 11 page 279. 10.2 Cards In a standard PC, normally either ISA ("Industry Standard Architecture") or PCI ("Peripheral Component Interconnect") bus-based cards are used. The AGP ("Accelerated Graphics Port") is an exception to this, as devices on this port are also visible on the PCI bus. They are treated logically in exactly the same way as PCI bus cards. ­ PCMCIA bus cards are found above all in portable computers, such as laptops and notebooks. These cards are described in Chapter 11 page 279. 10.2.1 ISA and PCI Cards We shall now take a closer look at ISA and PCI bus cards. The configuration of these cards will then be explained using sound cards as an example. ISA Cards The ISA card is the oldest form of PC-compatible card. The bus is 8 or 16 bits wide, and has a maximum frequency of 8 MHz. Many mainboards provide the option of increasing the frequency of the ISA bus ­ but this often leads to problems. ISA bus cards can be divided into three categories: Legacy cards: These cards must be configured entirely by hand. Resources such as I/O addresses, interrupts and DMA channels must be set yourself through jumpers or microswitches on the cards themselves. You must also ensure that resources such as IRQ or DMA channels are not used by two or even more cards simultaneously. Therefore the configuration of such cards often turns out to be somewhat difficult. 255 10. Linux and Hardware Jumperless cards: Jumperless cards, compared to the first generation of ISA cards, have the advantage that the setting of resources is no longer made via jumpers, but via a special configuration program. These pro- grams, however, are usually only available for DOS, and can thus not be used in Linux. P'n'P cards: Plug and Play cards are the logical progression from jumper- less cards. These cards contain data on their configuration and a list of possible configurations. A special program or a driver can now query the P'n'P cards in the system and configure all cards so they do not conflict with each other. If a card has not been configured, then in practice it is not available to the system. To configure P'n'P cards in Linux, the package isapnp from the series series ap is used. This package contains the two programs, pnpdump and isapnp. How Are P'n'P Cards Activated With isapnp Tools? Proceed as follows: * Change to the user `root'. * If the file isapnp.conf already exists in the directory /etc, you should first make a backup copy, by changing its name. earth:/ # mv /etc/isapnp.conf /etc/isapnp.conf.bak * By entering earth:/ # pnpdump -c > /etc/isapnp.conf, you will create the file /etc/isapnp.conf. The parameter -c en- sures that pnpdump prepares the output file in such a way that the P'n'P devices are activated immediately. * If you enter earth:/ # isapnp /etc/isapnp.conf, the P'n'P cards in your computer will be activated. ­ In SuSE Linux this is activated automatically each time the system is booted. Possible Sources of Error Symptom: pnpdump gives the output: "No boards found". It may also be the case that one or more of the installed ISA P'n'P cards cannot be recognized. Possible Explanations: * There are no P'n'P cards installed on your system: check which cards are installed on your system and read the documentation about them. If necessary, ask the dealer from whom you bought your computer which cards are installed on it. * The card(s) is/are defective: check if the cards are correctly positioned in the slots. See if the cards work correctly under a different operating system. * There are certain cards which can either be run as ISA P'n'P cards, or which can be allocated fixed resources, for example: (Example: 256 10.2. Cards a number of 10 MBit NE2000 ISA ethernet cards). Usually you can switch between the two modes using a DOS program. Depending on the configuration of such cards, these do not appear in the output of pnpdump. * There are a few ISA P'n'P cards which will not work together with other ISA P'n'P cards in the same system. In such cases only one of the cards is visible in the output of pnpdump. It is possible that one of the cards can be configured so that it is no longer driven as an ISA P'n'P card (for example, with a jumper directly on the card so that it uses fixed resources). * There seem to be (in very few cases) cards which perform a reset after pnpdump is run. If this involves a SCSI card, for example a controller on which the root partition is dependent, this can cause the computer to hang. If this problem occurs then you must try and configure the card in such a way that it no longer functions as an ISA P'n'P card. Or you can do away with initializing the card in Linux completely, and boot the system with the help of loadlin; in this case the card is already initialized. Symptom: When running the command isapnp or when booting, you will see an error message like this: * LD setting failed, this may not be a problem. * Try adding (VERIFYLD N) to the top of your script ** Error occurred requested `LD2` on or around line 319 * --- further action aborted Solution: Follow the advice of the error message, and at the beginning of the file /etc/isapnp.conf, insert the line (VERIFYLD N) that is: # [...] # (DEBUG) (VERIFYLD N) (READPORT 0x0203) (ISOLATE) (IDENTIFY *) # [...] Symptom: When running the command isapnp or when booting, you will see an error message like this: [...] /etc/isapnp.conf:66 -- Fatal - resource conflict allocating 16 bytes of IO at 220 (see /etc/isapnp.conf) /etc/isapnp.conf:66 -- Fatal - IO range check attempted while device activated /etc/isapnp.conf:66 -- Fatal - Error occurred executing request ' ' --- further action aborted 257 10. Linux and Hardware Solution: You probably have a conflict between the values selected in the file /etc/isapnp.conf and those resources already being used in your system. You should compare your /etc/isapnp.conf with the information on the resources in question, which can be found in /proc; this should not be necessary if you allow pnpdump to undertake this allocation itself, by using the option -c. In many cases difficulties can arise if, in the setup of the computer, the automatic configuration of ISA P'n'P resources is switched on through the BIOS. You should switch this off if this is the case. Since the configura- tion is performed by means of pnpdump/isapnp, this setup option is not necessary. In case of problems which go deeper than this, you should consult the exten- sive documentation on the package package isapnp. This can be found on your system in the directory /usr/doc/packages/isapnp. At the end of this subsection we will take a closer look at configuring a P'n'P card, using the example of a sound card. PCI Cards PCI bus cards normally don't need to be configured at all by the user. The agreement on the PCI bus standard was an attempt to remove many restric- tions of the old bus system. In this respect, a sensible automatic configuration of the cards was planned. Each PCI card is activated by the computer's BIOS when booting. In many cases you can influence the distribution of the inter- rupts through settings in the computer BIOS. When Linux starts, it reads the configuration of the PCI devices directly from the PCI BIOS, and from this point onwards, uses this data for all information about the PCI subsystem. With the command earth:/ # lspci -tv you can be shown a list of all the devices on the PCI bus recognized by Linux: -[00]-+-00.0 Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge +-01.0-[01]----00.0 Nvidia Corporation Riva TNT +-04.0 Intel Corporation 82371AB PIIX4 ISA +-04.1 Intel Corporation 82371AB PIIX4 IDE +-04.2 Intel Corporation 82371AB PIIX4 USB +-04.3 Intel Corporation 82371AB PIIX4 ACPI +-06.0 Adaptec 7890 09.0 Digital Equipment Corporation DECchip 21140 [FasterNet] Screen output 10.2.1: Output of the command lspci -tv In the following subsection we shall also configure a PCI sound card. 258 10.3. Sound Cards 10.3 Sound Cards In general, there are currently two types of sound cards available on the market today, ISA and PCI sound cards, whereby ISA cards are slowly dying out. It looks as if ISA cards will soon no longer be produced. In SuSE Linux there are currently two methods of supporting sound cards. On the one hand, you can install the package opso or the package opsod up (a demo), and for multi-processor systems there is package opso smp and package opsodsmp (demo) from the series pay. Alternatively you could use the kernel-based modules for sound support. 10.3.1 OSS / OSSdemo These packages are ideally suited for configuring ISA and ISA-P'n'P sound cards. The package opso and package opso smp have already been reg- istered for SuSE customers and are thus fully functional. The package opsod up and package opsod smp on the other hand have not yet been licensed and are limited to 20 minutes running time. In order to use the OSS or OSSdemo sound driver, please proceed as follows: * Install one of the above-mentioned packages in the series pay, using YaST. * Change, as the user `root', to the corresponding installation directory in /tmp and start the program oss-install located there: earth:/ # cd /tmp/opso-3.8.1z earth:/tmp/opso-3.8.1z # ./oss-install * The program guides you through the installation of the driver. * When the program is finished, you can, with the command earth:/tmp/opso-3.8.1z # soundon load and use the OSS driver (s). If you would prefer to use the kernel modules for sound support, you should read the following subsection. 10.3.2 How Are Sound Cards Configured in Linux? To use a sound card in Linux, the following steps are necessary: * Identification of hardware: ­ Which cards need to be configured (manufacturer, what kind of chip on the card)? ­ What kind of hardware (ISA, ISA-P'n'P, PCI) is used? * Configuration of hardware: ­ Setting jumpers, or configuration using isapnp tools. * Installing/loading the driver: ­ Loading the kernel modules, or starting the OSS sound driver. Let's examine each of these steps. 259 10. Linux and Hardware * Identifying hardware: ­ ISA bus-based Legacy sound cards These cards are still widely used and can be found above all in older computer configurations. The configuration is performed by setting jumpers on the card itself. This assigns the different resources (IO addresses, IRQ's and DMA's). ­ ISA bus-based P'n'P sound cards Cards of this type are similar to Legacy cards, except that resources (IO addresses, IRQ's and DMA's) are configured by software interface. Thus you no longer need to set any jumpers on the cards. ­ PCI bus-based sound cards PCI sound cards are the easiest ones to configure. All slot cards on the bus are automatically configured by the computer. Via software interfaces the drivers can now check the resources of the card. * Configuration of the hardware: ­ ISA bus-based Legacy sound cards: Depending on th capabilities of your sound card, you need to configure various resources. In the following example a Creative Soundblaster 16 is configured: I/O addresses The following I/O addresses are valid for this card: Audio I/O Game Port MPU-401 FM-Synthesis Only the addresses for audio I/O (0x220, 0x240, 0x260 or 0x280) and MPU-401 (0x300 or 0x330) can be changed. The addresses for the game port (0x200) and FM synthesis (0x388) are fixed by default. Interrupts (IRQs) The cards need their own interrupt. This can be set to 2, 5, 7 or 10. DMA Channels Options here are the channels 0, 1, 3, 5, 6 or 7. The default here is DMA 1 for 8 bit, and DMA 5 for 16 bit data transfer. You should change the jumpers on the sound card in such a way that the card does not cause any resource conflicts with other cards on the computer. Make a note of these settings. ­ ISA bus-based P'n'P sound cards: The resources of these cards must be activated by special software. Using OSS makes the configuration of these cards considerably eas- ier, because this program automatically searches for these cards and configures them immediately. P'n'P cards can also be used with kernel-based drivers. Although in this case the card must be activated before the kernel modules are loaded. In Linux you will find the pro- gram package isapnp of use. The program pnpdump creates a con- figuration file listing all the resources of P'n'P cards available in the 260 10.3. Sound Cards system. Afterwards this list can still be edited by hand to distribute the cards' resources differently. By entering earth:/ # pnpdump -c > /etc/isapnp.conf the file /etc/isapnp.conf is created. The following describes how a Creative Soundblaster AWE64 is acti- vated: # This is free software, see the sources for details. # This software has NO WARRANTY, use at your OWN RISK ## For details of this file format, see isapnp.conf(5) ## For latest information and FAQ on isapnp and pnpdump see: # http://www.roestock.demon.co.uk/isapnptools/ ## Compiler flags: -DREALTIME -DNEEDSETSCHEDULER -DABORT_ONRESERR ## Trying port address 0203 # Trying port address 020b # Board 1 has serial identifier 54 17 0e db 74 9e 00 8c 0e # (DEBUG) (READPORT 0x020b) (ISOLATE PRESERVE) (IDENTIFY *) (VERBOSITY 2) (CONFLICT (IO FATAL)(IRQ FATAL)(DMA FATAL)(MEM FATAL)) # or WARNING # Card 1: (serial identifier 54 17 0e db 74 9e 00 8c 0e) # Vendor Id CTL009e, Serial Number 386849652, checksum 0x54. # Version 1.0, Vendor version 2.0 # ANSI string -->Creative SB AWE64 Gold<-- ## Logical device id CTL0044 # Device supports vendor reserved register @ 0x38 # Device supports vendor reserved register @ 0x3a # Device supports vendor reserved register @ 0x3b # Device supports vendor reserved register @ 0x3c # Device supports vendor reserved register @ 0x3d ## Edit the entries below to uncomment out the configuration required. # Note that only the first value of any range is given, this may be changed if # required # Don't forget to uncomment the activate (ACT Y) when happy (CONFIGURE CTL009e/386849652 (LD 0 # ANSI string -->Audio<-- # Multiple choice time, choose one only ! # Start dependent functions: priority preferred # IRQ 5. # High true, edge sensitive interrupt (by default) (INT 0 (IRQ 5 (MODE +E))) # First DMA channel 1. # 8 bit DMA only # Logical device is not a bus master # DMA may execute in count by byte mode # DMA may not execute in count by word mode 261 10. Linux and Hardware # DMA channel speed in compatible mode (DMA 0 (CHANNEL 1)) # Next DMA channel 5. # 16 bit DMA only # Logical device is not a bus master # DMA may not execute in count by byte mode # DMA may execute in count by word mode # DMA channel speed in compatible mode (DMA 1 (CHANNEL 5)) # Logical device decodes 16 bit IO address lines # Minimum IO base address 0x0220 # Maximum IO base address 0x0220 # IO base alignment 1 bytes # Number of IO addresses required: 16 (IO 0 (SIZE 16) (BASE 0x0220)) # Logical device decodes 16 bit IO address lines # Minimum IO base address 0x0330 # Maximum IO base address 0x0330 # IO base alignment 1 bytes # Number of IO addresses required: 2 (IO 1 (SIZE 2) (BASE 0x0330)) # Logical device decodes 16 bit IO address lines # Minimum IO base address 0x0388 # Maximum IO base address 0x0388 # IO base alignment 1 bytes # Number of IO addresses required: 4 (IO 2 (SIZE 4) (BASE 0x0388)) # End dependent functions (NAME "CTL009e/386849652[0]{Audio }") (ACT Y) )) ## Logical device id CTL7002 # Device supports vendor reserved register @ 0x39 # Device supports vendor reserved register @ 0x3a # Device supports vendor reserved register @ 0x3b # Device supports vendor reserved register @ 0x3c # Device supports vendor reserved register @ 0x3d ## Edit the entries below to uncomment out the configuration required. # Note that only the first value of any range is given, this may be changed if # required # Don't forget to uncomment the activate (ACT Y) when happy (CONFIGURE CTL009e/386849652 (LD 1 # Compatible device id PNPb02f # ANSI string -->Game<-- # Multiple choice time, choose one only ! # Start dependent functions: priority preferred # Logical device decodes 16 bit IO address lines # Minimum IO base address 0x0200 # Maximum IO base address 0x0200 # IO base alignment 1 bytes # Number of IO addresses required: 8 (IO 0 (SIZE 8) (BASE 0x0200)) # End dependent functions (NAME "CTL009e/386849652[1]{Game }") 262 10.3. Sound Cards (ACT Y) )) ## Logical device id CTL0023 # Device supports vendor reserved register @ 0x38 # Device supports vendor reserved register @ 0x3a # Device supports vendor reserved register @ 0x3b # Device supports vendor reserved register @ 0x3c # Device supports vendor reserved register @ 0x3d ## Edit the entries below to uncomment out the configuration required. # Note that only the first value of any range is given, this may be changed if # required # Don't forget to uncomment the activate (ACT Y) when happy (CONFIGURE CTL009e/386849652 (LD 2 # ANSI string -->WaveTable<-- # Multiple choice time, choose one only ! # Start dependent functions: priority preferred # Logical device decodes 16 bit IO address lines # Minimum IO base address 0x0620 # Maximum IO base address 0x0620 # IO base alignment 1 bytes # Number of IO addresses required: 4 (IO 0 (SIZE 4) (BASE 0x0620)) (IO 1 (BASE 0x0a20)) (IO 2 (BASE 0x0e20)) # End dependent functions (NAME "CTL009e/386849652[2]{WaveTable }") (ACT Y) )) # End tag... Checksum 0x00 (OK) # Returns all cards to the "Wait for Key" state (WAITFORKEY) ­ PCI bus-based sound cards: PCI sound cards are very easy to configure. The PCI bus is automati- cally configured by the computer and thus distributes the resources of individual cards. Via defined software interfaces the drivers can query the resources of the card. * Installing/loading the driver: In the final configuration step the driver modules must be informed about the hardware configuration. This takes place through corresponding en- tries in the file /etc/modules.conf. ­ ISA and P'n'P cards: Pre-compiled modules for the card types supported by the kernel are supplied with (package kernmod). After you have installed the kernel sources, you will find detailed documentation in the package sources (package lx suse)in the directory /usr/src/linux/ Documentation/sound. You should verify that in the file /etc/modules.conf the aliases for sound are not set to off; if necessary, you should comment these 263 10. Linux and Hardware alises out by putting a `#' sign as can be seen in file File con- tents 10.3.1 page 266. If you have a card from the Soundblaster 16 family, for instance, then you can load the drivers for the functions contained on the card (audio, MPU401 and synthesizer) with the following command, for example: earth:/ # modprobe sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330 With this command the actual driver for the Soundblaster 16 is loaded. The same module, incidentally, is needed for the AWE64. The driver for the MPU401 is contained in the Soundblaster driver. The drivers needed for the proper functioning of the sound card, uart401, sound, soundlow and soundcore, are loaded automatically. These modules make a number of low-level as well as functions common to all sound modules. With the command earth:/ # lsmod you can verify if these modules really were loaded. earth:/ # modprobe adlib_card io=0x388 This command loads the module for the synthesizer contained on the card. The drivers listed in Table 10.1 page 276 are currently available. A list of possible parameters for specific modules can be found in the chapter on kernel parameters (Section 14.3.4 page 339). * PCI Cards There now follows a step-by-step guide to the configuration of sound cards, using as an example the Creative Soundblaster PCI 64/128: The sound cards Soundblaster PCI 64/128 contain sound chips of the type ES1370 or ES1371. 1. Check the label on the sound chip to see if it is type ES1370 or ES1371. Then install the card . . . 2. Modify the file /etc/modules.conf. At about line 38 you will find the following entries: alias char-major-14 off alias sound off alias midi off Change these as follows: # alias char-major-14 off # alias sound off # alias midi off From about line 100 the configuration of sound card modules begins. Change # alias char-major-14 es1370 to alias char-major-14 es1370 by removing the comment symbol, "#". If you have the ES1371 chip on your card, you should proceed as above, but use the next entry for the module es1371.o. 264 10.3. Sound Cards 3. Start the mixer. An lsmod should produce the following output: Module Size Used by es1370 21748 1 (autoclean) soundcore 2084 4 (autoclean) [es1370] ... Screen output 10.3.1: Output of the command lsmod 4. If this does not work immediately, try again, using depmod -a 5. Try to get some sounds from your computer with kscd, x11amp, or similar programs. Make sure that you check the settings of the mixer (if all the channels are turned down, even the best of sound drivers won't be any use ;-)) Please note that cards which need the modules es1370.o or es1371.o are not automatically recognized by KDE, because these modules are not available to the device file, /dev/sndstat. ­ To still be able to enjoy system sounds in KDE, you must change the file /opt/kde/ bin/startkde in the following way: Look for the lines startifaudio kaudioserver startifaudio kwmsound and modify these to kaudioserver & kwmsound & The Creative Soundblaster Live! sound card is supported by an adapter specially developed by Creative Labs themselves. You should install the package emu10k1 in the series snd, using YaST. Further informa- tion on how to install this driver can be found in the file /usr/doc/ packages/emu10k1/README.SuSE. Check to See If It Worked: You have now loaded all of the necessary modules and want to see if you can really get sound out of this thing. Execute the following command: earth:/ # cat /dev/sndstat This should ­ in the case of a Sound Blaster 16 ­ result in an output similar to the one shown in Output 10.3.2 on the following page. If this command resulted in the desired output, you can try and play an audio file (which can be found in the series snd, in the package snd au, pack- age snd wav and package snd mod): you will need to have the package package sox from the series series snd installed: earth:/ # cat /usr/share/sounds/au/swedish.au > /dev/audio earth:/ # cat /usr/share/sounds/wav/applause.wav > /dev/dsp earth:/ # tracker /usr/share/sounds/mod/rebels.mod Midi files can can be easily played with the KDE programs kmid, as long as your card supports this function. 265 10. Linux and Hardware [...] Audio devices: 0: Sound Blaster 16 (4.13) (DUPLEX) Synth devices: 0: Yamaha OPL3 Midi devices: 0: Sound Blaster 16 Timers: 0: System clock Mixers: 0: Sound Blaster Screen output 10.3.2: Output from the command cat /dev/sndstat If the results from cat /dev/sndstat are as desired and the command cat mysong.au > /dev/audio does not produce any error messages, but you still have no sound, you should try to start the audiomixer in the KDE panel. It is possible that the volume is simply not turned up high enough. Automatically Loading the Kernel Module If you are sure that your sound card is fully supported by the existing drivers, you can have the corresponding module(s) automatically loaded by editing the appropriate line in the file /etc/modules.conf. For the Soundblaster 16 card, an example of this file is shown in File contents 10.3.1. # alias char-major-14 off # alias sound off # alias midi off alias char-major-14 sb post-install sb /sbin/modprobe "-k" "adlib_card" options sb io=0x0220 irq=7 dma=1 dma16=5 mpu_io=0x0330 options adlib_card io=0x0388 # FM synthesizer File contents 10.3.1: /etc/modules.conf: Options for sound modules A general rule as to what functionality is provided by which sound card, does not exist. You therefore need to find out yourself, using the doc- umentation of the card, as well as information in /usr/src/linux/ Documentation/sound, which modules you still need to load. Many tips can also be found in the source files of the drivers in /usr/src/linux/ drivers/sound. However, there are some pre-defined entries in the file /etc/modules.conf which you can adapt accordingly. Instead of loading via /etc/modules.conf it is also possible to load them by entering one of the above-mentioned modprobe commands in the file /sbin/init.d/boot.local (see Section 17.4 page 397 pp.). 10.4 Ports on a Computer 266 10.4. Ports on a Computer 10.4.1 PS/2 Ports PS/2 ports were developed by IBM for the PS/2 platform. The ATX Standard, in which this type of port is included, has found widespread use in the last few years. You can attach a mouse and a keyboard on the PS/2 port. Configuring the PS/2 port is not necessary under Linux because it is supported by the kernel. The system automatically detects existing PS/2 ports and can control the devices attached to them. The ports can be found and addressed under the device name /dev/kbd and /dev/psaux . 10.4.2 Serial Ports The Serial port (RS232) of your computer is often used for external modems. You can also attach a mouse with an RS232 plug on this port. For the support of this port in Linux, installation of the kernel module serial.o is required. This module is automatically loaded when the port is addressed by certain software. For instance, supposing you've configured your Internet access such that a modem on COM1 is used, the module is auto- matically post-installed before the connection to your provider is established. You can change your serial port configuration using the program setserial. This program is run at every system start by the script/sbin/init.d. For more information on setserial see the manpage for this program. Serial ports can be found and addressed under the device file(s) /dev/ttyS0, /dev/ttyS1 ... etc. 10.4.3 Parallel Ports The parallel port of your computer is primarily used to connect printers. Many other devices such as ZIP-Drives and CD-ROM/RAM Drives can also be connected to this port. The "parport" subsystem of the current Linux-kernels 2.2.xx is designed to operate a number of devices on the parallel port simultaneously.1 As an ex- ample, you can have a printer attached to a zip drive the ZIP-drive connected to the parallel port. Initializing parport The parport and parport pc kernel support are required for this,2, whereby parport is the actual subsystem of the kernel, and parport pc takes care of the hardware connections of the PC port, and also for those of some AXP computers. With the command earth: # modprobe parport pc you can attach the modules manually. Check if the ports could be found and configured by entering the command lsmod; the parport and parport pc ought to appear in the list of modules. You can also look in the file /var/log/messages to check which values were used to initialize parport (cf. File contents 10.4.1 on the next page). 267 10. Linux and Hardware Jun 3 09:15:53 tux kernel: parport0: PC-style at 0x378 [SPP, ECP] File contents 10.4.1: /var/log/messages: parport initialization alias parport_lowlevel parport_pc options parport_pc io=0x378 irq=none # If you have multiple parallel ports, specify them this way: # options parport_pc io=0x378,0x278 irq=none,none File contents 10.4.2: /etc/modules.conf: parport configuration File contents 10.4.2 is responsible for the configuration of this port; the un- commented entries give tips on how to configure a second parallel port. In case of problems, you should first check in the BIOS of the computer how the port in question is specified there. The port should have its own explicit address (if possible, 0x378) and its own interrupt. "Automatic" settings should be avoided. Sometimes it is also necessary to switch on the devices in the correct se- quence; please look in the appropriate handbooks! One recommended method is to first switch on the computer, and then ­ before booting has commenced ­ to immediately switch on the external devices! Using parport: Printers, ZIP Drives, PLIP, etc. If one parallel port device is to be used, its relevant module must also be loaded; in the case of a printer, this is the lp-module: earth: # modprobe lp lsmod ought to show us, amongst other things: parport_pc 5568 1 (autoclean) parport 6884 1 [parport_pc lp] lp 5116 0 (unused) As with other cases, further details are supplied in the file /var/log/ messages and also in the proc file system in /proc/parport. If ev- erything is running correctly, you won't need to load the modules manually ­ Kmod will do this for you automatically (cf. Section 13.2 page 319) if, for example, a printer job is sent. ZIP-drives are not served either by ppa or by imm ­ cf. below, Section 10.5.3 on the facing page. 1 For the "old" kernel 2.0.xx only one device can be used exclusively on a port; as a rule "multiple" connections also cannot be used! 2 You don't need to compile your own kernel; the necessary modules are pre-compiled and are included in SuSE Linux! 268 10.5. Removable Drives Further Suggestions Look in the kernel sources, in the directory /usr/src/linux/Documentation, at the files parport.txt and paride.txt. Information on the current status of parport-programming can be found in the WWW at http://www.torque.net/linux-pp.html and http://www.torque.net/parport/. 10.4.4 USB ­ Universal Serial Bus The Universal Serial Bus has been one of the most important innovations on the PC market in the last few years. With the assistance of a USB port you can easily attach a variety of devices; mouse, keyboard, printer or scanner, to the computer. All of these devices have the same plug and cable type so the current variety of cables such as RS232 or Centronic are no longer needed. With this Bus you can connect and disconnect devices whilst the system is running. For instance, it is possible to connect and/or disconnect the printer without having to reboot. The support of this bus system in Linux is unfortunately not complete. For this reason devices on the bus port will not yet function in Linux. More details on USB in Linux can be found on the Internet at the address: http: //www.linux-usb.org/. 10.5 Removable Drives A variety of removable drives can be used under Linux: Floppy Disk Drives, ZIP-, JAZ- or SyQuest Drives. Magnetic Optical drives can also be used in Linux. 10.5.1 Floppy Disk Drives The package package mtools was developed for easy access of MS-DOS formatted floppy disks. Detailed information on the posibilities and use of these programs can be found in Section 19.12 page 445. You can also read and write to disks formatted with non-MS-DOS filesystems (e.g. ext2 or minix). Many other filesystems area also available. In order to accomplish this, however, you'll first need to use the command mount to access the medium; Section 19.11 page 442 offers detailed information. 10.5.2 LS-120 Drives LS-120 drives are connected at the (E)IDE port of the computer and are seen by the system as hard drives which means that they, too, need to be accessed first with the command mount. 10.5.3 ZIP Drives There are ZIP drives for different interfaces; parallel, ATAPI and SCSI, as well as USB (although it is not currently supported). 269 10. Linux and Hardware The ATAPI and SCSI ZIP drives need no additional device driver. They can be connected on the bus and addressed without extra configuration using the bus's device driver (IDE or SCSI).The devices are addressed by the device names, /dev/hda - /dev/hdd for ATAPI and /dev/sda - /dev/sdm for SCSI The device needs to be tied into the directory tree with the command mount). The installation of the parallel port version proves to be somewhat more com- plicated; you'll need SCSI hard drive support, parport- , parport pc support (see Section 10.4.3 page 267) as well as ppa or the imm driver of the kernel 3; imm is needed for more modern drives (e. g. for the ZIP 250). Furthermore you should make sure that in the BIOS of the computer the EPP mode for the parallel port is set. If you are unsure as to which kind of drive you have, try loading imm: earth: # modprobe imm If this doesn't work try the same with ppa: earth: # modprobe ppa With this, the parport subsystem will be automatically initialized; If this does not function, look at Section 62 page 267 pp.). Sometimes an entry in /etc/modules.conf can help matters (cf. File contents 10.5.1). The alias scsi hostadapter may only be used if you don't have a standard SCSI host adapter in your system! An alternative is to write the necessary modprobe commands into the boot-script /sbin/ init.d/boot.local; For more information on this file, see Section 17.4 page 397 pp. # alias scsi_hostadapter ppa pre-install ppa modprobe "-k" parport_pc File contents 10.5.1: /etc/modules.conf: ppa-Konfiguration After this ZIP disks can be accessed in the same manner as SCSI hard drives; it is also necessary to "mount" the medium. (see also Section 19.11.2 page 444) 10.6 Modems 10.6.1 External Modems External modems are normally attached directly to the serial port of the computer. Programs can address them via device files with the name(s) 3 ppa- and/or the imm driver are contained in the "SCSI low-level drivers" ­ but you don't need to compile your own kernel; the necessary modules are pre-compiled and included with SuSE Linux 270 10.6. Modems /dev/ttyS0, /dev/ttyS1. etc. For further information on configuring a modem for an Internet connection, see Section 6.5 page 162. 10.6.2 Internal Modems Internal modems in desktop machines are either PCI or ISA devices. Please see Section 10.2 page 255 for information about these devices. Since modems are accessed through serial ports, internal modems must make these ports available for themselves. Table 10.2 page 277 gives you a list of standard resources for serial ports. PCI Modems If you have a PCI modem, it is most likely a "Winmodem". Winmodems are not modems. They are hardware devices which need a special driver that allows them to emulate a real modem. This driver is generally written by the makers of the Winmodem and currently only runs on Microsoft Windows. You can obtain current information about Linux compatible modems and development of Winmodem drivers at: http://www.o2.net/ gromitkc/winmodem.html. ISA Modems With ISA modems, there are two main considerations: * The modem itself needs to be configured (IRQ and IO Addresses for the port). * The kernel needs to know what IRQ and port the card is using. Initialising the Modem As described in Section 10.2 page 255, ISA cards can be jumpered, jumper- less or Plug and Play. Also described in that section is the initializing of PNP cards. Some suggestions about settings: Setting your modem to use /dev/ttyS1 (COM2) with an IRQ of 3 will usually present the least number of problems. /dev/ttyS3 (IRQ 4) can also be used, though you may have a conflict if you are also using ttyS0 (COM1), as this port also normally uses IRQ 4. So if you have mouse on /dev/ttyS0 you should not use /dev/ttyS0 or /dev/ttyS2. Generally, you do not want to use IRQ 5 because of possible conflicts with soundcards. In fact, if you are going to use a sound card, you should configure it first, as it wants to claim many resources. Finally, if you have a PNP sound card, and are using OSS for sound, make sure that the sound card configuration items in /etc/isapnp.conf are NOT activated (the line(s) with ACT Y associated with the sound card should be commented out). 271 10. Linux and Hardware Passing Parameters to the Kernel After you have established the port and IRQ for your modem, you need to tell the kernel what values the card is using. If you have used a standard port and IRQ (/dev/ttyS0 or /dev/ttyS1), your card will be automatically recognized the next time you reboot. If you are using other IO-port/IRQ combinations, you can manually tell the kernel the device's IRQ, using setserial: earth:/ # setserial /dev/ttyS3 irq 10 You can now configure the modem for Internet connection ­ as described in Section 6.5 page 162. If the modem is recognized, you can automate the setserial command by modifying the appropriate line in the file /sbin/init.d/serial: Change the line: # run_setserial /dev/ttyS3 $AUTO_IRQ autoconfig to: run_setserial /dev/ttyS3 irq 10 10.7 Scanners In order to use a scanner in Linux, as well as any other operating system, a collection of special drivers and programs is needed. The package package sane (series gra) offers such a collection. With the help of SANE you can, in Linux, use a scanner that is connected to a kernel-supported SCSI adapter. Scanners that are connected to the parallel port (printer port) of the computer are not yet supported although device drivers are in development, the same as for USB. Because SANE is in continual development the list of supported scanners are growing. For a list of the latest supported scanners go to http://www. mostang.com/sane/sane-backends.html. How Do You Configure a Scanner In Linux? Scanners are addressed as "generic scsi devices" in Linux. The respective device names are: /dev/sg0, /dev/sg1 ...etc. You can check your systems device names with the program sgcheck : earth:/ # sgcheck You should receive the following output: Assignment of generic SCSI devices, device host/channel/ID/LUN type(numeric type) vendor model: /dev/sg0 0/0/0/0 Direct-Access(0) SEAGATE ST32550N /dev/sg1 0/0/1/0 CD-ROM(5) PIONEER CD-ROM DR-U10X /dev/sg2 0/0/5/0 Processor(3) HP C2500A 272 10.8. Tape Drives Scanners have a device description like Processor or SCANNER. In the example above you could address the scanner with the device name /dev/ sg2. You need to make a symbolic link to the device to /dev/scanner: earth:/ # ln -s /dev/sg2 /dev/scanner Lastly, you need to change the permissions for the generic SCSI device. SANE needs read as well as write permissions for the device (it sends com- mands to the scanner as well as receiving information): earth:/ # chmod 777 /dev/sg2 Problems If SANE doesn't find your scanner you should check first to make sure that your SCSI controller is found and correctly configured: earth:/ # cat /proc/scsi/scsi You should receive output that resembles the following: Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: SEAGATE Model: ST32550N Rev: 0016 Type: Direct Access ANSI SCSI revision: 02 Host: scsi0 Channel: 00 Id: 01 Lun: 00 Vendor: PIONEER Model: CD-ROM DR-U10X Rev: 1.07 Type: CD-ROM ANSI SCSI revision: 02 Host: scsi0 Channel: 00 Id: 02 Lun: 00 Vendor: QUANTUM Model: FIREBALL TM3200S Rev: 1.07 Type: Direct-Access ANSI SCSI revision: 02 Host: scsi0 Channel: 00 Id: 06 Lun: 00 Vendor: SCANNER Model: Rev: 2.00 Type: Scanner ANSI SCSI revision: 01 CCS If you can't find an entry like "SCANNER" or "PROCESSOR" , then your scanner hasn't been identified by the SCSI controller. Check to see that the scanner is on and that it, as well as the SCSI bus itself, are correctly attached. 10.8 Tape Drives Tape drives, also known as streamers, are mainly used for higher capacity backup purposes. There are tape drives on the market for a variety of ports. SCSI Tape Drives Tape Drives that attach to the SCSI bus are the most widely spread. Primarily, you can assume that all devices that are attached to a Linux supported SCSI controller can also be used, although if your device has extra functions you will need special software to access these. A SCSI tape drive is controlled in the following way: * The first tape drive in the system is controlled using the device files /dev/st0 and /dev/nst0, the next with /dev/st1 and /dev/ nst1 etc. /dev/stX stands for a drive that automatically rewinds after 273 10. Linux and Hardware use. /dev/nstX on the other hand stands for a tape drive that leaves the tape in the current position after use. We suggest using /dev/nstX, because, using mt, you have exact con- trol of the drive. * Using the program mt to control a tape drive: earth:/ # mt -f /dev/nst0 retension Adjusts the tape-tension by rewinding and then fast-forwarding the tape. earth:/ # mt -f /dev/nst0 rewind Moves the tape to a point just after the last recorded information. Used to add information to a partially used tape. earth:/ # mt -f /dev/nst0 eof Moves the tape to a point just after the last recorded information. Used to add information to a partially used tape. earth:/ # mt -f /dev/nst0 erase Erases all information on a tape. Be careful, there is no way to recover erased information! IDE Tape Drives IDE tape drives are connected to the IDE bus of the computer. The drive is found automatically by Linux. You can address the device under the device files /dev/ht0 or /dev/nht0. You can control the device using the command mt, as given in Section 10.8 on the page before. Floppy Tape Drives Floppy tape drives are simply attached to the floppy disk port of your com- puter (almost every computer has a floppy port). Because these devices need to be controlled with precise timing, errors often occur while saving and writing backups. To use these devices in Linux you'll need a a special driver, the ftape driver. This driver is included in the kernel. Read the documentation in /usr/src/ linux/Documentation/ftape.txt for more information on the con- figuration of this device. The entire documentation for the ftape subsystem can be found on the device driver developers' homepage: http://www. math1.rwth-aachen.de/ heine/ftape/. 10.9 TV Cards One recent development in Linux is the ability, with the help of a TV card, to watch TV in the graphical interface (X Window System). This is pos- sible with the use of a number of kernel modules, as well as the necessary programs. 274 10.9. TV Cards Which TV Cards Are Supported? Essentially, support for a card is based upon which chip the card uses. The most widely used chips in the last few years have been the grabber chips from the company Brooktree. In Linux you can use the BT848 and "BT878" chips. Support for the BT878 are not quite finished although it is already seen as stable. Typical cards using this chip are the Hauppauge WIN/TV or Miro PC/TV. How to Enable Support * Log in as user `root'. * Install the package bttv in the series gra with YaST. * Change to the directory /usr/doc/packages/bttv/tools and start the program update: earth:/ # cd /usr/doc/packages/bttv/tools earth:/usr/doc/packages/bttv/tools # ./update This script prepares your computer for the use of a TV card. It determines which card is in your system and loads the necessary modules. If problems occur pay close attention to the documentation found in the direc- tory /usr/doc/packages/bttv/doc. Additional information is avail- able in our Support Database at http://sdb.suse.de/en/html/. (keyword: tv). 275 10. Linux and Hardware ad1816.o AD1816 Chip (e. g. TerraTec Base1/64) ad1848.o AD1848 Chip (MSS) adlib_card.o Generic OPLx driver cmipci.o CMI8338, experimental (?) cs4232.o Crystal 423x chipsets es1370.o Ensoniq 1370 chipsets (see PCI64/128) es1371.o Creative Ensoniq 1371 chipsets (see PCI64/128) esssolo1.o Solo1 ES1938/ES1969 gus.o Gravis Ultrasound mad16.o MAD16 maui.o Turtle Beach Maui and Tropez mpu401.o MPU401 msnd.o Turtle Beach MultiSound msnd_classic.o Turtle Beach Classic/Monterey/Tahiti msnd_pinnacle.o Turtle Beach Pinnacle/Fiji msnd_pinnacle.o Turtle Beach Pinnacle/Fiji nm256.o Neo Magic opl3.o OPL3 opl3sa.o OPL3-SA1 opl3sa2.o YMF711, YMF715, YMF719, OPL3-SA2, OPL3-SA3, OPL3-SAx pas2.o Pro Audio Spectrum pss.o Personal Sound System (ECHO ESC614) sb.o Sound Blaster and clones sgalaxy.o Aztech Sound Galaxy softoss2.o Software-MIDI-Synthesizer driver sonicvibes.o S3 Sonic Vibes sound.o contains the functions needed by all modules Functions soundlow.o Lowlevel-Sound Driver soundcore.o Top Level handler for sound system sscape.o Ensoniq SoundScape trix.o MediaTrix AudioTrix Pro uart401.o UART401 uart6850.o UART6850 v_midi.o Sound Blaster DSP chips wavefront.o Turtle Beach Maui, Tropez, Tropez Plus Table 10.1: List of sound card drivers 276 10.9. TV Cards Geršatedatei Name Interrupt IO-Adresse /dev/ttyS0 COM1 4 0x3f8 /dev/ttyS1 COM2 3 0x2f8 /dev/ttyS2 COM3 4 0x3e8 /dev/ttyS3 COM4 3 0x2e8 Table 10.2: Standard resources for serial ports 277 10. Linux and Hardware 278