Plug-and-Play Hardware

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

After you've compiled and installed isapnptools, it is time to configure your devices. This is done by creating a configuration file explaining the device(s) and which resources it will use. The great thing about isapnptools is that it will build this file for you. Then you go in and play “multiple choice” (as the author puts it).

To create the configuration file, run the pnpdump program. It scans for all ISA plug-and-play devices and all possible configurations. These values are dumped to standard out (STDOUT) in the file format needed. Here is the command I use to create the file as root:

/sbin/pnpdump > /etc/isapnp.conf

Listing 1. Confuguration File Start

The program failed on me a few times, but that was mainly due to other system errors. You should now have a configuration file in /etc if you used my command. The beginning of the file should look something like Listing 1. The rest of the configuration file will contain sections for the different devices it found. Now you need to choose which resources the device will use.

Choosing Your Resources

The configuration file may seem a bit confusing at first, but it needs only a little deciphering. The basic layout for a device section is shown in Listing 2. By default, a listing of all possible resources for that device will be within the device section. Basically, just uncomment the lines for the resources the device will use. The lines are commented with # marks.

Listing 2. Device Section

Editing this file requires knowing a bit about the device to be configured. Typically, the user manual for the device will list which resources are required to use the device. In my case, with the Sound Blaster AWE32, I needed a Base I/O address, one IRQ, an 8-bit DMA channel, a 16-bit DMA channel and a MIDI synthesizer I/O address. Other resources are on my card, but I am not using them in this example.

The example device section in Listing 2 shows the resources I chose for my card. I chose 0x0220 for the Base I/O address, 5 for the IRQ channel, 1 for the 8-bit DMA channel, 5 for the 16-bit DMA channel and 0x0330 for the MIDI I/O.

Note that the I/O addresses are called IO 0 and IO 1, and the DMA channels are called DMA 0 and DMA 1. This may make it a little difficult to map the right values to the 8-bit DMA and 16-bit DMA. However, if you read your configuration file after running pnpdump and look at the default resource settings in the user manual for your device, you can easily match things up.

In my case, I know DMA 0 corresponds to the 8-bit DMA because only the 8-bit DMA can have a value of 1. So, the other setting must be the 16-bit DMA channel. The same goes for the IO settings; IO 0 must be the Base I/O address, because the MIDI I/O address can never be 0x0220.

Once you have uncommented the lines you need, make sure the (ACT Y) line is uncommented; otherwise, your device will not be configured.

Testing the Configuration

You have now passed the hard part of PnP configuration under Linux. It is a good idea to test your PnP configuration before going any further. You want to make sure isapnp can properly initialize the card with the resources you have set. Assuming isapnp is in /sbin, execute this command to test your configuration:

/sbin/isapnp /etc/isapnp.conf

If there are no error messages, your configuration should work fine. If you do get resource conflict errors, now would be a good time to go back and edit that configuration file. It is better to get it working now than have to fool with it later. Play around with the resource settings until you find those that don't produce errors when you test the configuration.

Compiling the Kernel Driver

Now we are ready for the fun part. Most Linux distributions will come with the various device drivers compiled as modules. Refer to the kernel documentation for more information about modules. Basically, a module is just a device driver that can be added to an already-running kernel. This provides a lot of flexibility for the user, and it is modules that allow us to use PnP devices.

PnP devices must be initialized before the driver can be loaded, so using modules is a necessity. They are the only part of the kernel that can be loaded after the kernel boots.

Your distribution may already include a module for the device you want to use. In the case of sound cards, you might be compiling one from scratch. In my example, I use a Sound Blaster AWE32. The device driver included with my distribution is /lib/modules/2.0.35/misc/sound.o.

If you must recompile, be sure to set any resources for the driver according to those set in the isapnp.conf file. You can always pass the resource values when loading the module, but having the default ones is always nice.

To load the driver for my PnP sound card, I did this:

/sbin/isapnp /etc/isapnp.conf
/sbin/modprobe sound.o io=0x0220 irq=5 dma=1\
   dma1=5

If all goes well, you should have a driver loaded and working with that device. Check to make sure the module is loaded by typing:

/sbin/lsmod
If this is a sound card, try playing sound files. For network cards, try bringing up the device with ifconfig. At this point the device should be working.

______________________

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"
:((

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState