【 tulaoshi.com - Linux 】
                             
                               即插即用,在Linux底下?不好办,你还是换老的非即插即用设备吧。这是我初次接触Linux时,那些Linux高手们告诉我的。可是,我觉得总该有办法的。经过不懈的努力,我发现了两种方法。一是先从DOS启动,初始化设备后,再用loadlin加载到Linux中。但这不是我所梦寐以求的,因为每次需要大量时间来启动。我继续不停的寻找,终于有一天,我找到了我需要的东西,一个称为isapnptools的应用程序。 
  现在,大多数发行套件中都有isapnptools。如果你的套件中有,安装它即可。如果你的发行套件中没有它,到http://www.roestock.demon.co.uk/isapnptools/ 去下载一份,解压后把isapnp 和 pnpdump 拷贝到目录 /sbin中即可。 
  下面就是实战阶段了。需要准备的就是把你所有要装的即插即用设备全部装好,以ROOT身份登陆。然后运行以下命令/sbin/pnpdump  /etc/isapnp.conf,这会把你机器上所有的即插即用设备信息写入文件/etc/isapnp.conf中,下面是我的机器上的/etc/isapnp.conf文件的一部分: 
# $Id: plugnplay.html,v 1.1.1.1 1998/12/26 04:41:14 jack Exp $ 
# 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 on isapnp and pnpdump see: 
# http://www.roestock.demon.co.uk/isapnptools/ 
# 
# Compiler flags: -DREALTIME -DNEEDSETSCHEDULER 
# 
# Trying port address 0203 
# Board 1 has serial identifier c5 c0 7f 53 05 01 22 05 07 
# Board 2 has serial identifier 5a 80 86 00 01 20 00 a8 65 
# Board 3 has serial identifier e8 46 46 46 46 90 30 72 56 
# (DEBUG) 
(READPORT 0x0203) 
(ISOLATE PRESERVE) 
(IDENTIFY *) 
(VERBOSITY 2) 
(CONFLICT (IO FATAL)(IRQ FATAL)(DMA FATAL)(MEM FATAL)) # or WARNING 
# Card 1: (serial identifier c5 c0 7f 53 05 01 22 05 07) 
# Vendor Id AXE2201, Serial Number 3229569797, checksum 0xC5. 
# Version 1.0, Vendor version 0.0 
# ANSI string --Ethernet PnP ISA Card /S <-- 
# 
# Logical device id AXE2201 
# Device support I/O range check register 
# 
# 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 AXE2201/3229569797 (LD 0 
# Compatible device id PNP80d6 
# Logical device decodes 10 bit IO address lines 
# Minimum IO base address 0x0240 
# Maximum IO base address 0x0380 
# IO base alignment 32 bytes 
# Number of IO addresses required: 32 
# (IO 0 (SIZE 32) (BASE 0x0240)) 
# IRQ 3, 5, 9, 10, 11, 12 or 15. 
# High true, edge sensitive interrupt 
# (INT 0 (IRQ 3 (MODE +E))) 
# (ACT Y) 
)) 
# End tag... Checksum 0x00 (OK) 
# 略去声卡部分 
#略去modem卡部分 
# Returns all cards to the "Wait for Key" state 
(WAITFORKEY) 
  我的系统中共有三个即插即用设备,分别是NE2000兼容网卡,Yamaha OPL~SA2声卡和一个USR 56K modem。由于文件太长,我略去了声卡和modem部分。 
  接下来就是为每个设备分配所需资源。有许多方法可以实现。第一种,也是最简单的方法就是,如果你在同一台机器上也装了WIN95或WIN98,通过控制面板的系统的属性页,可以看到在WINDOWS系统下各即插即用设备的资源,记下用到Linux即可。如果你的机器中没有其它的操作系统,采用第二种方法。即手动分配资源,只要各设备资源不发生冲突就行。手动分配资源以前,最好先看一下已经使用的中断列表、I/O列列表,它们分别位于/proc/interrupts、/proc/ioports、/proc/dma。一旦你确定了各设备使用的资源,就可以分配了。 
  选择分配给每个设备的资源非常简单。你只要去掉你的设备所需资源前的注释号即可。描述资源的行很容易找到,因为它们总是以INT, IO或 DMA开头。在这些行之前是