Plug-and-Play Hardware

How to make those pesky new PnP sound cards work and play well on your Linux box.

Chances are, you or someone you know has had to deal with plug-and-play (PnP) hardware. These devices are just like “legacy” devices, except they have no jumpers to configure the resources (i.e., IRQs, DMAs and I/O addresses). PnP cards expect the computer, either the BIOS or the operating system, to find and configure the card. It's an excellent idea, but why?

Most Linux users enjoy configuring their computers—getting their hands dirty working with the hardware. On the other side of the coin is the user who expects his computer to turn on in the morning and be ready for him to complete his work without intervention by him. This type of user will also add hardware to his computer, but does not want to spend time finding free resources and setting them. PnP hardware is ideal for him.

This user can purchase a plug-and-play device, put it in his computer, and the configuration is done automatically. This idea of automatic configuration was designed into the PCI bus, the newer of the common busses. Unfortunately, most users still rely on the standard architecture defined by the industry; that is, the ISA bus. It works well, but still has its limitations. Most notably, plug-and-play was not considered when ISA was designed.

The designers of the plug-and-play standard decided to extend plug-and-play to ISA devices. Wouldn't it be nice to have some sort of detection and configuration scheme to find these devices and set them up for the user? Think how easy computers would be! So, the designers set up a scheme to find ISA cards and configure them to the jumpered resources on the card. Hardware vendors loved the idea and decided to cooperate by suggesting the removal of all the jumpers.

Now we have a fully functional plug-and-play system for the ISA bus, right? Well, not exactly. It still has a way to go before it is all the way out the door. PCI architecture will take over in the next few years before plug-and-play ISA works without any problems. For now, we have to work with these plug-and-play ISA devices while mourning the loss of our beloved jumpers.

Using Plug-and-Play Devices

PnP ISA devices can be used in several ways under Linux. The kernel can find and configure them before loading any other drivers. This method sometimes fails to find all devices and to initialize the devices. It also requires patching the kernel with one of the PnP add-ons.

Another way, which I recommend, is to use an initialization program at the user level. You create a configuration file with your devices and specify the resources each device is to use. Then, this file is read by an initialization utility that configures the devices. However, this method does require the drivers for these devices to be compiled as kernel modules.

I have tried a couple of these user-level configuration programs, and the one I have found to be the easiest and most reliable is the isapnptools package. This program is designed to work on systems with or without a PnP-compatible BIOS. It will not interfere with “legacy” ISA devices either (devices with jumpers); at least, I have not had that problem.

As an example, I will configure a PnP sound card and load the driver for it. I will assume you can install the card and you have a working knowledge of Linux. Here's a basic overview of the setup process:

  • getting the isapnptools package

  • dumping all possible values

  • choosing your resources

  • testing the configuration

  • compiling the kernel driver

  • enabling the device at bootup

Getting the isapnptools Package

Most of the latest Linux distributions come with the isapnptools package. However, you may want to grab the latest version from the isapnptools web page, http://www.roestock.demon.co.uk/isapnptools/. At the time of this writing, the latest version is 1.17.

After downloading the file, extract the contents and compile it. Some systems may require editing the Makefile. Check the included INSTALL file for more information. As root, I used the following commands to compile and install the package:

tar xvzf isapnptools-1.17.tar.gz
cd isapnptools-1.17
make
make install (as root)

The installation will create the isapnp and pnpdump programs along with their accompanying man pages and sample configuration file.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi, friend I appreciate your

Vajinder Dutt's picture

Hi, friend

I appreciate your contribution

I'm using Ubuntu Intrepid Ibex. Everything is good except sound. My sound card is Crystal CS 4235. I hear drum sound only at the login screen. There after no sound. Volume control carries a red mark when I click it it reads :"No volume control GStreamer plugins and/or devices found"
$aplay -l output is:
aplay: device_list:215: no soundcards found...

----------------------------------------------------------------------
My isapnp.conf file shows:

# $Id: pnpdump_main.c,v 1.27 2001/04/30 21:54:53 fox Exp $
# Release isapnptools-1.27
#
# This is free software, see the sources for details.
# This software has NO WARRANTY, use at your OWN RISK
#
# For details of the output 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 -DHAVE_PROC -DENABLE_PCI -DHAVE_SCHED_SETSCHEDULER -DHAVE_NANOSLEEP -DWANT_TO_VALIDATE
#
# Trying port address 0273
# Board 1 has serial identifier a9 ff ff ff ff 36 42 63 0e

# (DEBUG)
(READPORT 0x0273)
(ISOLATE PRESERVE)
(IDENTIFY *)
(VERBOSITY 2)
(CONFLICT (IO FATAL)(IRQ FATAL)(DMA FATAL)(MEM FATAL)) # or WARNING

# Card 1: (serial identifier a9 ff ff ff ff 36 42 63 0e)
# Vendor Id CSC4236, No Serial Number (-1), checksum 0xA9.
# Version 1.0, Vendor version 0.5
# ANSI string -->Crystal Codec<--
#
# Logical device id CSC0000
# Device supports vendor reserved register @ 0x38
# Device supports vendor reserved register @ 0x3c
# Device supports vendor reserved register @ 0x3e
#
# 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 CSC4236/-1 (LD 0
# ANSI string -->WSS/SB<--

# Multiple choice time, choose one only !

# Start dependent functions: priority preferred
# 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
# DMA channel speed type A
# (DMA 0 (CHANNEL 1))
# Next DMA channel 0 or 3.
# 8 bit DMA only
# Logical device is a bus master
# DMA may execute in count by byte mode
# DMA may not execute in count by word mode
# DMA channel speed type A
# (DMA 1 (CHANNEL 0))
# IRQ 5.
# High true, edge sensitive interrupt (by default)
# (INT 0 (IRQ 5 (MODE +E)))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0534
# Maximum IO base address 0x0534
# IO base alignment 4 bytes
# Number of IO addresses required: 4
# (IO 0 (SIZE 4) (BASE 0x0534))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0388
# Maximum IO base address 0x0388
# IO base alignment 8 bytes
# Number of IO addresses required: 4
# (IO 1 (SIZE 4) (BASE 0x0388))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0220
# Maximum IO base address 0x0220
# IO base alignment 32 bytes
# Number of IO addresses required: 16
# (IO 2 (SIZE 16) (BASE 0x0220))

# Start dependent functions: priority acceptable
# First DMA channel 1 or 3.
# 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
# DMA channel speed type A
# (DMA 0 (CHANNEL 1))
# Next DMA channel 0, 1 or 3.
# 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
# DMA channel speed type A
# (DMA 1 (CHANNEL 0))
# IRQ 5, 7, 9, 11, 12 or 15.
# High true, edge sensitive interrupt (by default)
# (INT 0 (IRQ 5 (MODE +E)))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0534
# Maximum IO base address 0x0ffc
# IO base alignment 4 bytes
# Number of IO addresses required: 4
# (IO 0 (SIZE 4) (BASE 0x0534))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0388
# Maximum IO base address 0x0388
# IO base alignment 8 bytes
# Number of IO addresses required: 4
# (IO 1 (SIZE 4) (BASE 0x0388))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0220
# Maximum IO base address 0x0260
# IO base alignment 32 bytes
# Number of IO addresses required: 16
#(IO 2 (SIZE 16) (BASE 0x0220))

# Start dependent functions: priority functional
# First DMA channel 0, 1 or 3.
# 8 bit DMA only
# Logical device is a bus master
# DMA may execute in count by byte mode
# DMA may not execute in count by word mode
# DMA channel speed type A
# (DMA 0 (CHANNEL 0))
# IRQ 5, 7, 9, 11, 12 or 15.
# High true, edge sensitive interrupt (by default)
# (INT 0 (IRQ 5 (MODE +E)))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0534
# Maximum IO base address 0x0ffc
# IO base alignment 4 bytes
# Number of IO addresses required: 4
# (IO 0 (SIZE 4) (BASE 0x0534))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0388
# Maximum IO base address 0x03f8
# IO base alignment 8 bytes
# Number of IO addresses required: 4
# (IO 1 (SIZE 4) (BASE 0x0388))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0220
# Maximum IO base address 0x0300
# IO base alignment 32 bytes
# Number of IO addresses required: 16
# (IO 2 (SIZE 16) (BASE 0x0220))

# End dependent functions
(NAME "CSC4236/-1[0]{WSS/SB }")
# (ACT Y)
))
#
# Logical device id CSC0001
# Device supports vendor reserved register @ 0x39
# Device supports vendor reserved register @ 0x3c
# Device supports vendor reserved register @ 0x3e
#
# 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 CSC4236/-1 (LD 1
# 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 8 bytes
# Number of IO addresses required: 8
# (IO 0 (SIZE 8) (BASE 0x0200))

# Start dependent functions: priority acceptable
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0208
# Maximum IO base address 0x0208
# IO base alignment 8 bytes
# Number of IO addresses required: 8
# (IO 0 (SIZE 8) (BASE 0x0208))

# End dependent functions
(NAME "CSC4236/-1[1]{GAME }")
# (ACT Y)
))
#
# Logical device id CSC0010
# Device supports vendor reserved register @ 0x38
# Device supports vendor reserved register @ 0x3c
# Device supports vendor reserved register @ 0x3e
#
# 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 CSC4236/-1 (LD 2
# ANSI string -->CTRL<--
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0120
# Maximum IO base address 0x0ff8
# IO base alignment 8 bytes
# Number of IO addresses required: 8
# (IO 0 (SIZE 8) (BASE 0x0120))
(NAME "CSC4236/-1[2]{CTRL }")
# (ACT Y)
))
#
# Logical device id CSC0003
# Device supports vendor reserved register @ 0x38
# Device supports vendor reserved register @ 0x3c
# Device supports vendor reserved register @ 0x3e
#
# 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 CSC4236/-1 (LD 3
# ANSI string -->MPU<--

# Multiple choice time, choose one only !

# Start dependent functions: priority preferred
# IRQ 9.
# High true, edge sensitive interrupt (by default)
# (INT 0 (IRQ 9 (MODE +E)))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0330
# Maximum IO base address 0x0330
# IO base alignment 8 bytes
# Number of IO addresses required: 2
# (IO 0 (SIZE 2) (BASE 0x0330))

# Start dependent functions: priority acceptable
# IRQ 9, 11, 12 or 15.
# High true, edge sensitive interrupt (by default)
# (INT 0 (IRQ 9 (MODE +E)))
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0330
# Maximum IO base address 0x0360
# IO base alignment 8 bytes
# Number of IO addresses required: 2
# (IO 0 (SIZE 2) (BASE 0x0330))

# Start dependent functions: priority functional
# Logical device decodes 16 bit IO address lines
# Minimum IO base address 0x0330
# Maximum IO base address 0x03e0
# IO base alignment 8 bytes
# Number of IO addresses required: 2
# (IO 0 (SIZE 2) (BASE 0x0330))

# End dependent functions
(NAME "CSC4236/-1[3]{MPU }")
# (ACT Y)
))
# End tag... Checksum 0x00 (OK)

# Returns all cards to the "Wait for Key" state
(WAITFORKEY)

----------------------------------------------------------------------

And my lspnp -v output is:

01:01.00 CSC0000 Crystal PnP audio system CODEC
state = active
dma 1
dma 3
irq 5
io 0x534-0x537
io 0x388-0x38b
io 0x220-0x22f

01:01.01 CSC0001 Crystal PnP audio system joystick
state = disabled

01:01.02 CSC0010 Crystal PnP audio system control registers
state = active
io 0x120-0x127

01:01.03 CSC0003 Crystal PnP audio system MPU-401 compatible
state = active
io 0x330-0x331

--------------------------------------------------------------------

I don't know what to do with isapnp.conf file. Which lines are to be uncommented?

Re: Strictly On-Line: Plug-and-Play Hardware

Anonymous's picture

Thank you for a plain easy explanation that a newbie can understand!!

Re: Strictly On-Line: Plug-and-Play Hardware

Anonymous's picture

Your explanation is very good. However, when I do the command "modprobe sb.o io=0x220 irq=5 dma=1" it always tells me "Can't locate module sb.o". It tells me that even if I specify another module, such as sound.o or whatever. I check whether the module is installed or not, and it's actually installed!!! But it says it's not there!!! What can I do?? Please e-mail me if you can help me, thank you. noviembrexx@hotmail.com

Re: Strictly On-Line: Plug-and-Play Hardware

Anonymous's picture

don't use the ".o" with modprobe -- just the module name

modprobe sb ...

bv

Re: Strictly On-Line: Plug-and-Play Hardware

Anonymous's picture

I've got another problem:
"this module has no such paramter - IRQ"
"this module has no such paramter - DMA"
"this module has no such paramter - DMA1"
:((

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix