diff -urN busybox.orig/Makefile busybox/Makefile
--- busybox.orig/Makefile	2004-04-06 09:26:25.000000000 -0600
+++ busybox/Makefile	2004-04-17 04:37:23.000000000 -0600
@@ -27,9 +27,10 @@
 include Rules.mak
 
 DIRS:=applets archival archival/libunarchive coreutils console-tools \
-	debianutils editors findutils init miscutils modutils networking \
-	networking/libiproute networking/udhcp procps loginutils shell \
-	sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb
+	debianutils editors findutils hotplug init miscutils modutils \
+	networking networking/libiproute networking/udhcp procps \
+	loginutils shell sysklogd util-linux libpwdgrp coreutils/libcoreutils \
+	libbb
 
 ifeq ($(strip $(CONFIG_SELINUX)),y)
 CFLAGS += -I/usr/include/selinux
@@ -192,7 +193,8 @@
 	    docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
 	    docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
 	    docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
-	    .config.old .hdepend busybox
+	    hotplug/lex_config.c hotplug/yacc_config.c .config.old \
+	    .hdepend busybox
 	- rm -rf _install
 	- find . -name .\*.flags -exec rm -f {} \;
 	- find . -name \*.o -exec rm -f {} \;
diff -urN busybox.orig/hotplug/Config.in busybox/hotplug/Config.in
--- busybox.orig/hotplug/Config.in	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/Config.in	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,24 @@
+#
+# For a description of the syntax of this configuration file,
+# see scripts/kbuild/config-language.txt.
+#
+
+menu "Hotplug"
+
+config CONFIG_CARDMGR
+	bool "cardmgr"
+	default n
+	help
+	  The pcmcia cardmgr is used for managing hotplugged events for
+	  16-bit pcmcia cards.
+
+config CONFIG_HOTPLUG
+	bool "hotplug"
+	default n
+	help
+	  The hotplug utility is called by the kernel during device hotplug
+	  events in order to load the needed drivers and configure devices for
+	  use.
+
+endmenu
+
diff -urN busybox.orig/hotplug/Makefile busybox/hotplug/Makefile
--- busybox.orig/hotplug/Makefile	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/Makefile	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,31 @@
+# Makefile for busybox
+#
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+TOPDIR:= ../
+HOTPLUG_DIR:=./
+include $(TOPDIR).config
+include $(TOPDIR)Rules.mak
+include Makefile.in
+all: $(libraries-y)
+-include $(TOPDIR).depend
+
+clean:
+	rm -f *.o *.a $(AR_TARGET) $(HOTPLUG_DIR)lex_config.c \
+		$(HOTPLUG_DIR)yacc_config.c
+
diff -urN busybox.orig/hotplug/Makefile.in busybox/hotplug/Makefile.in
--- busybox.orig/hotplug/Makefile.in	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/Makefile.in	2004-04-17 04:35:39.000000000 -0600
@@ -0,0 +1,66 @@
+# Makefile for busybox
+#
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+HOTPLUG_AR:=hotplug.a
+ifndef $(HOTPLUG_DIR)
+HOTPLUG_DIR:=$(TOPDIR)hotplug/
+endif
+
+HOTPLUG-y:=
+HOTPLUG-$(CONFIG_CARDMGR)   += yacc_config.o lex_config.o cardmgr.o
+HOTPLUG-$(CONFIG_HOTPLUG)   += hotplug.o
+HOTPLUG_SRC:= $(HOTPLUG-y)
+HOTPLUG_OBJ:= $(patsubst %.c,$(HOTPLUG_DIR)%.o, $(HOTPLUG_SRC))
+
+libraries-y+=$(HOTPLUG_DIR)$(HOTPLUG_AR)
+
+$(HOTPLUG_DIR)$(HOTPLUG_AR): $(patsubst %,$(HOTPLUG_DIR)%, $(HOTPLUG-y))
+	$(AR) -ro $@ $(patsubst %,$(HOTPLUG_DIR)%, $(HOTPLUG-y))
+
+###
+# The following requires flex/bison
+# By default we use the _shipped versions, uncomment the
+# following line if you are modifying the flex/bison src.
+DOTHEYACCTHING:=false
+
+ifeq ($(strip $(DOTHEYACCTHING)),true)
+
+$(HOTPLUG_DIR)yacc_config.c $(HOTPLUG_DIR)yacc_config.h: $(HOTPLUG_DIR)yacc_config.y
+	yacc -d -o$@ $<
+
+$(HOTPLUG_DIR)lex_config.c: $(HOTPLUG_DIR)lex_config.l $(HOTPLUG_DIR)yacc_config.h
+	lex -o$@ $<
+else
+
+$(HOTPLUG_DIR)lex_config.o: $(HOTPLUG_DIR)lex_config.c
+	$(CC) $(CFLAGS) -I. -c $< -o $@
+
+$(HOTPLUG_DIR)lex_config.c: $(HOTPLUG_DIR)lex_config.c_shipped
+	cp $(HOTPLUG_DIR)lex_config.c_shipped $(HOTPLUG_DIR)lex_config.c
+
+$(HOTPLUG_DIR)yacc_config.o: $(HOTPLUG_DIR)yacc_config.c $(HOTPLUG_DIR)lex_config.c
+	$(CC) $(CFLAGS) -I. -c $< -o $@
+
+$(HOTPLUG_DIR)yacc_config.c: $(HOTPLUG_DIR)yacc_config.c_shipped
+	cp $(HOTPLUG_DIR)yacc_config.c_shipped $(HOTPLUG_DIR)yacc_config.c
+
+$(HOTPLUG_DIR)yacc_config.h: $(HOTPLUG_DIR)yacc_config.h_shipped
+	cp $(HOTPLUG_DIR)yacc_config.h_shipped $(HOTPLUG_DIR)yacc_config.h
+endif
+
diff -urN busybox.orig/hotplug/cardmgr.c busybox/hotplug/cardmgr.c
--- busybox.orig/hotplug/cardmgr.c	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/cardmgr.c	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,1781 @@
+/*======================================================================
+
+    PCMCIA Card Manager daemon
+
+    cardmgr.c 1.179 2002/08/19 06:32:10
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is David A. Hinds
+    <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU General Public License version 2 (the "GPL"), in
+    which case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+
+======================================================================*/
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <syslog.h>
+#include <getopt.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <endian.h>
+#include <byteswap.h>
+#include <dirent.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/utsname.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+
+
+#include "pcmcia.h"
+#include "cardmgr.h"
+#include "busybox.h"
+
+//#define HAS_WORDEXP 1
+#undef HAS_WORDEXP
+
+#define CS_PKG_RELEASE "3.2.1"
+
+/*====================================================================*/
+
+typedef struct socket_info_t {
+    int			fd;
+    int			state;
+    card_info_t		*card;
+    bind_info_t		*xbind[MAX_BINDINGS];
+    mtd_ident_t		*mtd[2*CISTPL_MAX_DEVICES];
+    cistpl_funcid_t	funcid;
+    cistpl_manfid_t	manfid;
+    cistpl_vers_1_t	prodid;
+} socket_info_t;
+
+#define SOCKET_PRESENT	0x01
+#define SOCKET_READY	0x02
+#define SOCKET_HOTPLUG	0x04
+
+/* Linked list of resource adjustments */
+struct adjust_list_t *root_adjust = NULL;
+
+/* Linked list of device definitions */
+struct device_info_t *root_device = NULL;
+
+/* Special pointer to "anonymous" card definition */
+struct card_info_t *blank_card = NULL;
+
+/* Linked list of card definitions */
+struct card_info_t *root_card = NULL;
+
+/* Linked list of function definitions */
+struct card_info_t *root_func = NULL;
+
+/* Linked list of MTD definitions */
+struct mtd_ident_t *root_mtd = NULL;
+
+/* Default MTD */
+struct mtd_ident_t *default_mtd = NULL;
+
+static int sockets;
+static struct socket_info_t mysocket[MAX_SOCKS];
+
+/* Default path for config file, device scripts */
+#ifdef ETC
+static char *configpath = ETC;
+#else
+static char *configpath = "/etc/pcmcia";
+#endif
+
+/* Default path for pid file */
+static char *pidfile = "/var/run/cardmgr.pid";
+
+/* Default path for finding modules */
+static char *modpath = NULL;
+
+/* Default path for socket info table */
+static char *stabfile;
+
+/* If set, don't generate beeps when cards are inserted */
+static int be_quiet = 0;
+
+/* If set, use modprobe instead of insmod */
+static int do_modprobe = 0;
+
+/* If set, configure already inserted cards, then exit */
+static int one_pass = 0;
+
+/* Extra message logging? */
+static int verbose = 0;
+
+#define EITHER_OR(a, b) ((a) ? (a) : (b))
+
+/*====================================================================*/
+
+static int major = 0;
+
+static int lookup_dev(char *name)
+{
+    FILE *f;
+    int n;
+    char s[32], t[32];
+
+    f = fopen("/proc/devices", "r");
+    if (f == NULL)
+	return -errno;
+    while (fgets(s, 32, f) != NULL) {
+	if (sscanf(s, "%d %s", &n, t) == 2)
+	    if (strcmp(name, t) == 0)
+		break;
+    }
+    fclose(f);
+    if (strcmp(name, t) == 0)
+	return n;
+    else
+	return -ENODEV;
+}
+
+int open_dev(dev_t dev, int mode)
+{
+    static char *paths[] = {
+	"/var/lib/pcmcia", "/var/run", "/dev", "/tmp", NULL
+    };
+    static int nd = 0;
+    char **p, fn[64];
+    int fd;
+
+    int o_mode = (mode & S_IWRITE) ? O_RDWR : O_RDONLY;
+    for (p = paths; *p; p++) {
+	sprintf(fn, "%s/cm-%d-%d", *p, getpid(), nd++);
+	if (mknod(fn, mode, dev) == 0) {
+	    fd = open(fn, o_mode);
+	    if (fd < 0)
+		fd = open(fn, O_NONBLOCK|o_mode);
+	    unlink(fn);
+	    if (fd >= 0)
+		return fd;
+	    if (errno == ENODEV)
+		break;
+	}
+
+    }
+    return -1;
+}
+
+int open_sock(int sock, int mode)
+{
+    dev_t dev = (major<<8)+sock;
+    return open_dev(dev, mode);
+}
+
+/*======================================================================
+
+    xlate_scsi_name() is a sort-of-hack used to deduce the minor
+    device numbers of SCSI devices, from the information available to
+    the low-level driver.
+
+======================================================================*/
+
+#include <linux/major.h>
+#include <scsi/scsi.h>
+
+static int xlate_scsi_name(bind_info_t *mybind)
+{
+    int i, fd, mode, minor;
+    u_long arg[2], id1, id2;
+
+    id1 = strtol(mybind->name+3, NULL, 16);
+    if ((mybind->major == SCSI_DISK0_MAJOR) ||
+	    (mybind->major == SCSI_CDROM_MAJOR))
+	mode = S_IREAD|S_IFBLK;
+    else
+	mode = S_IREAD|S_IFCHR;
+
+    for (i = 0; i < 16; i++) {
+	minor = (mybind->major == SCSI_DISK0_MAJOR) ? (i<<4) : i;
+	fd = open_dev((mybind->major<<8)+minor, mode);
+	if (fd < 0)
+	    continue;
+	if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, arg) == 0) {
+	    id2 = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
+		((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
+	    if (id1 == id2) {
+		close(fd);
+		switch (mybind->major) {
+		    case SCSI_DISK0_MAJOR:
+		    case SCSI_GENERIC_MAJOR:
+			sprintf(mybind->name+2, "%c", 'a'+i); break;
+		    case SCSI_CDROM_MAJOR:
+			sprintf(mybind->name, "scd%d", i); break;
+		    case SCSI_TAPE_MAJOR:
+			sprintf(mybind->name+2, "%d", i); break;
+		}
+		mybind->minor = minor;
+		return 0;
+	    }
+	}
+	close(fd);
+    }
+    return -1;
+}
+
+/*====================================================================*/
+
+#define BEEP_TIME 150
+#define BEEP_OK   1000
+#define BEEP_WARN 2000
+#define BEEP_ERR  4000
+
+#include <sys/kd.h>
+
+static void beep(unsigned int ms, unsigned int freq)
+{
+    int fd, arg;
+
+    if (be_quiet)
+	return;
+    fd = open("/dev/console", O_RDWR);
+    if (fd < 0)
+	return;
+    arg = (ms << 16) | freq;
+    ioctl(fd, KDMKTONE, arg);
+    close(fd);
+    usleep(ms*1000);
+}
+
+/*====================================================================*/
+
+static void write_pid(void)
+{
+    FILE *f;
+    f = fopen(pidfile, "w");
+    if (f == NULL)
+	syslog(LOG_WARNING, "could not open %s: %m", pidfile);
+    else {
+	fprintf(f, "%d\n", getpid());
+	fclose(f);
+    }
+}
+
+static void write_stab(void)
+{
+    int i, j, k;
+    FILE *f;
+    socket_info_t *s;
+    bind_info_t *mybind;
+
+    f = fopen(stabfile, "w");
+    if (f == NULL) {
+	syslog(LOG_WARNING, "fopen(stabfile) failed: %m");
+	return;
+    }
+    if (flock(fileno(f), LOCK_EX) != 0) {
+	syslog(LOG_ERR, "flock(stabfile) failed: %m");
+	return;
+    }
+    for (i = 0; i < sockets; i++) {
+	s = &mysocket[i];
+	fprintf(f, "Socket %d: ", i);
+	if (!(s->state & SOCKET_PRESENT)) {
+	    fprintf(f, "empty\n");
+	} else if (s->state & SOCKET_HOTPLUG) {
+	    fprintf(f, "CardBus hotplug device\n");
+	} else if (!s->card) {
+	    fprintf(f, "unsupported card\n");
+	} else {
+	    fprintf(f, "%s\n", s->card->name);
+	    for (j = 0; j < s->card->bindings; j++)
+		for (k = 0, mybind = s->xbind[j];
+			mybind != NULL;
+			k++, mybind = mybind->next) {
+		    char *class = s->card->class[j];
+		    if (!class) class = s->card->device[j]->class;
+		    fprintf(f, "%d\t%s\t%s\t%d\t%s",
+			    i, (class ? class : "none"),
+			    mybind->dev_info, k, mybind->name);
+		    if (mybind->major)
+			fprintf(f, "\t%d\t%d\n",
+				mybind->major, mybind->minor);
+		    else
+			fputc('\n', f);
+		}
+	}
+    }
+    fflush(f);
+    flock(fileno(f), LOCK_UN);
+    fclose(f);
+}
+
+/*====================================================================*/
+
+static int get_tuple(int ns, cisdata_t code, ds_ioctl_arg_t *arg)
+{
+    socket_info_t *s = &mysocket[ns];
+
+    arg->tuple.DesiredTuple = code;
+    arg->tuple.Attributes = 0;
+    if (ioctl(s->fd, DS_GET_FIRST_TUPLE, arg) != 0)
+	return -1;
+    arg->tuple.TupleOffset = 0;
+    if (ioctl(s->fd, DS_GET_TUPLE_DATA, arg) != 0) {
+	syslog(LOG_INFO, "error reading CIS data on socket %d: %m", ns);
+	return -1;
+    }
+    if (ioctl(s->fd, DS_PARSE_TUPLE, arg) != 0) {
+	syslog(LOG_INFO, "error parsing CIS on socket %d: %m", ns);
+	return -1;
+    }
+    return 0;
+}
+
+/*======================================================================
+
+    For configurations with the standalone PCMCIA modules, this is
+    used to get PCI device ID's for CardBus cards.
+
+======================================================================*/
+
+typedef struct pci_id {
+    u_short vendor, device;
+    struct pci_id *next;
+} pci_id_t;
+
+static int get_pci_id(int ns, pci_id_t *id)
+{
+    socket_info_t *s = &mysocket[ns];
+    config_info_t config;
+
+    config.Function = config.ConfigBase = 0;
+    if ((ioctl(s->fd, DS_GET_CONFIGURATION_INFO, &config) != 0) ||
+	    (config.IntType != INT_CARDBUS) || !config.ConfigBase)
+	return 0;
+    id->vendor = config.ConfigBase & 0xffff;
+    id->device = config.ConfigBase >> 16;
+    return 1;
+}
+
+/*====================================================================*/
+
+static void log_card_info(socket_info_t *s, pci_id_t *pci_id)
+{
+    char v[256] = "";
+    int i;
+    static char *fn[] = {
+	"multi", "memory", "serial", "parallel", "fixed disk",
+	"video", "network", "AIMS", "SCSI"
+    };
+
+    if (s->prodid.ns) {
+	for (i = 0; i < s->prodid.ns; i++)
+	    sprintf(v+strlen(v), "%s\"%s\"",
+		    (i>0) ? ", " : "", s->prodid.str+s->prodid.ofs[i]);
+	syslog(LOG_INFO, "  product info: %s", v);
+    } else {
+	syslog(LOG_INFO, "  no product info available");
+    }
+    *v = '\0';
+    if (s->manfid.manf != 0)
+	sprintf(v, "  manfid: 0x%04x, 0x%04x",
+		s->manfid.manf, s->manfid.card);
+    if (s->funcid.func != 0xff)
+	sprintf(v+strlen(v), "  function: %d (%s)", s->funcid.func,
+		fn[s->funcid.func]);
+    if (strlen(v) > 0) syslog(LOG_INFO, "%s", v);
+    if (pci_id->vendor != 0)
+	syslog(LOG_INFO, "  PCI id: 0x%04x, 0x%04x",
+		pci_id->vendor, pci_id->device);
+}
+
+static card_info_t *lookup_card(int ns)
+{
+    socket_info_t *s = &mysocket[ns];
+    card_info_t *card = NULL;
+    ds_ioctl_arg_t arg;
+    pci_id_t pci_id = { 0, 0 };
+    cs_status_t status;
+    int i, ret, has_cis = 0;
+
+    s->manfid = (cistpl_manfid_t) { 0, 0 };
+    s->funcid = (cistpl_funcid_t) { 0xff, 0xff };
+    s->prodid = (cistpl_vers_1_t) { 0, 0, 0 };
+
+    /* Do we have a CIS structure? */
+    ret = ioctl(s->fd, DS_VALIDATE_CIS, &arg);
+    has_cis = ((ret == 0) && (arg.cisinfo.Chains > 0));
+
+    /* Try to read VERS_1, MANFID tuples */
+    if (has_cis) {
+	/* rule of thumb: cards with no FUNCID, but with common memory
+	   device geometry information, are probably memory cards */
+	if (get_tuple(ns, CISTPL_FUNCID, &arg) == 0)
+	    s->funcid = arg.tuple_parse.parse.funcid;
+	else if (get_tuple(ns, CISTPL_DEVICE_GEO, &arg) == 0)
+	    s->funcid.func = CISTPL_FUNCID_MEMORY;
+	if (get_tuple(ns, CISTPL_MANFID, &arg) == 0)
+	    s->manfid = arg.tuple_parse.parse.manfid;
+	if (get_tuple(ns, CISTPL_VERS_1, &arg) == 0)
+	    s->prodid = arg.tuple_parse.parse.version_1;
+
+	for (card = root_card; card; card = card->next) {
+
+	    if (card->ident_type &
+		    ~(VERS_1_IDENT|MANFID_IDENT|TUPLE_IDENT))
+		continue;
+
+	    if (card->ident_type & VERS_1_IDENT) {
+		if (!s->prodid.ns)
+		    continue;
+		for (i = 0; i < card->id.vers.ns; i++) {
+		    if (strcmp(card->id.vers.pi[i], "*") == 0)
+			continue;
+		    if (i >= s->prodid.ns)
+			break;
+		    if (strcmp(card->id.vers.pi[i],
+				s->prodid.str+s->prodid.ofs[i]) != 0)
+			break;
+		}
+		if (i < card->id.vers.ns)
+		    continue;
+	    }
+
+	    if (card->ident_type & MANFID_IDENT) {
+		if ((s->manfid.manf != card->manfid.manf) ||
+			(s->manfid.card != card->manfid.card))
+		    continue;
+	    }
+
+	    if (card->ident_type & TUPLE_IDENT) {
+		arg.tuple.DesiredTuple = card->id.tuple.code;
+		arg.tuple.Attributes = 0;
+		ret = ioctl(s->fd, DS_GET_FIRST_TUPLE, &arg);
+		if (ret != 0) continue;
+		arg.tuple.TupleOffset = card->id.tuple.ofs;
+		ret = ioctl(s->fd, DS_GET_TUPLE_DATA, &arg);
+		if (ret != 0) continue;
+		if (strncmp((char *)arg.tuple_parse.data,
+			    card->id.tuple.info,
+			    strlen(card->id.tuple.info)) != 0)
+		    continue;
+	    }
+
+	    break; /* we have a match */
+	}
+    }
+
+    /* Check PCI vendor/device info */
+    status.Function = 0;
+    ioctl(s->fd, DS_GET_STATUS, &status);
+    if (status.CardState & CS_EVENT_CB_DETECT) {
+	if (get_pci_id(ns, &pci_id)) {
+	    if (!card) {
+		for (card = root_card; card; card = card->next)
+		    if ((card->ident_type == PCI_IDENT) &&
+			    (pci_id.vendor == card->manfid.manf) &&
+			    (pci_id.device == card->manfid.card))
+			break;
+	    }
+	} else {
+	    /* this is a 2.4 kernel; hotplug handles these cards */
+	    s->state |= SOCKET_HOTPLUG;
+	    syslog(LOG_INFO, "socket %d: CardBus hotplug device", ns);
+	    //beep(BEEP_TIME, BEEP_OK);
+	    return NULL;
+	}
+    }
+
+    /* Try for a FUNCID match */
+    if (!card && (s->funcid.func != 0xff)) {
+	for (card = root_func; card; card = card->next)
+	    if (card->id.func.funcid == s->funcid.func)
+		break;
+    }
+
+    if (card) {
+	syslog(LOG_INFO, "socket %d: %s", ns, card->name);
+	beep(BEEP_TIME, BEEP_OK);
+	if (verbose) log_card_info(s, &pci_id);
+	return card;
+    }
+
+    if (!blank_card || (status.CardState & CS_EVENT_CB_DETECT) ||
+	    s->manfid.manf || s->manfid.card || s->prodid.ns || pci_id.vendor) {
+	syslog(LOG_INFO, "unsupported card in socket %d", ns);
+	if (one_pass) return NULL;
+	beep(BEEP_TIME, BEEP_ERR);
+	log_card_info(s, &pci_id);
+	write_stab();
+	return NULL;
+    } else {
+	card = blank_card;
+	syslog(LOG_INFO, "socket %d: %s", ns, card->name);
+	beep(BEEP_TIME, BEEP_WARN);
+	return card;
+    }
+}
+
+/*====================================================================*/
+
+static void load_config(void)
+{
+    if (chdir(configpath) != 0) {
+	syslog(LOG_ERR, "chdir to %s failed: %m", configpath);
+	exit(EXIT_FAILURE);
+    }
+    if (parse_configfile("config") != 0)
+	exit(EXIT_FAILURE);
+    if (root_device == NULL)
+	syslog(LOG_WARNING, "no device drivers defined");
+    if ((root_card == NULL) && (root_func == NULL))
+	syslog(LOG_WARNING, "no cards defined");
+}
+
+/*====================================================================*/
+
+static void free_card(card_info_t *card)
+{
+    if (card && (--card->refs == 0)) {
+	int i;
+	free(card->name);
+	switch(card->ident_type) {
+	    case VERS_1_IDENT:
+		for (i = 0; i < card->id.vers.ns; i++)
+		    free(card->id.vers.pi[i]);
+		break;
+	    case TUPLE_IDENT:
+		free(card->id.tuple.info);
+		break;
+	    default:
+		break;
+	}
+	for (i = 0; i < card->bindings; i++)
+	    if (card->class[i])
+		free(card->class[i]);
+	free(card);
+    }
+}
+
+static void free_device(device_info_t *dev)
+{
+    if (dev && (--dev->refs == 0)) {
+	int i;
+	for (i = 0; i < dev->modules; i++) {
+	    free(dev->module[i]);
+	    if (dev->opts[i]) free(dev->opts[i]);
+	}
+	if (dev->class) free(dev->class);
+	free(dev);
+    }
+}
+
+static void free_mtd(mtd_ident_t *mtd)
+{
+    if (mtd && (--mtd->refs == 0)) {
+	free(mtd->name);
+	free(mtd->module);
+	free(mtd);
+    }
+}
+
+static void free_config(void)
+{
+    while (root_adjust != NULL) {
+	adjust_list_t *adj = root_adjust;
+	root_adjust = root_adjust->next;
+	free(adj);
+    }
+
+    while (root_device != NULL) {
+	device_info_t *dev = root_device;
+	root_device = root_device->next;
+	free_device(dev);
+    }
+
+    while (root_card != NULL) {
+	card_info_t *card = root_card;
+	root_card = root_card->next;
+	free_card(card);
+    }
+
+    while (root_func != NULL) {
+	card_info_t *card = root_func;
+	root_func = root_func->next;
+	free_card(card);
+    }
+    blank_card = NULL;
+
+    while (root_mtd != NULL) {
+	mtd_ident_t *mtd = root_mtd;
+	root_mtd = root_mtd->next;
+	free_mtd(mtd);
+    }
+    default_mtd = NULL;
+}
+
+/*====================================================================*/
+
+static int execute(char *msg, char *cmd)
+{
+    int ret;
+    FILE *f;
+    char line[256];
+
+    syslog(LOG_INFO, "executing: '%s'", cmd);
+    strcat(cmd, " 2>&1");
+    f = popen(cmd, "r");
+    while (fgets(line, 255, f)) {
+	line[strlen(line)-1] = '\0';
+	syslog(LOG_INFO, "+ %s", line);
+    }
+    ret = pclose(f);
+    if (WIFEXITED(ret)) {
+	if (WEXITSTATUS(ret))
+	    syslog(LOG_INFO, "%s exited with status %d",
+		    msg, WEXITSTATUS(ret));
+	return WEXITSTATUS(ret);
+    } else
+	syslog(LOG_INFO, "%s exited on signal %d",
+		msg, WTERMSIG(ret));
+    return -1;
+}
+
+/*====================================================================*/
+
+static int execute_on_dev(char *action, char *class, char *dev)
+{
+    /* Fixed length strings are ok here */
+    char msg[128], cmd[128];
+
+    sprintf(msg, "%s cmd", action);
+    sprintf(cmd, "./%s %s %s", class, action, dev);
+    return execute(msg, cmd);
+}
+
+static void eprintf(char *name, char *fmt, ...)
+{
+    va_list args;
+    char s[32];
+    va_start(args, fmt);
+    vsprintf(s, fmt, args);
+    setenv(name, s, 1);
+    va_end(args);
+}
+
+static int execute_on_all(char *cmd, char *class, int sn, int fn)
+{
+    socket_info_t *s = &mysocket[sn];
+    bind_info_t *mybind;
+    int i, k, ret = 0;
+    char m[10];
+
+    eprintf("MANFID", "%04x,%04x", s->manfid.manf, s->manfid.card);
+    eprintf("FUNCID", "%d", s->funcid.func);
+    for (i = 0; i < 4; i++) {
+	sprintf(m, "PRODID_%d", i+1);
+	if (i < s->prodid.ns)
+	    setenv(m, s->prodid.str+s->prodid.ofs[i], 1);
+	else
+	    unsetenv(m);
+    }
+    eprintf("SOCKET", "%d", sn);
+
+    for (k = 0, mybind = s->xbind[fn]; mybind != NULL; k++, mybind = mybind->next)
+	if (mybind->name[0] && (mybind->name[2] != '#')) {
+	    setenv("CLASS", class, 1);
+	    setenv("DRIVER", mybind->dev_info, 1);
+	    eprintf("INSTANCE", "%d", k);
+	    if (mybind->major) {
+		eprintf("MAJOR", "%d", mybind->major);
+		eprintf("MINOR", "%d", mybind->minor);
+	    } else {
+		unsetenv("MAJOR");
+		unsetenv("MINOR");
+	    }
+	    ret |= execute_on_dev(cmd, class, mybind->name);
+	}
+    return ret;
+}
+
+/*====================================================================*/
+
+typedef struct module_list_t {
+    char *mod;
+    int usage;
+    struct module_list_t *next;
+} module_list_t;
+
+static module_list_t *module_list = NULL;
+
+static int try_insmod(char *mod, char *opts)
+{
+    char *cmd = xmalloc(strlen(mod) + strlen(modpath) +
+	    (opts ? strlen(opts) : 0) + 30);
+    int ret;
+
+    strcpy(cmd, "insmod ");
+    if (strchr(mod, '/') != NULL)
+	sprintf(cmd+7, "%s/%s.o", modpath, mod);
+    else
+	sprintf(cmd+7, "%s/pcmcia/%s.o", modpath, mod);
+    if (access(cmd+7, R_OK) != 0) {
+	syslog(LOG_INFO, "module %s not available", cmd+7);
+	free(cmd);
+	return -1;
+    }
+    if (opts) {
+	strcat(cmd, " ");
+	strcat(cmd, opts);
+    }
+    ret = execute("insmod", cmd);
+    free(cmd);
+    return ret;
+}
+
+static int try_modprobe(char *mod, char *opts)
+{
+    char *cmd = xmalloc(strlen(mod) + (opts ? strlen(opts) : 0) + 20);
+    char *s = strrchr(mod, '/');
+    int ret;
+
+    sprintf(cmd, "modprobe %s", (s) ? s+1 : mod);
+    if (opts) {
+	strcat(cmd, " ");
+	strcat(cmd, opts);
+    }
+    ret = execute("modprobe", cmd);
+    free(cmd);
+    return ret;
+}
+
+static void install_module(char *mod, char *opts)
+{
+    module_list_t *ml;
+
+    for (ml = module_list; ml != NULL; ml = ml->next)
+	if (strcmp(mod, ml->mod) == 0) break;
+    if (ml == NULL) {
+	ml = (module_list_t *)xmalloc(sizeof(struct module_list_t));
+	ml->mod = mod;
+	ml->usage = 0;
+	ml->next = module_list;
+	module_list = ml;
+    }
+    ml->usage++;
+    if (ml->usage != 1)
+	return;
+
+    if (access("/proc/bus/pccard/drivers", R_OK) == 0) {
+	FILE *f = fopen("/proc/bus/pccard/drivers", "r");
+	if (f) {
+	    char a[61], s[33];
+	    while (fgets(a, 60, f)) {
+		int is_kernel;
+		sscanf(a, "%s %d", s, &is_kernel);
+		if (strcmp(s, mod) != 0) continue;
+		/* If it isn't a module, we won't try to rmmod */
+		ml->usage += is_kernel;
+		fclose(f);
+		return;
+	    }
+	    fclose(f);
+	}
+    }
+
+    if (do_modprobe) {
+	if (try_modprobe(mod, opts) != 0)
+	    try_insmod(mod, opts);
+    } else {
+	if (try_insmod(mod, opts) != 0)
+	    try_modprobe(mod, opts);
+    }
+}
+
+static void remove_module(char *mod)
+{
+    char *s, cmd[128];
+    module_list_t *ml;
+
+    for (ml = module_list; ml != NULL; ml = ml->next)
+	if (strcmp(mod, ml->mod) == 0) break;
+    if (ml != NULL) {
+	ml->usage--;
+	if (ml->usage == 0) {
+	    /* Strip off leading path names */
+	    s = strrchr(mod, '/');
+	    s = (s) ? s+1 : mod;
+	    sprintf(cmd, do_modprobe ? "modprobe -r %s" : "rmmod %s", s);
+	    execute(do_modprobe ? "modprobe" : "rmmod", cmd);
+	}
+    }
+}
+
+/*====================================================================*/
+
+static mtd_ident_t *lookup_mtd(region_info_t *region)
+{
+    mtd_ident_t *mtd;
+    int match = 0;
+
+    for (mtd = root_mtd; mtd; mtd = mtd->next) {
+	switch (mtd->mtd_type) {
+	    case JEDEC_MTD:
+		if ((mtd->jedec_mfr == region->JedecMfr) &&
+			(mtd->jedec_info == region->JedecInfo)) {
+		    match = 1;
+		    break;
+		}
+	    case DTYPE_MTD:
+		break;
+	    default:
+		break;
+	}
+	if (match) break;
+    }
+    if (mtd)
+	return mtd;
+    else
+	return default_mtd;
+}
+
+/*====================================================================*/
+
+static void bind_mtd(int sn)
+{
+    socket_info_t *s = &mysocket[sn];
+    region_info_t region;
+    bind_info_t mybind;
+    mtd_info_t mtd_info;
+    mtd_ident_t *mtd;
+    int i, attr, ret, nr;
+
+    nr = 0;
+    for (attr = 0; attr < 2; attr++) {
+	region.Attributes = attr;
+	ret = ioctl(s->fd, DS_GET_FIRST_REGION, &region);
+	while (ret == 0) {
+	    mtd = lookup_mtd(&region);
+	    if (mtd) {
+		/* Have we seen this MTD before? */
+		for (i = 0; i < nr; i++)
+		    if (s->mtd[i] == mtd) break;
+		if (i == nr) {
+		    install_module(mtd->module, mtd->opts);
+		    s->mtd[nr] = mtd;
+		    mtd->refs++;
+		    nr++;
+		}
+		syslog(LOG_INFO, "  %s memory region at 0x%x: %s",
+			attr ? "Attribute" : "Common", region.CardOffset,
+			mtd->name);
+		/* Bind MTD to this region */
+		strcpy(mtd_info.dev_info, s->mtd[i]->module);
+		mtd_info.Attributes = region.Attributes;
+		mtd_info.CardOffset = region.CardOffset;
+		if (ioctl(s->fd, DS_BIND_MTD, &mtd_info) != 0) {
+		    syslog(LOG_INFO,
+			    "bind MTD '%s' to region at 0x%x failed: %m",
+			    (char *)mtd_info.dev_info, region.CardOffset);
+		}
+	    }
+	    ret = ioctl(s->fd, DS_GET_NEXT_REGION, &region);
+	}
+    }
+    s->mtd[nr] = NULL;
+
+    /* Now bind each unique MTD as a normal client of this socket */
+    for (i = 0; i < nr; i++) {
+	strcpy(mybind.dev_info, s->mtd[i]->module);
+	mybind.function = 0;
+	if (ioctl(s->fd, DS_BIND_REQUEST, &mybind) != 0)
+	    syslog(LOG_INFO, "bind MTD '%s' to socket %d failed: %m",
+		    (char *)mybind.dev_info, sn);
+    }
+}
+
+/*====================================================================*/
+
+static void update_cis(socket_info_t *s)
+{
+    cisdump_t cis;
+    FILE *f = fopen(s->card->cis_file, "r");
+    if (f == NULL)
+	syslog(LOG_ERR, "could not open '%s': %m", s->card->cis_file);
+    else {
+	cis.Length = fread(cis.Data, 1, CISTPL_MAX_CIS_SIZE, f);
+	fclose(f);
+	if (ioctl(s->fd, DS_REPLACE_CIS, &cis) != 0)
+	    syslog(LOG_ERR, "could not replace CIS: %m");
+    }
+}
+
+/*====================================================================*/
+
+static void do_insert(int sn)
+{
+    socket_info_t *s = &mysocket[sn];
+    card_info_t *card;
+    device_info_t **dev;
+    bind_info_t *mybind, **tail;
+    int i, j, ret;
+
+    /* Already identified? */
+    if ((s->card != NULL) && (s->card != blank_card))
+	return;
+
+    if (verbose) syslog(LOG_INFO, "initializing socket %d", sn);
+    card = lookup_card(sn);
+    if (s->state & SOCKET_HOTPLUG) {
+	write_stab();
+	return;
+    }
+    /* Make sure we've learned something new before continuing */
+    if (card == s->card)
+	return;
+    s->card = card;
+    card->refs++;
+    if (card->cis_file) update_cis(s);
+
+    dev = card->device;
+
+    /* Set up MTD's */
+    for (i = 0; i < card->bindings; i++)
+	if (dev[i]->needs_mtd)
+	    break;
+    if (i < card->bindings)
+	bind_mtd(sn);
+
+    /* Install kernel modules */
+    for (i = 0; i < card->bindings; i++) {
+	dev[i]->refs++;
+	for (j = 0; j < dev[i]->modules; j++)
+	    install_module(dev[i]->module[j], dev[i]->opts[j]);
+    }
+
+    /* Bind drivers by their dev_info identifiers */
+    for (i = 0; i < card->bindings; i++) {
+	mybind = xcalloc(1, sizeof(bind_info_t));
+	strcpy((char *)mybind->dev_info, (char *)dev[i]->dev_info);
+	if (strcmp(mybind->dev_info, "cb_enabler") == 0)
+	    mybind->function = BIND_FN_ALL;
+	else
+	    mybind->function = card->dev_fn[i];
+	if (ioctl(s->fd, DS_BIND_REQUEST, mybind) != 0) {
+	    if (errno == EBUSY) {
+		syslog(LOG_INFO, "'%s' already bound to socket %d",
+			(char *)mybind->dev_info, sn);
+	    } else {
+		syslog(LOG_INFO, "bind '%s' to socket %d failed: %m",
+			(char *)mybind->dev_info, sn);
+		beep(BEEP_TIME, BEEP_ERR);
+		write_stab();
+		return;
+	    }
+	}
+
+	for (ret = j = 0; j < 10; j++) {
+	    ret = ioctl(s->fd, DS_GET_DEVICE_INFO, mybind);
+	    if ((ret == 0) || (errno != EAGAIN))
+		break;
+	    usleep(100000);
+	}
+	if (ret != 0) {
+	    syslog(LOG_INFO, "get dev info on socket %d failed: %m",
+		    sn);
+	    if ((errno == EAGAIN) &&
+		    (strcmp(dev[i]->module[dev[i]->modules-1],
+			    (char *)mybind->dev_info) != 0))
+		syslog(LOG_INFO, "wrong module '%s' for device '%s'?",
+			dev[i]->module[dev[i]->modules-1],
+			(char *)mybind->dev_info);
+	    ioctl(s->fd, DS_UNBIND_REQUEST, mybind);
+	    beep(BEEP_TIME, BEEP_ERR);
+	    write_stab();
+	    return;
+	}
+	tail = &s->xbind[i];
+	while (ret == 0) {
+	    bind_info_t *old;
+	    if ((strlen(mybind->name) > 3) && (mybind->name[2] == '#'))
+		xlate_scsi_name(mybind);
+	    old = *tail = mybind; tail = (bind_info_t **)&mybind->next;
+	    mybind = (bind_info_t *)xmalloc(sizeof(bind_info_t));
+	    memcpy(mybind, old, sizeof(bind_info_t));
+	    ret = ioctl(s->fd, DS_GET_NEXT_DEVICE, mybind);
+	}
+	*tail = NULL; free(mybind);
+	write_stab();
+    }
+
+    /* Run "start" commands */
+    for (i = ret = 0; i < card->bindings; i++) {
+	char *class = EITHER_OR(card->class[i], dev[i]->class);
+	if (class)
+	    ret |= execute_on_all("start", class, sn, i);
+    }
+    beep(BEEP_TIME, (ret) ? BEEP_ERR : BEEP_OK);
+
+}
+
+/*====================================================================*/
+
+static int do_check(int sn)
+{
+    socket_info_t *s = &mysocket[sn];
+    card_info_t *card;
+    device_info_t **dev;
+    int i;
+
+    card = s->card;
+    if (card == NULL)
+	return 0;
+
+    /* Run "check" commands */
+    dev = card->device;
+    for (i = 0; i < card->bindings; i++) {
+	char *class = EITHER_OR(card->class[i], dev[i]->class);
+	if (class && execute_on_all("check", class, sn, i))
+	    return CS_IN_USE;
+    }
+    return 0;
+}
+
+/*====================================================================*/
+
+static void do_remove(int sn)
+{
+    socket_info_t *s = &mysocket[sn];
+    card_info_t *card;
+    device_info_t **dev;
+    bind_info_t *mybind;
+    int i, j;
+
+    if (verbose) syslog(LOG_INFO, "shutting down socket %d", sn);
+
+    card = s->card;
+    if (card == NULL)
+	goto done;
+
+    /* Run "stop" commands */
+    dev = card->device;
+    for (i = 0; i < card->bindings; i++) {
+	char *class = EITHER_OR(card->class[i], dev[i]->class);
+	if (class)
+	    execute_on_all("stop", class, sn, i);
+    }
+
+    /* unbind driver instances */
+    for (i = 0; i < card->bindings; i++) {
+	if (s->xbind[i]) {
+	    if (ioctl(s->fd, DS_UNBIND_REQUEST, s->xbind[i]) != 0)
+		syslog(LOG_INFO, "unbind '%s' from socket %d failed: %m",
+			(char *)s->xbind[i]->dev_info, sn);
+	    while (s->xbind[i]) {
+		mybind = s->xbind[i];
+		s->xbind[i] = mybind->next;
+		free(mybind);
+	    }
+	}
+    }
+    for (i = 0; (s->mtd[i] != NULL); i++) {
+	bind_info_t b;
+	strcpy(b.dev_info, s->mtd[i]->module);
+	b.function = 0;
+	if (ioctl(s->fd, DS_UNBIND_REQUEST, &b) != 0)
+	    syslog(LOG_INFO, "unbind MTD '%s' from socket %d failed: %m",
+		    s->mtd[i]->module, sn);
+    }
+
+    /* remove kernel modules in inverse order */
+    for (i = 0; i < card->bindings; i++) {
+	for (j = dev[i]->modules-1; j >= 0; j--)
+	    remove_module(dev[i]->module[j]);
+	free_device(dev[i]);
+    }
+    /* Remove any MTD's bound to this socket */
+    for (i = 0; (s->mtd[i] != NULL); i++) {
+	remove_module(s->mtd[i]->module);
+	free_mtd(s->mtd[i]);
+	s->mtd[i] = NULL;
+    }
+
+done:
+    beep(BEEP_TIME, BEEP_OK);
+    free_card(card);
+    s->card = NULL;
+    write_stab();
+}
+
+/*====================================================================*/
+
+static void do_suspend(int sn)
+{
+    socket_info_t *s = &mysocket[sn];
+    card_info_t *card;
+    device_info_t **dev;
+    int i;
+
+    card = s->card;
+    if (card == NULL)
+	return;
+    dev = card->device;
+    for (i = 0; i < card->bindings; i++) {
+	char *class = EITHER_OR(card->class[i], dev[i]->class);
+	if (class && execute_on_all("suspend", class, sn, i))
+	    beep(BEEP_TIME, BEEP_ERR);
+    }
+}
+
+/*====================================================================*/
+
+static void do_resume(int sn)
+{
+    socket_info_t *s = &mysocket[sn];
+    card_info_t *card;
+    device_info_t **dev;
+    int i;
+
+    card = s->card;
+    if (card == NULL)
+	return;
+    dev = card->device;
+    for (i = 0; i < card->bindings; i++) {
+	char *class = EITHER_OR(card->class[i], dev[i]->class);
+	if (class && execute_on_all("resume", class, sn, i))
+	    beep(BEEP_TIME, BEEP_ERR);
+    }
+}
+
+/*====================================================================*/
+
+static void wait_for_pending(void)
+{
+    cs_status_t status;
+    int i;
+    status.Function = 0;
+    for (;;) {
+	usleep(100000);
+	for (i = 0; i < sockets; i++)
+	    if ((ioctl(mysocket[i].fd, DS_GET_STATUS, &status) == 0) &&
+		    (status.CardState & CS_EVENT_CARD_INSERTION))
+		break;
+	if (i == sockets) break;
+    }
+}
+
+/*====================================================================*/
+
+static void free_resources(void)
+{
+    adjust_list_t *al;
+    int fd = mysocket[0].fd;
+
+    for (al = root_adjust; al; al = al->next) {
+	if (al->adj.Action == ADD_MANAGED_RESOURCE) {
+	    al->adj.Action = REMOVE_MANAGED_RESOURCE;
+	    ioctl(fd, DS_ADJUST_RESOURCE_INFO, &al->adj);
+	} else if ((al->adj.Action == REMOVE_MANAGED_RESOURCE) &&
+		(al->adj.Resource == RES_IRQ)) {
+	    al->adj.Action = ADD_MANAGED_RESOURCE;
+	    ioctl(fd, DS_ADJUST_RESOURCE_INFO, &al->adj);
+	}
+    }
+}
+
+/*====================================================================*/
+
+static void adjust_resources(void)
+{
+    adjust_list_t *al;
+    int ret;
+    char tmp[64];
+    int fd = mysocket[0].fd;
+
+    for (al = root_adjust; al; al = al->next) {
+	ret = ioctl(fd, DS_ADJUST_RESOURCE_INFO, &al->adj);
+	if (ret != 0) {
+	    switch (al->adj.Resource) {
+		case RES_MEMORY_RANGE:
+		    sprintf(tmp, "memory %#lx-%#lx",
+			    al->adj.resource.memory.Base,
+			    al->adj.resource.memory.Base +
+			    al->adj.resource.memory.Size - 1);
+		    break;
+		case RES_IO_RANGE:
+		    sprintf(tmp, "IO ports %#x-%#x",
+			    al->adj.resource.io.BasePort,
+			    al->adj.resource.io.BasePort +
+			    al->adj.resource.io.NumPorts - 1);
+		    break;
+		case RES_IRQ:
+		    sprintf(tmp, "irq %u", al->adj.resource.irq.IRQ);
+		    break;
+	    }
+	    syslog(LOG_INFO, "could not adjust resource: %s: %m", tmp);
+	}
+    }
+}
+
+/*====================================================================*/
+
+static void fork_now(void)
+{
+    int ret;
+    if ((ret = fork()) > 0)
+	_exit(0);
+    if (ret == -1)
+	syslog(LOG_ERR, "forking: %m");
+    if (setsid() < 0)
+	syslog(LOG_ERR, "detaching from tty: %m");
+}
+
+static void done(void)
+{
+    syslog(LOG_INFO, "exiting");
+    unlink(pidfile);
+    unlink(stabfile);
+}
+
+/*====================================================================*/
+
+/* most recent signal */
+static int caught_signal = 0;
+
+static void catch_signal(int sig)
+{
+    caught_signal = sig;
+    if (signal(sig, catch_signal) == SIG_ERR)
+	syslog(LOG_INFO, "signal(%d): %m", sig);
+}
+
+static void handle_signal(void)
+{
+    int i;
+    switch (caught_signal) {
+	case SIGTERM:
+	case SIGINT:
+	    for (i = 0; i < sockets; i++)
+		if ((mysocket[i].state & SOCKET_PRESENT) &&
+			(do_check(i) == 0)) do_remove(i);
+	    free_resources();
+	    exit(0);
+	    break;
+	case SIGHUP:
+	    free_resources();
+	    free_config();
+	    syslog(LOG_INFO, "re-loading config file");
+	    load_config();
+	    adjust_resources();
+	    break;
+#ifdef SIGPWR
+	case SIGPWR:
+	    break;
+#endif
+    }
+}
+
+/*====================================================================*/
+
+static int init_sockets(void)
+{
+    int fd, i;
+
+    major = lookup_dev("pcmcia");
+    if (major < 0) {
+	if (major == -ENODEV)
+	    syslog(LOG_ERR, "no pcmcia driver in /proc/devices");
+	else
+	    syslog(LOG_ERR, "could not open /proc/devices: %m");
+	exit(EXIT_FAILURE);
+    }
+    for (fd = -1, i = 0; i < MAX_SOCKS; i++) {
+	fd = open_sock(i, S_IFCHR|S_IREAD|S_IWRITE);
+	if (fd < 0) break;
+	mysocket[i].fd = fd;
+	mysocket[i].state = 0;
+    }
+    if ((fd < 0) && (errno != ENODEV) && (errno != ENOENT))
+	syslog(LOG_ERR, "open_sock(socket %d) failed: %m", i);
+    sockets = i;
+    if (sockets == 0) {
+	if (errno == ENODEV)
+	    syslog(LOG_ERR, "no sockets found!");
+	else if (errno == EBUSY)
+	    syslog(LOG_ERR, "another cardmgr is already running?");
+	return -1;
+    } else
+	syslog(LOG_INFO, "watching %d sockets", sockets);
+
+    adjust_resources();
+    return 0;
+}
+
+/*====================================================================*/
+
+int cardmgr_main(int argc, char *argv[])
+{
+    int optch, errflg;
+    int i, max_fd, ret, event, pass;
+    int delay_fork = 0;
+    struct timeval tv;
+    fd_set fds;
+
+    if (access("/var/lib/pcmcia", R_OK) == 0) {
+	stabfile = "/var/lib/pcmcia/stab";
+    } else {
+	stabfile = "/var/run/stab";
+    }
+    do_modprobe = (access("/sbin/modprobe", X_OK) == 0);
+
+    errflg = 0;
+    while ((optch = getopt(argc, argv, "qdvofc:m:p:s:")) != -1) {
+	switch (optch) {
+	    case 'q':
+		be_quiet = 1; break;
+	    case 'v':
+		verbose = 1; break;
+	    case 'o':
+		one_pass = 1; break;
+	    case 'f':
+		delay_fork = 1; break;
+	    case 'c':
+		configpath = strdup(optarg); break;
+	    case 'd':
+		/* deprecated: do nothing */ break;
+	    case 'm':
+		modpath = strdup(optarg); break;
+	    case 'p':
+		pidfile = strdup(optarg); break;
+	    case 's':
+		stabfile = strdup(optarg); break;
+	    default:
+		errflg = 1; break;
+	}
+    }
+    if (errflg || (optind < argc)) {
+	bb_show_usage();
+	return(EXIT_FAILURE);
+    }
+
+    openlog("cardmgr", LOG_PID|LOG_PERROR, LOG_DAEMON);
+
+    putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin");
+    if (verbose)
+	putenv("VERBOSE=1");
+    if (one_pass)
+	putenv("ONEPASS=1");
+
+    if (modpath == NULL) {
+	if (access("/lib/modules/preferred", X_OK) == 0)
+	    modpath = "/lib/modules/preferred";
+	else {
+	    struct utsname utsname;
+	    if (uname(&utsname) != 0) {
+		syslog(LOG_ERR, "uname(): %m");
+		return(EXIT_FAILURE);
+	    }
+	    modpath = (char *)xmalloc(strlen(utsname.release)+14);
+	    sprintf(modpath, "/lib/modules/%s", utsname.release);
+	}
+    }
+    if (access(modpath, X_OK) != 0)
+	syslog(LOG_INFO, "cannot access %s: %m", modpath);
+    /* We default to using modprobe if it is available */
+    do_modprobe |= (access("/sbin/modprobe", X_OK) == 0);
+
+    load_config();
+
+    if (init_sockets() != 0)
+	return(EXIT_FAILURE);
+
+    if (!one_pass) {
+	closelog();
+	close(0); close(1); close(2);
+	if (!delay_fork)
+	    fork_now();
+	openlog("cardmgr", LOG_PID|LOG_CONS, LOG_DAEMON);
+    }
+    syslog(LOG_INFO, "starting, version is " CS_PKG_RELEASE);
+
+    /* If we've gotten this far, then clean up pid and stab at exit */
+    atexit(&done);
+    write_pid();
+    write_stab();
+
+    if (signal(SIGHUP, catch_signal) == SIG_ERR)
+	syslog(LOG_ERR, "signal(SIGHUP): %m");
+    if (signal(SIGTERM, catch_signal) == SIG_ERR)
+	syslog(LOG_ERR, "signal(SIGTERM): %m");
+    if (signal(SIGINT, catch_signal) == SIG_ERR)
+	syslog(LOG_ERR, "signal(SIGINT): %m");
+#ifdef SIGPWR
+    if (signal(SIGPWR, catch_signal) == SIG_ERR)
+	syslog(LOG_ERR, "signal(SIGPWR): %m");
+#endif
+
+    for (i = max_fd = 0; i < sockets; i++)
+	max_fd = (mysocket[i].fd > max_fd) ? mysocket[i].fd : max_fd;
+
+    /* First select() call: poll, don't wait */
+    tv.tv_sec = tv.tv_usec = 0;
+
+    /* Wait for sockets in setup-pending state to settle */
+    if (one_pass || delay_fork)
+	wait_for_pending();
+
+    for (pass = 0; ; pass++) {
+	FD_ZERO(&fds);
+	for (i = 0; i < sockets; i++)
+	    FD_SET(mysocket[i].fd, &fds);
+
+	while ((ret = select(max_fd+1, &fds, NULL, NULL,
+			((pass == 0) ? &tv : NULL))) < 0) {
+	    if (errno == EINTR) {
+		handle_signal();
+	    } else {
+		syslog(LOG_ERR, "select(): %m");
+		return(EXIT_FAILURE);
+	    }
+	}
+
+	for (i = 0; i < sockets; i++) {
+	    if (!FD_ISSET(mysocket[i].fd, &fds))
+		continue;
+	    ret = read(mysocket[i].fd, &event, 4);
+	    if ((ret == -1) && (errno != EAGAIN))
+		syslog(LOG_INFO, "read(%d): %m\n", i);
+	    if (ret != 4)
+		continue;
+
+	    switch (event) {
+		case CS_EVENT_CARD_REMOVAL:
+		    mysocket[i].state = 0;
+		    do_remove(i);
+		    break;
+		case CS_EVENT_EJECTION_REQUEST:
+		    ret = do_check(i);
+		    if (ret == 0) {
+			mysocket[i].state = 0;
+			do_remove(i);
+		    }
+		    write(mysocket[i].fd, &ret, 4);
+		    break;
+		case CS_EVENT_CARD_INSERTION:
+		case CS_EVENT_INSERTION_REQUEST:
+		    mysocket[i].state |= SOCKET_PRESENT;
+		case CS_EVENT_CARD_RESET:
+		    mysocket[i].state |= SOCKET_READY;
+		    do_insert(i);
+		    break;
+		case CS_EVENT_RESET_PHYSICAL:
+		    mysocket[i].state &= ~SOCKET_READY;
+		    break;
+		case CS_EVENT_PM_SUSPEND:
+		    do_suspend(i);
+		    break;
+		case CS_EVENT_PM_RESUME:
+		    do_resume(i);
+		    break;
+	    }
+
+	}
+
+	if (one_pass)
+	    return(EXIT_SUCCESS);
+	if (delay_fork) {
+	    fork_now();
+	    write_pid();
+	    delay_fork = 0;
+	}
+
+    } /* repeat */
+    return 0;
+}
+
+
+
+/*======================================================================
+
+    Utility to look up information about SCSI devices
+
+    scsi_info.c 1.20 2003/08/30 20:58:06
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is David A. Hinds
+    <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU General Public License version 2 (the "GPL"), in
+    which case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+
+======================================================================*/
+#define SCSI_IOCTL_GET_IDLUN		0x5382
+#define SCSI_IOCTL_GET_BUS_NUMBER	0x5386
+
+/*====================================================================*/
+
+static inline int get_host_no(int host)
+{
+    DIR *dir;
+    struct dirent *ent;
+    char fn[128];
+
+    dir = opendir("/proc/scsi");
+    if (dir == NULL)
+	return -1;
+    while ((ent = readdir(dir)) != NULL)
+	if ((ent->d_ino & 0xff) == host)
+	    break;
+    closedir(dir);
+    if (!ent) {
+	perror("could not find SCSI host in /proc/scsi");
+	return -1;
+    }
+
+    sprintf(fn, "/proc/scsi/%s", ent->d_name);
+    dir = opendir(fn);
+    if (dir == NULL) {
+	return -1;
+    }
+    do {
+	ent = readdir(dir);
+    } while ((ent) && (ent->d_name[0] == '.'));
+    closedir(dir);
+    if (ent)
+	return atoi(ent->d_name);
+    else
+	return -1;
+}
+
+/*====================================================================*/
+
+int scsi_info_main(int argc, char *argv[])
+{
+    int i, fd, host, channel, id, lun;
+    u_int arg[2];
+    char match[128], s[128], vendor[9], model[17], rev[5];
+    FILE *f;
+
+    if (argc != 2) {
+	bb_show_usage();
+    }
+
+    fd = open(argv[1], O_RDONLY);
+    if (fd < 0)
+	fd = open(argv[1], O_RDONLY|O_NONBLOCK);
+    if (fd < 0) {
+	bb_perror_msg_and_die("open() failed");
+    }
+
+    memset(arg, 0, sizeof(arg));
+    if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, arg) != 0) {
+	bb_perror_msg_and_die("SCSI device info error");
+    }
+
+    id = arg[0] & 0xff;
+    lun = (arg[0] >> 8) & 0xff;
+    channel = (arg[0] >> 16) & 0xff;
+    host = ((arg[0] >> 24) & 0xff);
+
+    memset(arg, 0, sizeof(arg));
+    if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, arg) == 0)
+	host = arg[0];
+    else
+	host = get_host_no(host);
+
+    sprintf(match, "Host: scsi%d Channel: %02x Id: %02x Lun: %02x\n",
+	    host, channel, id, lun);
+
+    printf("SCSI_ID=\"%d,%d,%d\"\n", channel, id, lun);
+    printf("HOST=\"%d\"\n", host);
+
+    f = fopen("/proc/scsi/scsi", "r");
+    if (f == NULL) {
+	printf("MODEL=\"Unknown\"\nFW_REV=\"Unknown\"\n");
+	return(0);
+    }
+
+    while (fgets(s, 128, f) != NULL)
+	if (strcmp(s, match) == 0) break;
+    fgets(s, 128, f);
+    strncpy(vendor, s+10, 8); vendor[8] = '\0';
+    for (i = 7; (i >= 0) && (vendor[i] == ' '); i--)
+	vendor[i] = '\0';
+    strncpy(model, s+26, 16); model[16] = '\0';
+    for (i = 15; (i >= 0) && (model[i] == ' '); i--)
+	model[i] = '\0';
+    strncpy(rev, s+48, 4); rev[4] = '\0';
+    for (i = 3; (i >= 0) && (rev[i] == ' '); i--)
+	rev[i] = '\0';
+    printf("MODEL=\"%s %s\"\nFW_REV=\"%s\"\n", vendor, model, rev);
+    return(0);
+}
+
+
+/*======================================================================
+
+    Utility to look up information about IDE devices
+
+    ide_info.c 1.15 2002/06/16 19:21:58
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is David A. Hinds
+    <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU General Public License version 2 (the "GPL"), in
+    which case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+
+======================================================================*/
+
+#define HDIO_GET_IDENTITY	0x030d	/* get IDE identification info */
+
+struct hd_driveid {
+	uint8_t	    junk0[20];
+	uint8_t	    serial_no[20];
+	uint8_t	    junk1[6];
+	uint8_t	    fw_rev[8];
+	uint8_t	    model[40];
+//	uint8_t	    junk3[162];
+} __attribute__((packed));
+
+#if  __BYTE_ORDER == __BIG_ENDIAN
+#define be16_to_cpu(x) (x)
+#else
+#define be16_to_cpu(x) bswap_16(x)
+#endif
+
+/*====================================================================*/
+
+#include <ctype.h>
+
+static inline void fix_string(char *s, int len)
+{
+    char *t = s, *x = s+len;
+
+    while (t < x) {
+	for (; t < x; t++)
+	    if (*t != ' ') break;
+	while (t < x) {
+	    *s++ = *t;
+	    if (*t++ == ' ') break;
+	}
+    }
+    if ((s > x-len) && (s[-1] == ' ')) s--;
+    if (s < t) *s = '\0';
+}
+
+
+static inline int read_proc_identify(char *dev, struct hd_driveid *id)
+{
+    char proc[] = "/proc/ide/hd#/identify";
+    char s[42];
+    int i;
+
+    if ((strncmp(dev, "/dev/hd", 7) != 0) || (strlen(dev) != 8))
+	return -1;
+    proc[12] = dev[7];
+    if (access(proc, R_OK) == 0) {
+	FILE *f = fopen(proc, "r");
+	uint16_t *b, *b1;
+	b = b1 = (uint16_t *)id;
+	while (fgets(s, 41, f)) {
+	    for (i = 0; i < 40; i += 5, b++) {
+		if (((b-b1)*2)>sizeof(struct hd_driveid))
+		    break;
+		*b = be16_to_cpu(strtol(s+i, NULL, 16));
+	    }
+	    if (((b-b1)*2)>sizeof(struct hd_driveid))
+		break;
+	}
+	fclose(f);
+	fix_string(id->model, sizeof(id->model));
+	fix_string(id->fw_rev, sizeof(id->fw_rev));
+	fix_string(id->serial_no, sizeof(id->serial_no));
+	return 0;
+    }
+    return -1;
+}
+
+int ide_info_main(int argc, char *argv[])
+{
+    int fd;
+    struct hd_driveid *id;
+
+    if (argc != 2) {
+	bb_show_usage();
+    }
+
+    id = xcalloc(1, sizeof(struct hd_driveid));
+    if (read_proc_identify(argv[1], id) != 0) {
+	fd = open(argv[1], O_RDONLY);
+	if (fd < 0) {
+	    bb_perror_msg_and_die("open() failed");
+	}
+	if (ioctl(fd, HDIO_GET_IDENTITY, id) != 0) {
+	    bb_perror_msg_and_die("IDE device info error");
+	}
+    }
+
+    printf("MODEL=\"%.40s\"\n", id->model);
+    printf("FW_REV=\"%.8s\"\n", id->fw_rev);
+    printf("SERIAL_NO=\"%.20s\"\n", id->serial_no);
+    return(0);
+}
diff -urN busybox.orig/hotplug/cardmgr.h busybox/hotplug/cardmgr.h
--- busybox.orig/hotplug/cardmgr.h	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/cardmgr.h	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,113 @@
+/*
+ * cardmgr.h 1.38 2002/08/19 03:21:20
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#define MAX_SOCKS	8
+#define MAX_BINDINGS	4
+#define MAX_MODULES	4
+
+typedef struct adjust_list_t {
+    adjust_t		adj;
+    struct adjust_list_t *next;
+} adjust_list_t;
+
+typedef struct func_ident_t {
+    u_char		funcid;
+} func_ident_t;
+
+typedef struct manfid_ident_t {
+    u_short		manf;
+    u_short		card;
+} manfid_ident_t;
+
+typedef struct vers_ident_t {
+    int			ns;
+    char		*pi[4];
+} vers_ident_t;
+
+typedef struct tuple_ident_t {
+    cisdata_t		code;
+    long		ofs;
+    char		*info;
+} tuple_ident_t;
+
+typedef struct device_info_t {
+    dev_info_t		dev_info;
+    int			needs_mtd;
+    int			modules;
+    char		*module[MAX_MODULES];
+    char		*opts[MAX_MODULES];
+    char		*class;
+    int			refs;
+    struct device_info_t *next;
+} device_info_t;
+
+#define VERS_1_IDENT	0x0001
+#define MANFID_IDENT	0x0002
+#define TUPLE_IDENT	0x0010
+#define FUNC_IDENT	0x0020
+#define BLANK_IDENT	0x0040
+#define PCI_IDENT	0x0080
+#define EXCL_IDENT	0x00f0
+
+typedef struct card_info_t {
+    char		*name;
+    int			ident_type;
+    union {
+	vers_ident_t	vers;
+	tuple_ident_t	tuple;
+	func_ident_t	func;
+    } id;
+    manfid_ident_t	manfid;
+    int			bindings;
+    device_info_t	*device[MAX_BINDINGS];
+    int			dev_fn[MAX_BINDINGS];
+    char		*class[MAX_BINDINGS];
+    char		*cis_file;
+    int			refs;
+    struct card_info_t	*next;
+} card_info_t;
+
+typedef struct mtd_ident_t {
+    char		*name;
+    enum {
+	JEDEC_MTD=1, DTYPE_MTD, DEFAULT_MTD
+    } mtd_type;
+    int			dtype, jedec_mfr, jedec_info;
+    char		*module, *opts;
+    int			refs;
+    struct mtd_ident_t	*next;
+} mtd_ident_t;
+
+extern adjust_list_t	*root_adjust;
+extern device_info_t	*root_device;
+extern card_info_t	*blank_card;
+extern card_info_t	*root_card, *root_func;
+extern mtd_ident_t	*root_mtd, *default_mtd;
+
+int parse_configfile(char *fn);
diff -urN busybox.orig/hotplug/hotplug.c busybox/hotplug/hotplug.c
--- busybox.orig/hotplug/hotplug.c	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/hotplug.c	2004-04-17 04:26:41.000000000 -0600
@@ -0,0 +1,985 @@
+/*
+ * hotplug.c
+ *
+ * A version of /sbin/hotplug that is not a script.
+ *
+ * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ *
+ *	This program is distributed in the hope that it will be useful, but
+ *	WITHOUT ANY WARRANTY; without even the implied warranty of
+ *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *	General Public License for more details.
+ *
+ *	You should have received a copy of the GNU General Public License along
+ *	with this program; if not, write to the Free Software Foundation, Inc.,
+ *	675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Adjusted to read the various modules.*map files and for use
+ * in BusyBox by Erik Andersen <andersen@codepoet.org>
+ *
+ */
+
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/utsname.h>
+#include "busybox.h"
+
+#define HOTPLUG_VERSION "0.4"
+#define LINELENGTH 8192
+
+struct subsystem {
+    const char * name;
+    int (* handler) (void);
+};
+
+extern int log_message (int level, const char *fmt, ...)  __attribute__ ((__format__(__printf__, 2, 3)));
+extern int split_3values (const char *string, int base, unsigned int * value1,
+	unsigned int * value2, unsigned int * value3);
+extern int split_2values (const char *string, int base, unsigned int * value1,
+	unsigned int * value2);
+extern int call_subsystem (const char *string, struct subsystem *subsystem);
+extern int load_module (const char *module_name);
+extern int usb_handler (void);
+extern int pci_handler (void);
+extern int ieee1394_handler (void);
+
+#define ADD_STRING	"add"
+#define REMOVE_STRING	"remove"
+
+
+//#define DEBUG 1
+#ifdef DEBUG
+#include <syslog.h>
+	#define dbg(format, arg...) do { log_message (LOG_DEBUG, __FUNCTION__ ": " format, ## arg); } while (0)
+#else
+	#define dbg(format, arg...) do { } while (0)
+#endif
+
+
+int cpu_handler (void)
+{
+    /* Not handled */
+    return 0;
+}
+
+int net_handler (void)
+{
+    /* Not handled */
+    return 0;
+}
+
+int dock_handler (void)
+{
+    /* Not handled */
+    return 0;
+}
+
+static struct subsystem main_subsystem[] = {
+    { "pci",	    pci_handler },
+    { "usb",	    usb_handler },
+    { "ieee1394",   ieee1394_handler },
+    { "cpu",	    cpu_handler },
+    { "net",	    net_handler },
+    { "dock",	    dock_handler },
+    { NULL,	    NULL }
+};
+
+int hotplug_main(int argc, char *argv[])
+{
+    if (argc != 2) {
+	dbg ("unknown number of arguments");
+	return 1;
+    }
+    /* pass control to the subsystem specified by argv[1]. */
+    return call_subsystem (argv[1], main_subsystem);
+}
+
+
+
+/* The ieee1394 functions */
+#define IEEE1394_MATCH_VENDOR_ID	0x0001
+#define IEEE1394_MATCH_MODEL_ID		0x0002
+#define IEEE1394_MATCH_SPECIFIER_ID	0x0004
+#define IEEE1394_MATCH_VERSION		0x0008
+
+struct ieee1394_module_map {
+	const char * module_name;
+	unsigned int match_flags;
+	unsigned int vendor_id;
+	unsigned int model_id;
+	unsigned int specifier_id;
+	unsigned int version;
+} __attribute__ ((packed));
+static struct ieee1394_module_map *ieee1394_module_map;
+
+void ieee1394_read_pcimap(void)
+{
+    FILE *ieee1394map_file;
+    struct utsname utsname;
+    struct ieee1394_module_map *entry = ieee1394_module_map;
+    char *prevmodule = "";
+    char filename[MAXPATHLEN];
+    char line[LINELENGTH];
+    char module[LINELENGTH];
+    int count, mapsize;
+
+    if (uname(&utsname) < 0) {
+	perror("uname");
+	exit(1);
+    }
+    sprintf(filename, "/lib/modules/%s/modules.ieee1394map", utsname.release);
+    if ((ieee1394map_file = fopen(filename, "r")) == NULL) {
+	bb_perror_msg_and_die("Could not open %s", filename);
+    }
+
+    count = mapsize = 0;
+    while(fgets(line, LINELENGTH, ieee1394map_file) != NULL) {
+
+	if (line[0] == '#')
+	    continue;
+
+	count++;
+	if (count >= mapsize) {
+	    mapsize+=100;
+	    ieee1394_module_map = xrealloc(ieee1394_module_map, (sizeof(struct ieee1394_module_map) * mapsize));
+	    entry = ieee1394_module_map + count - 1;
+	    memset(entry, 0, (sizeof(struct ieee1394_module_map) * 100));
+	}
+
+	if (sscanf(line, "%s 0x%x 0x%x 0x%x 0x%x 0x%x",
+		    module,
+		    &entry->match_flags, &entry->vendor_id,
+		    &entry->model_id, &entry->specifier_id,
+		    &entry->version) != 6) {
+	    bb_error_msg("modules.ieee1394map unparsable line: %s.\n", line);
+	    free(entry);
+	    continue;
+	}
+
+	/* Optimize memory allocation a bit, in case someday we
+	   have Linux systems with ~100,000 modules.  It also
+	   allows us to just compare pointers to avoid trying
+	   to load a module twice. */
+	if (strcmp(module, prevmodule) != 0) {
+	    prevmodule = xmalloc(strlen(module)+1);
+	    strcpy(prevmodule, module);
+	}
+	entry->module_name = prevmodule;
+    }
+    fclose(ieee1394map_file);
+}
+static int ieee1394_match(unsigned int vendor_id, unsigned int specifier_id, unsigned int version)
+{
+    int i;
+    int retval;
+
+    dbg ("vendor_id = %x, specifier_id = %x, version = %x",
+	    vendor_id, specifier_id, version);
+
+    for (i = 0; ieee1394_module_map[i].module_name != NULL; ++i) {
+	dbg ("looking at %s, match_flags = %x",
+		ieee1394_module_map[i].module_name,
+		ieee1394_module_map[i].match_flags);
+	if ((ieee1394_module_map[i].match_flags & IEEE1394_MATCH_VENDOR_ID) &&
+		(ieee1394_module_map[i].vendor_id != vendor_id)) {
+	    dbg ("vendor check failed %x != %x",
+		    ieee1394_module_map[i].vendor_id,
+		    vendor_id);
+	    continue;
+	}
+	if ((ieee1394_module_map[i].match_flags & IEEE1394_MATCH_SPECIFIER_ID) &&
+		(ieee1394_module_map[i].specifier_id != specifier_id)) {
+	    dbg ("specifier_id check failed %x != %x",
+		    ieee1394_module_map[i].specifier_id,
+		    specifier_id);
+	    continue;
+	}
+	if ((ieee1394_module_map[i].match_flags & IEEE1394_MATCH_VERSION) &&
+		(ieee1394_module_map[i].version != version)) {
+	    dbg ("version check failed %x != %x",
+		    ieee1394_module_map[i].version,
+		    version);
+	    continue;
+	}
+	/* found one! */
+	dbg ("loading %s", ieee1394_module_map[i].module_name);
+	retval = load_module (ieee1394_module_map[i].module_name);
+	if (retval)
+	    return retval;
+    }
+
+    return 0;
+}
+
+
+static int ieee1394_add (void)
+{
+    char *vendor_env;
+    char *specifier_env;
+    char *version_env;
+    int error;
+    unsigned int vendor_id;
+    unsigned int specifier_id;
+    unsigned int version;
+
+    ieee1394_read_pcimap();
+
+    vendor_env = getenv ("VENDOR_ID");
+    specifier_env = getenv ("SPECIFIER_ID");
+    version_env = getenv ("VERSION");
+    if ((vendor_env == NULL) ||
+	    (specifier_env == NULL) ||
+	    (version_env == NULL)) {
+	dbg ("missing an environment variable, aborting.");
+	return 1;
+    }
+    vendor_id = strtoul (vendor_env, NULL, 16);
+    specifier_id = strtoul (specifier_env, NULL, 16);
+    version = strtoul (version_env, NULL, 16);
+
+    error = ieee1394_match (vendor_id, specifier_id, version);
+
+    return error;
+}
+
+
+static int ieee1394_remove (void)
+{
+    /* right now we don't do anything here :) */
+    return 0;
+}
+
+
+static struct subsystem ieee1394_subsystem[] = {
+    { ADD_STRING, ieee1394_add },
+    { REMOVE_STRING, ieee1394_remove },
+    { NULL, NULL }
+};
+
+
+int ieee1394_handler (void)
+{
+    char * action;
+    action = getenv ("ACTION");
+    dbg ("action = %s", action);
+    if (action == NULL) {
+	dbg ("missing ACTION environment variable, aborting.");
+	return 1;
+    }
+    return call_subsystem (action, ieee1394_subsystem);
+}
+
+/* The pci functions */
+#define PCI_ANY				0xffffffff
+
+struct pci_module_map {
+    const char * module_name;
+    unsigned int vendor;
+    unsigned int device;
+    unsigned int subvendor;
+    unsigned int subdevice;
+    unsigned int class;
+    unsigned int class_mask;
+} __attribute__ ((packed));
+static struct pci_module_map *pci_module_map;
+
+void pci_read_pcimap(void)
+{
+    FILE *pcimap_file;
+    struct utsname utsname;
+    struct pci_module_map *entry = pci_module_map;
+    unsigned int driver_data;
+    char *prevmodule = "";
+    char filename[MAXPATHLEN];
+    char line[LINELENGTH];
+    char module[LINELENGTH];
+    int count, mapsize;
+
+    if (uname(&utsname) < 0) {
+	perror("uname");
+	exit(1);
+    }
+    sprintf(filename, "/lib/modules/%s/modules.pcimap", utsname.release);
+    if ((pcimap_file = fopen(filename, "r")) == NULL) {
+	bb_perror_msg_and_die("Could not open %s", filename);
+    }
+
+    count = mapsize = 0;
+    while(fgets(line, LINELENGTH, pcimap_file) != NULL) {
+
+	if (line[0] == '#')
+	    continue;
+
+	count++;
+	if (count >= mapsize) {
+	    mapsize+=100;
+	    pci_module_map = xrealloc(pci_module_map, (sizeof(struct pci_module_map) * mapsize));
+	    entry = pci_module_map + count - 1;
+	    memset(entry, 0, (sizeof(struct pci_module_map) * 100));
+	}
+	entry = pci_module_map + count - 1;
+
+	if (sscanf(line, "%s 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
+		    module,
+		    &entry->vendor, &entry->device,
+		    &entry->subvendor, &entry->subdevice,
+		    &entry->class, &entry->class_mask,
+		    &driver_data) != 8) {
+	    bb_error_msg("modules.pcimap unparsable line: %s.\n", line);
+	    free(entry);
+	    continue;
+	}
+
+	/* Optimize memory allocation a bit, in case someday we
+	   have Linux systems with ~100,000 modules.  It also
+	   allows us to just compare pointers to avoid trying
+	   to load a module twice. */
+	if (strcmp(module, prevmodule) != 0) {
+	    prevmodule = xmalloc(strlen(module)+1);
+	    strcpy(prevmodule, module);
+	}
+	entry->module_name = prevmodule;
+    }
+    fclose(pcimap_file);
+}
+
+static int pci_match_vendor (unsigned int vendor, unsigned int device,
+			 unsigned int subvendor, unsigned int subdevice,
+			 unsigned int pci_class)
+{
+    int i;
+    int retval;
+    unsigned int class_temp;
+
+    dbg ("vendor = %x, device = %x, subvendor = %x, subdevice = %x",
+	    vendor, device, subvendor, subdevice);
+
+    for (i = 0; pci_module_map[i].module_name != NULL; ++i) {
+	dbg ("looking at %s", pci_module_map[i].module_name);
+	if ((pci_module_map[i].vendor != PCI_ANY) &&
+		(pci_module_map[i].vendor != vendor)) {
+	    dbg ("vendor check failed %x != %x",
+		    pci_module_map[i].vendor, vendor);
+	    continue;
+	}
+	if ((pci_module_map[i].device != PCI_ANY) &&
+		(pci_module_map[i].device != device)) {
+	    dbg ("device check failed %x != %x",
+		    pci_module_map[i].device, device);
+	    continue;
+	}
+	if ((pci_module_map[i].subvendor != PCI_ANY) &&
+		(pci_module_map[i].subvendor != subvendor)) {
+	    dbg ("subvendor check failed %x != %x",
+		    pci_module_map[i].subvendor, subvendor);
+	    continue;
+	}
+	if ((pci_module_map[i].subdevice != PCI_ANY) &&
+		(pci_module_map[i].subdevice != subdevice)) {
+	    dbg ("subdevice check failed %x != %x",
+		    pci_module_map[i].subdevice, subdevice);
+	    continue;
+	}
+
+	/* check that the class matches */
+	class_temp = (pci_module_map[i].class ^ pci_class) & pci_module_map[i].class_mask;
+	if (class_temp != 0) {
+	    dbg ("class mask check failed %x != %x",
+		    pci_module_map[i].class, class_temp);
+	    continue;
+	}
+
+	/* found one! */
+	dbg ("loading %s", pci_module_map[i].module_name);
+	retval = load_module (pci_module_map[i].module_name);
+	if (retval)
+	    return retval;
+    }
+
+    return 0;
+}
+
+static int pci_add (void)
+{
+    char *class_env;
+    char *id_env;
+    char *subsys_env;
+    int error;
+    unsigned int vendor;
+    unsigned int device;
+    unsigned int subvendor;
+    unsigned int subdevice;
+    unsigned int class;
+
+    pci_read_pcimap();
+
+    id_env = getenv("PCI_ID");
+    subsys_env = getenv("PCI_SUBSYS_ID");
+    class_env = getenv("PCI_CLASS");
+    if ((id_env == NULL) ||
+	    (subsys_env == NULL) ||
+	    (class_env == NULL)) {
+	dbg ("missing an environment variable, aborting.");
+	return 1;
+    }
+
+    error = split_2values (id_env, 16, &vendor, &device);
+    if (error)
+	return error;
+    error = split_2values (subsys_env, 16, &subvendor, &subdevice);
+    if (error)
+	return error;
+    class = strtoul (class_env, NULL, 16);
+
+    error = pci_match_vendor (vendor, device, subvendor, subdevice, class);
+
+    return error;
+}
+
+
+static int pci_remove (void)
+{
+    /* right now we don't do anything here :) */
+    return 0;
+}
+
+static struct subsystem pci_subsystem[] = {
+    { ADD_STRING,	pci_add },
+    { REMOVE_STRING,	pci_remove },
+    { NULL,		NULL }
+};
+
+int pci_handler (void)
+{
+    char * action;
+
+    action = getenv ("ACTION");
+    dbg ("action = %s", action);
+    if (action == NULL) {
+	dbg ("missing ACTION environment variable, aborting.");
+	return 1;
+    }
+    return call_subsystem (action, pci_subsystem);
+}
+
+
+/* The usb functions */
+#define USB_DEVICE_ID_MATCH_VENDOR		0x0001
+#define USB_DEVICE_ID_MATCH_PRODUCT		0x0002
+#define USB_DEVICE_ID_MATCH_DEV_LO		0x0004
+#define USB_DEVICE_ID_MATCH_DEV_HI		0x0008
+#define USB_DEVICE_ID_MATCH_DEV_CLASS		0x0010
+#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS	0x0020
+#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL	0x0040
+#define USB_DEVICE_ID_MATCH_INT_CLASS		0x0080
+#define USB_DEVICE_ID_MATCH_INT_SUBCLASS	0x0100
+#define USB_DEVICE_ID_MATCH_INT_PROTOCOL	0x0200
+#define USB_DEVICE_ID_MATCH_DEVICE		(USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
+#define USB_DEVICE_ID_MATCH_DEV_RANGE		(USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)
+#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION	(USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)
+#define USB_DEVICE_ID_MATCH_DEV_INFO		(USB_DEVICE_ID_MATCH_DEV_CLASS | \
+						USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \
+						USB_DEVICE_ID_MATCH_DEV_PROTOCOL)
+#define USB_DEVICE_ID_MATCH_INT_INFO		(USB_DEVICE_ID_MATCH_INT_CLASS | \
+						USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
+						USB_DEVICE_ID_MATCH_INT_PROTOCOL)
+
+struct usb_module_map {
+	const char * module_name;
+	unsigned int match_flags;
+	unsigned int idVendor;
+	unsigned int idProduct;
+	unsigned int bcdDevice_lo;
+	unsigned int bcdDevice_hi;
+	unsigned int bDeviceClass;
+	unsigned int bDeviceSubClass;
+	unsigned int bDeviceProtocol;
+	unsigned int bInterfaceClass;
+	unsigned int bInterfaceSubClass;
+	unsigned int bInterfaceProtocol;
+} __attribute__ ((packed));
+static struct usb_module_map *usb_module_map;
+
+void usb_read_usbmap(void)
+{
+    FILE *usbmap_file;
+    struct utsname utsname;
+    struct usb_module_map *entry = usb_module_map;
+    char *prevmodule = "";
+    char filename[MAXPATHLEN];
+    char line[LINELENGTH];
+    char module[LINELENGTH];
+    int count, mapsize;
+
+    if (uname(&utsname) < 0) {
+	perror("uname");
+	exit(1);
+    }
+    sprintf(filename, "/lib/modules/%s/modules.usbmap", utsname.release);
+    if ((usbmap_file = fopen(filename, "r")) == NULL) {
+	bb_perror_msg_and_die("Could not open %s", filename);
+    }
+
+    count = mapsize = 0;
+    while(fgets(line, LINELENGTH, usbmap_file) != NULL) {
+
+	if (line[0] == '#')
+	    continue;
+
+	count++;
+	if (count >= mapsize) {
+	    mapsize+=100;
+	    usb_module_map = xrealloc(usb_module_map, (sizeof(struct usb_module_map) * mapsize));
+	    entry = usb_module_map + count - 1;
+	    memset(entry, 0, (sizeof(struct usb_module_map) * 100));
+	}
+	entry = usb_module_map + count - 1;
+
+	if (sscanf(line, "%s 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
+		    module,
+		    &entry->match_flags, &entry->idVendor,
+		    &entry->idProduct, &entry->bcdDevice_lo,
+		    &entry->bcdDevice_hi, &entry->bDeviceClass,
+		    &entry->bDeviceSubClass, &entry->bDeviceProtocol,
+		    &entry->bInterfaceClass, &entry->bInterfaceSubClass,
+		    &entry->bInterfaceProtocol) != 12) {
+	    bb_error_msg("modules.usbmap unparsable line: %s.\n", line);
+	    free(entry);
+	    continue;
+	}
+
+	/* Optimize memory allocation a bit, in case someday we
+	   have Linux systems with ~100,000 modules.  It also
+	   allows us to just compare pointers to avoid trying
+	   to load a module twice. */
+	if (strcmp(module, prevmodule) != 0) {
+	    prevmodule = xmalloc(strlen(module)+1);
+	    strcpy(prevmodule, module);
+	}
+	entry->module_name = prevmodule;
+    }
+    fclose(usbmap_file);
+}
+
+static int usb_match_vendor_product (unsigned int vendor, unsigned int product, unsigned int bcdDevice)
+{
+    int i;
+    int retval;
+
+    dbg ("vendor = %x, product = %x, bcdDevice = %x", vendor, product, bcdDevice);
+
+    for (i = 0; usb_module_map[i].module_name != NULL; ++i) {
+	dbg ("looking at %s, match_flags = %x", usb_module_map[i].module_name, usb_module_map[i].match_flags);
+	if (usb_module_map[i].match_flags & (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)) {
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_VENDOR) &&
+		    (usb_module_map[i].idVendor != vendor)) {
+		dbg ("vendor check failed %x != %x", usb_module_map[i].idVendor, vendor);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_PRODUCT) &&
+		    (usb_module_map[i].idProduct != product)) {
+		dbg ("product check failed %x != %x", usb_module_map[i].idProduct, product);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_DEV_LO) &&
+		    (usb_module_map[i].bcdDevice_lo < bcdDevice)) {
+		dbg ("bcdDevice_lo check failed %x > %x", usb_module_map[i].bcdDevice_lo, bcdDevice);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_DEV_HI) &&
+		    (usb_module_map[i].bcdDevice_hi >= bcdDevice)) {
+		dbg ("bcdDevice_hi check failed %x <= %x", usb_module_map[i].bcdDevice_hi, bcdDevice);
+		continue;
+	    }
+	    /* found one! */
+	    dbg ("loading %s", usb_module_map[i].module_name);
+	    retval = load_module (usb_module_map[i].module_name);
+	    if (retval)
+		return retval;
+	}
+    }
+
+    return 0;
+}
+
+static int usb_match_device_class (unsigned int class, unsigned int subclass, unsigned int protocol)
+{
+    int i;
+    int retval;
+
+    dbg ("class = %x, subclass = %x, protocol = %x", class, subclass, protocol);
+
+    for (i = 0; usb_module_map[i].module_name != NULL; ++i) {
+	dbg ("looking at %s, match_flags = %x", usb_module_map[i].module_name, usb_module_map[i].match_flags);
+	if (usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_DEV_INFO) {
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) &&
+		    (usb_module_map[i].bDeviceClass != class)) {
+		dbg ("class check failed %x != %x", usb_module_map[i].bDeviceClass, class);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) &&
+		    (usb_module_map[i].bDeviceSubClass != subclass)) {
+		dbg ("subclass check failed %x != %x", usb_module_map[i].bDeviceSubClass, subclass);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) &&
+		    (usb_module_map[i].bDeviceProtocol != protocol)) {
+		dbg ("protocol check failed %x != %x", usb_module_map[i].bDeviceProtocol, protocol);
+		continue;
+	    }
+	    /* found one! */
+	    dbg ("loading %s", usb_module_map[i].module_name);
+	    retval = load_module (usb_module_map[i].module_name);
+	    if (retval)
+		return retval;
+	}
+    }
+
+    return 0;
+}
+
+
+static int usb_match_interface_class (unsigned int class, unsigned int subclass, unsigned int protocol)
+{
+    int i;
+    int retval;
+
+    dbg ("class = %x, subclass = %x, protocol = %x", class, subclass, protocol);
+
+    for (i = 0; usb_module_map[i].module_name != NULL; ++i) {
+	dbg ("looking at %s, match_flags = %x", usb_module_map[i].module_name, usb_module_map[i].match_flags);
+	if (usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_INT_INFO) {
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
+		    (usb_module_map[i].bInterfaceClass != class)) {
+		dbg ("class check failed %x != %x", usb_module_map[i].bInterfaceClass, class);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_INT_SUBCLASS) &&
+		    (usb_module_map[i].bInterfaceSubClass != subclass)) {
+		dbg ("subclass check failed %x != %x", usb_module_map[i].bInterfaceSubClass, subclass);
+		continue;
+	    }
+	    if ((usb_module_map[i].match_flags & USB_DEVICE_ID_MATCH_INT_PROTOCOL) &&
+		    (usb_module_map[i].bInterfaceProtocol != protocol)) {
+		dbg ("protocol check failed %x != %x", usb_module_map[i].bInterfaceProtocol, protocol);
+		continue;
+	    }
+	    /* found one! */
+	    dbg ("loading %s", usb_module_map[i].module_name);
+	    retval = load_module (usb_module_map[i].module_name);
+	    if (retval)
+		return retval;
+	}
+    }
+
+    return 0;
+}
+
+
+static int usb_add (void)
+{
+    char *product_env;
+    char *type_env;
+    char *interface_env;
+    int error;
+    unsigned int idVendor;
+    unsigned int idProduct;
+    unsigned int bcdDevice;
+    unsigned int device_class;
+    unsigned int device_subclass;
+    unsigned int device_protocol;
+    unsigned int interface_class = 0;
+    unsigned int interface_subclass = 0;
+    unsigned int interface_protocol = 0;
+
+    usb_read_usbmap();
+
+    product_env = getenv ("PRODUCT");
+    type_env = getenv ("TYPE");
+    if ((product_env == NULL) ||
+	    (type_env == NULL)) {
+	dbg ("missing an environment variable, aborting.");
+	return 1;
+    }
+    error = split_3values (product_env, 16, &idVendor, &idProduct, &bcdDevice);
+    if (error)
+	return error;
+
+    error = usb_match_vendor_product (idVendor, idProduct, bcdDevice);
+    if (error)
+	return error;
+
+    error = split_3values (type_env, 10, &device_class,
+	    &device_subclass, &device_protocol);
+    if (error)
+	return error;
+    error = usb_match_device_class (device_class, device_subclass, device_protocol);
+    if (error)
+	return error;
+
+    /* we need to look at the interface too */
+    interface_env = getenv ("INTERFACE");
+    if (interface_env == NULL) {
+	dbg ("interface is null, we don't know what to do here.");
+	return 1;
+    }
+    error = split_3values (interface_env, 10, &interface_class,
+	    &interface_subclass, &interface_protocol);
+    if (error)
+	return error;
+    error = usb_match_interface_class (interface_class, interface_subclass, interface_protocol);
+    return error;
+}
+
+
+static int usb_remove (void)
+{
+    /* right now we don't do anything here :) */
+    return 0;
+}
+
+
+static struct subsystem usb_subsystem[] = {
+    { ADD_STRING,	usb_add },
+    { REMOVE_STRING,	usb_remove },
+    { NULL,		NULL }
+};
+
+
+int usb_handler (void)
+{
+    char * action;
+
+    action = getenv ("ACTION");
+    dbg ("action = %s", action);
+    if (action == NULL) {
+	dbg ("missing ACTION environment variable, aborting.");
+	return 1;
+    }
+    return call_subsystem (action, usb_subsystem);
+}
+
+
+/* Utility functions needed by some of the subsystems. */
+
+/*
+ * split_2values
+ *
+ * takes a string of format "xxxx:yyyy" and figures out the
+ * values for xxxx and yyyy
+ */
+int split_2values (const char *string, int base, unsigned int *value1, unsigned int *value2)
+{
+    char buffer[200];
+    char *temp1;
+    const char *temp2;
+
+    dbg("string = %s", string);
+
+    if (string == NULL)
+	return -1;
+    /* dietLibc doesn't have strnlen yet :( */
+    /* if (strnlen (string, sizeof(buffer)) >= sizeof(buffer)) */
+    if (strlen (string) >= sizeof(buffer))
+	return -1;
+
+    /* pick up the first number */
+    temp1 = &buffer[0];
+    temp2 = string;
+    while (1) {
+	if (*temp2 == 0x00)
+	    break;
+	if (*temp2 == ':')
+	    break;
+	*temp1 = *temp2;
+	++temp1;
+	++temp2;
+    }
+    *temp1 = 0x00;
+    *value1 = strtoul (buffer, NULL, base);
+    dbg ("buffer = %s", &buffer[0]);
+    dbg ("value1 = %d", *value1);
+
+    if (*temp2 == 0x00) {
+	/* string is ended, not good */
+	return -1;
+    }
+
+    /* get the second number */
+    temp1 = &buffer[0];
+    ++temp2;
+    while (1) {
+	if (*temp2 == 0x00)
+	    break;
+	*temp1 = *temp2;
+	++temp1;
+	++temp2;
+    }
+    *temp1 = 0x00;
+    *value2 = strtoul (buffer, NULL, base);
+    dbg ("buffer = %s", &buffer[0]);
+    dbg ("value2 = %d", *value2);
+
+    return 0;
+}
+
+
+/*
+ * split_3values
+ *
+ * takes a string of format "xxxx/yyyy/zzzz" and figures out the
+ * values for xxxx, yyyy, and zzzz
+ */
+int split_3values (const char *string, int base, unsigned int * value1,
+	unsigned int * value2, unsigned int * value3)
+{
+    char buffer[200];
+    char *temp1;
+    const char *temp2;
+
+    dbg("string = %s", string);
+
+    if (string == NULL)
+	return -1;
+    /* dietLibc doesn't have strnlen yet :( */
+    /* if (strnlen (string, sizeof(buffer)) >= sizeof(buffer)) */
+    if (strlen (string) >= sizeof(buffer))
+	return -1;
+
+    /* pick up the first number */
+    temp1 = &buffer[0];
+    temp2 = string;
+    while (1) {
+	if (*temp2 == 0x00)
+	    break;
+	if (*temp2 == '/')
+	    break;
+	*temp1 = *temp2;
+	++temp1;
+	++temp2;
+    }
+    *temp1 = 0x00;
+    *value1 = strtoul (buffer, NULL, base);
+    dbg ("buffer = %s", &buffer[0]);
+    dbg ("value1 = %d", *value1);
+
+    if (*temp2 == 0x00) {
+	/* string is ended, not good */
+	return -1;
+    }
+
+    /* get the second number */
+    temp1 = &buffer[0];
+    ++temp2;
+    while (1) {
+	if (*temp2 == 0x00)
+	    break;
+	if (*temp2 == '/')
+	    break;
+	*temp1 = *temp2;
+	++temp1;
+	++temp2;
+    }
+    *temp1 = 0x00;
+    *value2 = strtoul (buffer, NULL, base);
+    dbg ("buffer = %s", &buffer[0]);
+    dbg ("value2 = %d", *value2);
+
+    if (*temp2 == 0x00) {
+	/* string is ended, not good */
+	return -1;
+    }
+
+    /* get the third number */
+    temp1 = &buffer[0];
+    ++temp2;
+    while (1) {
+	if (*temp2 == 0x00)
+	    break;
+	*temp1 = *temp2;
+	++temp1;
+	++temp2;
+    }
+    *temp1 = 0x00;
+    *value3 = strtoul (buffer, NULL, base);
+    dbg ("buffer = %s", &buffer[0]);
+    dbg ("value3 = %d", *value3);
+
+    return 0;
+}
+
+
+int call_subsystem (const char *string, struct subsystem *subsystem)
+{
+    int i;
+
+    for (i = 0; subsystem[i].name != NULL; ++i) {
+	if (strncmp (string, subsystem[i].name, strlen(string)) == 0)
+	    return subsystem[i].handler();
+    }
+    return 1;
+}
+
+
+int load_module (const char *module_name)
+{
+    char *argv[3];
+
+    argv[0] = "/sbin/modprobe";
+    argv[1] = (char *)module_name;
+    argv[2] = NULL;
+    dbg ("loading module %s", module_name);
+    switch (fork()) {
+	case 0:
+	    /* we are the child, so lets run the program */
+	    execv ("/sbin/modprobe", argv);
+	    exit(0);
+	    break;
+	case (-1):
+	    dbg ("fork failed.");
+	    break;
+	default:
+	    break;
+    }
+    return 0;
+}
+
+#ifdef DEBUG
+
+static int logging_init = 0;
+
+static void init_logging (void)
+{
+    openlog ("hotplug", 0, LOG_DAEMON);
+    logging_init = 1;
+}
+
+/**
+ * log_message - sends a message to the logging facility
+ */
+int log_message (int level, const char *format, ...)
+{
+    va_list	args;
+
+    if (!logging_init)
+	init_logging();
+    va_start (args, format);
+    vsyslog (level, format, args);
+    va_end (args);
+    return 1;
+}
+
+#endif
+
diff -urN busybox.orig/hotplug/lex_config.c_shipped busybox/hotplug/lex_config.c_shipped
--- busybox.orig/hotplug/lex_config.c_shipped	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/lex_config.c_shipped	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,2231 @@
+#line 2 "../hotplug/lex_config.c"
+
+#line 4 "../hotplug/lex_config.c"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 31
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_CONST
+
+#endif	/* __STDC__ */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = (yy_hold_char); \
+		YY_RESTORE_YY_MORE_OFFSET \
+		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef unsigned int yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1;		/* whether we need to initialize */
+static int yy_start = 0;	/* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file  );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
+void yy_delete_buffer (YY_BUFFER_STATE b  );
+void yy_flush_buffer (YY_BUFFER_STATE b  );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
+
+void *yyalloc (yy_size_t  );
+void *yyrealloc (void *,yy_size_t  );
+void yyfree (void *  );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer(yyin,YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer(yyin,YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[]  );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	(yytext_ptr) = yy_bp; \
+	yyleng = (size_t) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	(yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 44
+#define YY_END_OF_BUFFER 45
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_accept[246] =
+    {   0,
+        4,    4,    0,    0,   45,   43,    4,    3,    4,   43,
+        5,   40,   40,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43,    2,
+       44,    4,    4,    5,    0,   42,    0,    5,   40,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   29,    0,    0,
+        0,    2,    0,   42,    0,   41,    0,    0,    0,    0,
+        8,    0,    0,    0,    0,    0,    0,    0,    0,   17,
+        0,    0,    0,    0,   22,    0,    0,    0,    0,   25,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    7,    9,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   24,    0,   26,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+       10,    0,    0,   13,    0,    0,    0,    0,   18,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+       30,    0,    0,    0,    0,    0,   12,    0,    0,    0,
+        0,   19,   20,   21,    0,    0,    0,   27,    0,    0,
+        0,    0,    0,    0,    0,    0,   11,   14,    0,    0,
+       16,    0,    0,    0,    0,   28,    0,    0,    1,   31,
+
+        0,    0,    0,    0,   15,    0,    0,    0,    0,    0,
+        0,    0,   38,    6,    0,    0,   23,    0,    0,    0,
+        0,    0,   35,    0,    0,    0,    0,    0,    0,   32,
+        0,    0,    0,   33,    0,    0,    0,   39,    0,    0,
+       34,   36,    0,   37,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    4,    1,    5,    6,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    7,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    1,    6,    1,
+        1,    1,    1,    1,    9,    9,    9,    9,    9,    9,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,   10,    1,    1,   11,    1,   12,   13,   14,   15,
+
+       16,   17,   18,    1,   19,   20,   21,   22,   23,   24,
+       25,   26,   27,   28,   29,   30,   31,   32,   33,   34,
+       35,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[36] =
+    {   0,
+        1,    1,    2,    1,    1,    1,    3,    3,    3,    1,
+        1,    3,    3,    3,    3,    3,    3,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int16_t yy_base[252] =
+    {   0,
+        0,    0,  282,  281,  283,  286,   34,  286,   35,   35,
+        0,   35,   39,   25,  263,   36,   34,  247,   32,   28,
+      264,   41,  263,  252,   47,  261,   51,   29,   54,    0,
+      286,   73,   76,    0,   69,  286,   78,    0,   77,    0,
+      253,  250,  250,  245,  243,  259,   69,  235,  255,  234,
+      243,  252,  238,  249,  239,  239,  246,  245,   73,  229,
+      230,  238,  228,   69,  226,  226,  222,  286,  226,  223,
+      235,    0,   85,   86,   89,    0,  220,  224,  232,  231,
+      286,  216,  232,  224,  216,  219,  224,  225,  216,  286,
+      221,  219,  210,  203,  286,  218,  199,  202,  218,  286,
+
+      199,  209,  211,  207,  206,  196,  201,  193,  205,  209,
+      184,  286,  286,  189,  186,  202,  199,  183,  198,  182,
+      180,  196,  190,  180,  185,  177,  180,  286,  182,  286,
+      178,  174,  190,  188,  185,  182,  178,  171,  181,  171,
+      286,  171,  176,  286,  176,  179,  170,  173,  286,  172,
+      151,  169,  173,  155,  160,  157,  148,  167,  156,  161,
+      286,  151,  164,  162,  148,  142,  286,  155,  155,  144,
+      152,  286,  156,  286,  143,  144,  148,  286,  147,  147,
+      150,   98,  136,  147,  130,  126,  286,  286,  137,  131,
+      286,  140,  123,  141,  129,  286,  138,  123,  102,  286,
+
+      133,  132,  117,  116,  286,  132,  128,  130,  130,  114,
+      114,  126,  286,  286,  116,  108,  286,  120,  108,  103,
+      104,  105,  286,  115,  117,  103,  111,   96,   95,  286,
+       98,   95,   94,  286,  101,   84,   75,  286,   69,   77,
+      286,  286,   40,  286,  286,  106,  109,  112,  115,  118,
+       59
+    } ;
+
+static yyconst flex_int16_t yy_def[252] =
+    {   0,
+      245,    1,  246,  246,  245,  245,  245,  245,  245,  247,
+      248,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  249,
+      245,  245,  245,  248,  247,  245,  250,  248,  245,  251,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  249,  247,  247,  250,  251,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,    0,  245,  245,  245,  245,  245,
+      245
+    } ;
+
+static yyconst flex_int16_t yy_nxt[322] =
+    {   0,
+        6,    7,    8,    9,   10,   11,   12,   13,    6,    6,
+        6,   14,   15,   16,   17,   18,   19,    6,   20,   21,
+        6,    6,   22,   23,   24,   25,    6,   26,   27,   28,
+        6,   29,    6,    6,    6,   32,   32,   32,   33,   36,
+       34,   39,   39,   41,   37,   39,   39,   44,   42,   47,
+       50,   52,   55,   68,   45,   53,   56,   46,   61,   69,
+       62,   76,   51,   48,   65,   57,   66,  244,   40,   70,
+       58,   63,   71,   36,   32,   67,   32,   32,   37,   33,
+       35,   34,   74,   39,   39,   83,  102,   75,   96,   36,
+       36,   35,  243,   74,   37,   37,  242,  103,   75,  199,
+
+       84,  199,   97,  199,  241,  199,   30,   30,   30,   35,
+       35,   35,   38,  240,   38,   72,  239,   72,   73,   73,
+       73,  238,  237,  236,  235,  234,  233,  232,  231,  230,
+      229,  228,  227,  226,  225,  224,  223,  222,  221,  220,
+      219,  218,  217,  216,  215,  214,  213,  212,  211,  210,
+      209,  208,  207,  206,  205,  204,  203,  202,  201,  200,
+      198,  197,  196,  195,  194,  193,  192,  191,  190,  189,
+      188,  187,  186,  185,  184,  183,  182,  181,  180,  179,
+      178,  177,  176,  175,  174,  173,  172,  171,  170,  169,
+      168,  167,  166,  165,  164,  163,  162,  161,  160,  159,
+
+      158,  157,  156,  155,  154,  153,  152,  151,  150,  149,
+      148,  147,  146,  145,  144,  143,  142,  141,  140,  139,
+      138,  137,  136,  135,  134,  133,  132,  131,  130,  129,
+      128,  127,  126,  125,  124,  123,  122,  121,  120,  119,
+      118,  117,  116,  115,  114,  113,  112,  111,  110,  109,
+      108,  107,  106,  105,  104,  101,  100,   99,   98,   95,
+       94,   93,   92,   91,   90,   89,   88,   87,   86,   85,
+       82,   81,   80,   79,   78,   77,   64,   60,   59,   54,
+       49,   43,  245,   31,   31,    5,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245
+    } ;
+
+static yyconst flex_int16_t yy_chk[322] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    7,    9,    7,    9,   10,
+        9,   12,   12,   14,   10,   13,   13,   16,   14,   17,
+       19,   20,   22,   28,   16,   20,   22,   16,   25,   28,
+       25,  251,   19,   17,   27,   22,   27,  243,   12,   29,
+       22,   25,   29,   35,   32,   27,   32,   33,   35,   33,
+       37,   33,   37,   39,   39,   47,   64,   37,   59,   73,
+       74,   75,  240,   75,   73,   74,  239,   64,   75,  182,
+
+       47,  182,   59,  199,  237,  199,  246,  246,  246,  247,
+      247,  247,  248,  236,  248,  249,  235,  249,  250,  250,
+      250,  233,  232,  231,  229,  228,  227,  226,  225,  224,
+      222,  221,  220,  219,  218,  216,  215,  212,  211,  210,
+      209,  208,  207,  206,  204,  203,  202,  201,  198,  197,
+      195,  194,  193,  192,  190,  189,  186,  185,  184,  183,
+      181,  180,  179,  177,  176,  175,  173,  171,  170,  169,
+      168,  166,  165,  164,  163,  162,  160,  159,  158,  157,
+      156,  155,  154,  153,  152,  151,  150,  148,  147,  146,
+      145,  143,  142,  140,  139,  138,  137,  136,  135,  134,
+
+      133,  132,  131,  129,  127,  126,  125,  124,  123,  122,
+      121,  120,  119,  118,  117,  116,  115,  114,  111,  110,
+      109,  108,  107,  106,  105,  104,  103,  102,  101,   99,
+       98,   97,   96,   94,   93,   92,   91,   89,   88,   87,
+       86,   85,   84,   83,   82,   80,   79,   78,   77,   71,
+       70,   69,   67,   66,   65,   63,   62,   61,   60,   58,
+       57,   56,   55,   54,   53,   52,   51,   50,   49,   48,
+       46,   45,   44,   43,   42,   41,   26,   24,   23,   21,
+       18,   15,    5,    4,    3,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+      245
+    } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "../hotplug/lex_config.l"
+/* Special state for handling include files */
+
+#line 5 "../hotplug/lex_config.l"
+/*
+ * lex_config.l 1.50 2003/11/27 22:01:29
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License. 
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#undef src
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <syslog.h>
+
+#ifdef HAS_WORDEXP
+#include <wordexp.h>
+#else
+#include <glob.h>
+#endif
+
+#define src 1
+
+#include "pcmcia.h"
+#include "yacc_config.h"
+
+/* For assembling nice error messages */
+char *current_file;
+int current_lineno;
+
+static int lex_number(char *s);
+static int lex_string(char *s);
+static void do_source(char *fn);
+static int do_eof(void);
+
+#line 655 "../hotplug/lex_config.c"
+
+#define INITIAL 0
+#define src 1
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+    static void yyunput (int c,char *buf_ptr  );
+    
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+		{ \
+		int c = '*'; \
+		size_t n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else \
+		{ \
+		errno=0; \
+		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+			{ \
+			if( errno != EINTR) \
+				{ \
+				YY_FATAL_ERROR( "input in flex scanner failed" ); \
+				break; \
+				} \
+			errno=0; \
+			clearerr(yyin); \
+			} \
+		}\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    
+#line 68 "../hotplug/lex_config.l"
+
+
+#line 810 "../hotplug/lex_config.c"
+
+	if ( (yy_init) )
+		{
+		(yy_init) = 0;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			yyensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				yy_create_buffer(yyin,YY_BUF_SIZE );
+		}
+
+		yy_load_buffer_state( );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
+
+		/* Support of yytext. */
+		*yy_cp = (yy_hold_char);
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = (yy_start);
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				(yy_last_accepting_state) = yy_current_state;
+				(yy_last_accepting_cpos) = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 246 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 286 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = (yy_hold_char);
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 70 "../hotplug/lex_config.l"
+BEGIN(src); return SOURCE;
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 71 "../hotplug/lex_config.l"
+do_source(yytext); BEGIN(INITIAL);
+	YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(src):
+#line 72 "../hotplug/lex_config.l"
+if (do_eof()) yyterminate();
+	YY_BREAK
+case 3:
+/* rule 3 can match eol */
+YY_RULE_SETUP
+#line 74 "../hotplug/lex_config.l"
+current_lineno++;
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 75 "../hotplug/lex_config.l"
+/* skip */ ;
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 76 "../hotplug/lex_config.l"
+/* skip */ ;
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 78 "../hotplug/lex_config.l"
+return ANONYMOUS;
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 79 "../hotplug/lex_config.l"
+return BIND;
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 80 "../hotplug/lex_config.l"
+return CIS;
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 81 "../hotplug/lex_config.l"
+return CARD;
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 82 "../hotplug/lex_config.l"
+return CLASS;
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 83 "../hotplug/lex_config.l"
+return DEFAULT;
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 84 "../hotplug/lex_config.l"
+return DEVICE;
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 85 "../hotplug/lex_config.l"
+return DTYPE;
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 86 "../hotplug/lex_config.l"
+return EXCLUDE;
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 87 "../hotplug/lex_config.l"
+return FUNCTION;
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 88 "../hotplug/lex_config.l"
+return INCLUDE;
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 89 "../hotplug/lex_config.l"
+return IRQ_NO;
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 90 "../hotplug/lex_config.l"
+return JEDEC;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 91 "../hotplug/lex_config.l"
+return MANFID;
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 92 "../hotplug/lex_config.l"
+return MEMORY;
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 93 "../hotplug/lex_config.l"
+return MODULE;
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 94 "../hotplug/lex_config.l"
+return MTD;
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 95 "../hotplug/lex_config.l"
+return NEEDS_MTD;
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 96 "../hotplug/lex_config.l"
+return OPTS;
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 97 "../hotplug/lex_config.l"
+return PCI;
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 98 "../hotplug/lex_config.l"
+return PORT;
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 99 "../hotplug/lex_config.l"
+return REGION;
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 100 "../hotplug/lex_config.l"
+return RESERVE;
+	YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 101 "../hotplug/lex_config.l"
+return TO;
+	YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 102 "../hotplug/lex_config.l"
+return TUPLE;
+	YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 103 "../hotplug/lex_config.l"
+return VERSION;
+	YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 105 "../hotplug/lex_config.l"
+return lex_number("1");
+	YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 106 "../hotplug/lex_config.l"
+return lex_number("2");
+	YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 107 "../hotplug/lex_config.l"
+return lex_number("3");
+	YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 108 "../hotplug/lex_config.l"
+return lex_number("4");
+	YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 109 "../hotplug/lex_config.l"
+return lex_number("5");
+	YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 110 "../hotplug/lex_config.l"
+return lex_number("6");
+	YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 111 "../hotplug/lex_config.l"
+return lex_number("7");
+	YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 112 "../hotplug/lex_config.l"
+return lex_number("8");
+	YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 114 "../hotplug/lex_config.l"
+return lex_number(yytext);
+	YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 116 "../hotplug/lex_config.l"
+return lex_number(yytext);
+	YY_BREAK
+case 42:
+/* rule 42 can match eol */
+YY_RULE_SETUP
+#line 118 "../hotplug/lex_config.l"
+return lex_string(yytext);
+	YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 120 "../hotplug/lex_config.l"
+return yytext[0];
+	YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 122 "../hotplug/lex_config.l"
+ECHO;
+	YY_BREAK
+#line 1120 "../hotplug/lex_config.c"
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = (yy_hold_char);
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state(  );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++(yy_c_buf_p);
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = (yy_c_buf_p);
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer(  ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				(yy_did_buffer_switch_on_eof) = 0;
+
+				if ( yywrap( ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				(yy_c_buf_p) =
+					(yytext_ptr) + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				(yy_c_buf_p) =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = (yytext_ptr);
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+	else
+		{
+			size_t num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+						number_to_move - 1;
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			(yy_n_chars), num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	if ( (yy_n_chars) == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart(yyin  );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	(yy_n_chars) += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    static yy_state_type yy_get_previous_state (void)
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			(yy_last_accepting_state) = yy_current_state;
+			(yy_last_accepting_cpos) = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 246 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+{
+	register int yy_is_jam;
+    	register char *yy_cp = (yy_c_buf_p);
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		(yy_last_accepting_state) = yy_current_state;
+		(yy_last_accepting_cpos) = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 246 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 245);
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+    static void yyunput (int c, register char * yy_bp )
+{
+	register char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+	/* undo effects of setting up yytext */
+	*yy_cp = (yy_hold_char);
+
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = (yy_n_chars) + 2;
+		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		register char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+	(yytext_ptr) = yy_bp;
+	(yy_hold_char) = *yy_cp;
+	(yy_c_buf_p) = yy_cp;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+    static int yyinput (void)
+#else
+    static int input  (void)
+#endif
+
+{
+	int c;
+    
+	*(yy_c_buf_p) = (yy_hold_char);
+
+	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			/* This was really a NUL. */
+			*(yy_c_buf_p) = '\0';
+
+		else
+			{ /* need more input */
+			int offset = (yy_c_buf_p) - (yytext_ptr);
+			++(yy_c_buf_p);
+
+			switch ( yy_get_next_buffer(  ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart(yyin );
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap( ) )
+						return EOF;
+
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					(yy_c_buf_p) = (yytext_ptr) + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
+	*(yy_c_buf_p) = '\0';	/* preserve yytext */
+	(yy_hold_char) = *++(yy_c_buf_p);
+
+	return c;
+}
+#endif	/* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void yyrestart  (FILE * input_file )
+{
+    
+	if ( ! YY_CURRENT_BUFFER ){
+        yyensure_buffer_stack ();
+		YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer(yyin,YY_BUF_SIZE );
+	}
+
+	yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+	yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+{
+    
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
+     */
+	yyensure_buffer_stack ();
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	yy_load_buffer_state( );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state  (void)
+{
+    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	(yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer(b,file );
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * 
+ */
+    void yy_delete_buffer (YY_BUFFER_STATE  b )
+{
+    
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yyfree((void *) b->yy_ch_buf  );
+
+	yyfree((void *) b  );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+    
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
+
+{
+	int oerrno = errno;
+    
+	yy_flush_buffer(b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+    
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void yy_flush_buffer (YY_BUFFER_STATE  b )
+{
+    	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+    	if (new_buffer == NULL)
+		return;
+
+	yyensure_buffer_stack();
+
+	/* This block is copied from yy_switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		(yy_buffer_stack_top)++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from yy_switch_to_buffer. */
+	yy_load_buffer_state( );
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void yypop_buffer_state (void)
+{
+    	if (!YY_CURRENT_BUFFER)
+		return;
+
+	yy_delete_buffer(YY_CURRENT_BUFFER );
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if ((yy_buffer_stack_top) > 0)
+		--(yy_buffer_stack_top);
+
+	if (YY_CURRENT_BUFFER) {
+		yy_load_buffer_state( );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+	int num_to_alloc;
+    
+	if (!(yy_buffer_stack)) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		
+		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		(yy_buffer_stack_max) = num_to_alloc;
+		(yy_buffer_stack_top) = 0;
+		return;
+	}
+
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = (yy_buffer_stack_max) + grow_size;
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+								((yy_buffer_stack),
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+
+		/* zero only the new slots.*/
+		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+		(yy_buffer_stack_max) = num_to_alloc;
+	}
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * 
+ * @return the newly allocated buffer state object. 
+ */
+YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
+{
+	YY_BUFFER_STATE b;
+    
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	yy_switch_to_buffer(b  );
+
+	return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param str a NUL-terminated string to scan
+ * 
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ *       yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str )
+{
+    
+	return yy_scan_bytes(yy_str,strlen(yy_str) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * 
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes  (yyconst char * bytes, int  len )
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = len + 2;
+	buf = (char *) yyalloc(n  );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+	for ( i = 0; i < len; ++i )
+		buf[i] = bytes[i];
+
+	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = yy_scan_buffer(buf,n );
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+    	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = (yy_hold_char); \
+		(yy_c_buf_p) = yytext + yyless_macro_arg; \
+		(yy_hold_char) = *(yy_c_buf_p); \
+		*(yy_c_buf_p) = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ * 
+ */
+int yyget_lineno  (void)
+{
+        
+    return yylineno;
+}
+
+/** Get the input stream.
+ * 
+ */
+FILE *yyget_in  (void)
+{
+        return yyin;
+}
+
+/** Get the output stream.
+ * 
+ */
+FILE *yyget_out  (void)
+{
+        return yyout;
+}
+
+/** Get the length of the current token.
+ * 
+ */
+int yyget_leng  (void)
+{
+        return yyleng;
+}
+
+/** Get the current token.
+ * 
+ */
+
+char *yyget_text  (void)
+{
+        return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ * 
+ */
+void yyset_lineno (int  line_number )
+{
+    
+    yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * 
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE *  in_str )
+{
+        yyin = in_str ;
+}
+
+void yyset_out (FILE *  out_str )
+{
+        yyout = out_str ;
+}
+
+int yyget_debug  (void)
+{
+        return yy_flex_debug;
+}
+
+void yyset_debug (int  bdebug )
+{
+        yy_flex_debug = bdebug ;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy  (void)
+{
+    
+    /* Pop the buffer stack, destroying each element. */
+	while(YY_CURRENT_BUFFER){
+		yy_delete_buffer(YY_CURRENT_BUFFER  );
+		YY_CURRENT_BUFFER_LVALUE = NULL;
+		yypop_buffer_state();
+	}
+
+	/* Destroy the stack itself. */
+	yyfree((yy_buffer_stack) );
+	(yy_buffer_stack) = NULL;
+
+    return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+	register int i;
+    	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+	register int n;
+    	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+	return (void *) malloc( size );
+}
+
+void *yyrealloc  (void * ptr, yy_size_t  size )
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef yytext_ptr
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+#line 122 "../hotplug/lex_config.l"
+
+
+
+#ifndef yywrap
+int yywrap() { return 1; }
+#endif
+
+/*======================================================================
+
+    Stuff to parse basic data types
+
+======================================================================*/
+
+static int lex_number(char *s)
+{
+    yylval.num = strtoul(s, NULL, 0);
+    return NUMBER;
+}
+
+static int lex_string(char *s)
+{
+    int n = strlen(s);
+    yylval.str = malloc(n-1);
+    strncpy(yylval.str, s+1, n-2);
+    yylval.str[n-2] = '\0';
+    return STRING;
+}
+
+/*======================================================================
+
+    Code to support nesting of configuration files
+
+======================================================================*/
+
+#define MAX_SOURCE_DEPTH 4
+struct source_stack {
+    YY_BUFFER_STATE	buffer;
+    char		*filename;
+    int			lineno, fileno;
+    FILE		*file;
+#ifdef HAS_WORDEXP
+    wordexp_t		word;
+#else
+    glob_t		glob;
+#endif
+} source_stack[MAX_SOURCE_DEPTH];
+static int source_stack_ptr = 0;
+static int parse_env = 0;
+
+static int get_glob(void)
+{
+    struct source_stack *s = &source_stack[source_stack_ptr];
+#ifdef HAS_WORDEXP
+    while (s->fileno < s->word.we_wordc) {
+	char *fn = s->word.we_wordv[s->fileno];
+#else
+    while (s->fileno < s->glob.gl_pathc) {
+	char *fn = s->glob.gl_pathv[s->fileno];
+#endif
+	s->file = fopen(fn, "r");
+	if (s->file == NULL) {
+	    if (strpbrk(fn, "?*[") == NULL)
+		syslog(LOG_ERR, "could not open '%s': %m", fn);
+	    s->fileno++;
+	} else {
+	    current_lineno = 1;
+	    current_file = strdup(fn);
+	    yy_switch_to_buffer(yy_create_buffer(s->file,YY_BUF_SIZE));
+	    source_stack_ptr++;
+	    s->fileno++;
+	    return 0;
+	}
+    }
+    return -1;
+}
+
+static void do_source(char *fn)
+{
+    struct source_stack *s = &source_stack[source_stack_ptr];
+
+    if (source_stack_ptr >= MAX_SOURCE_DEPTH) {
+	syslog(LOG_ERR, "source depth limit exceeded");
+	return;
+    }
+#ifdef HAS_WORDEXP
+    wordexp(fn, &s->word, 0);
+#else
+    glob(fn, GLOB_NOCHECK, NULL, &s->glob);
+#endif
+    s->fileno = 0;
+    s->buffer = YY_CURRENT_BUFFER;
+    s->lineno = current_lineno;
+    s->filename = current_file;
+    get_glob();
+}
+
+static int do_eof(void)
+{
+    struct source_stack *s = &source_stack[--source_stack_ptr];
+    if (source_stack_ptr < 0) {
+	if (parse_env == 0) {
+	    char *t = getenv("PCMCIA_OPTS");
+	    if (t == NULL) return -1;
+	    parse_env = 1;
+	    source_stack_ptr = 0;
+	    current_file = "PCMCIA_OPTS";
+	    current_lineno = 1;
+	    yy_scan_string(t);
+	    return 0;
+	} else
+	    return -1;
+    }
+    fclose(s->file);
+    free(current_file);
+    yy_delete_buffer(YY_CURRENT_BUFFER);
+    if (get_glob() != 0) {
+	yy_switch_to_buffer(s->buffer);
+	current_lineno = s->lineno;
+	current_file = s->filename;
+    }
+    return 0;
+}
+
+/*======================================================================
+
+    The main entry point... returns -1 if the file can't be accessed.
+
+======================================================================*/
+
+int parse_configfile(char *fn)
+{
+    FILE *f;
+    
+    f = fopen(fn, "r");
+    if (!f) {
+	syslog(LOG_ERR, "could not open '%s': %m", fn);
+	return -1;
+    }
+    current_lineno = 1;
+    current_file = fn;
+    source_stack_ptr = 0;
+    yyrestart(f);
+    yyparse();
+    fclose(f);
+    return 0;
+}
+
+
diff -urN busybox.orig/hotplug/lex_config.l busybox/hotplug/lex_config.l
--- busybox.orig/hotplug/lex_config.l	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/lex_config.l	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,267 @@
+/* Special state for handling include files */
+%x src
+
+%{
+/*
+ * lex_config.l 1.50 2003/11/27 22:01:29
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License. 
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#undef src
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <syslog.h>
+
+#ifdef HAS_WORDEXP
+#include <wordexp.h>
+#else
+#include <glob.h>
+#endif
+
+#define src 1
+
+#include "pcmcia.h"
+#include "yacc_config.h"
+
+/* For assembling nice error messages */
+char *current_file;
+int current_lineno;
+
+static int lex_number(char *s);
+static int lex_string(char *s);
+static void do_source(char *fn);
+static int do_eof(void);
+
+%}
+
+int	[0-9]+
+hex	0x[0-9a-fA-F]+
+str	\"([^"]|\\.)*\"
+
+%%
+
+source[ \t]+	BEGIN(src); return SOURCE;
+<src>[^\n]+	do_source(yytext); BEGIN(INITIAL);
+<<EOF>>		if (do_eof()) yyterminate();
+
+\n		current_lineno++;
+[ \t]*		/* skip */ ;
+[ ]*[#;].*	/* skip */ ;
+
+anonymous	return ANONYMOUS;
+bind		return BIND;
+cis		return CIS;
+card		return CARD;
+class		return CLASS;
+default		return DEFAULT;
+device		return DEVICE;
+dtype		return DTYPE;
+exclude		return EXCLUDE;
+function	return FUNCTION;
+include		return INCLUDE;
+irq		return IRQ_NO;
+jedec		return JEDEC;
+manfid		return MANFID;
+memory		return MEMORY;
+module		return MODULE;
+mtd		return MTD;
+needs_mtd	return NEEDS_MTD;
+opts		return OPTS;
+pci		return PCI;
+port		return PORT;
+region		return REGION;
+reserve		return RESERVE;
+to		return TO;
+tuple		return TUPLE;
+version		return VERSION;
+
+memory_card	return lex_number("1");
+serial_port	return lex_number("2");
+parallel_port	return lex_number("3");
+fixed_disk	return lex_number("4");
+video_adapter	return lex_number("5");
+network_adapter	return lex_number("6");
+aims_card	return lex_number("7");
+scsi_adapter	return lex_number("8");
+
+{int}		return lex_number(yytext);
+
+{hex}		return lex_number(yytext);
+
+{str}		return lex_string(yytext);
+
+.		return yytext[0];
+
+%%
+
+#ifndef yywrap
+int yywrap() { return 1; }
+#endif
+
+/*======================================================================
+
+    Stuff to parse basic data types
+
+======================================================================*/
+
+static int lex_number(char *s)
+{
+    yylval.num = strtoul(s, NULL, 0);
+    return NUMBER;
+}
+
+static int lex_string(char *s)
+{
+    int n = strlen(s);
+    yylval.str = malloc(n-1);
+    strncpy(yylval.str, s+1, n-2);
+    yylval.str[n-2] = '\0';
+    return STRING;
+}
+
+/*======================================================================
+
+    Code to support nesting of configuration files
+
+======================================================================*/
+
+#define MAX_SOURCE_DEPTH 4
+struct source_stack {
+    YY_BUFFER_STATE	buffer;
+    char		*filename;
+    int			lineno, fileno;
+    FILE		*file;
+#ifdef HAS_WORDEXP
+    wordexp_t		word;
+#else
+    glob_t		glob;
+#endif
+} source_stack[MAX_SOURCE_DEPTH];
+static int source_stack_ptr = 0;
+static int parse_env = 0;
+
+static int get_glob(void)
+{
+    struct source_stack *s = &source_stack[source_stack_ptr];
+#ifdef HAS_WORDEXP
+    while (s->fileno < s->word.we_wordc) {
+	char *fn = s->word.we_wordv[s->fileno];
+#else
+    while (s->fileno < s->glob.gl_pathc) {
+	char *fn = s->glob.gl_pathv[s->fileno];
+#endif
+	s->file = fopen(fn, "r");
+	if (s->file == NULL) {
+	    if (strpbrk(fn, "?*[") == NULL)
+		syslog(LOG_ERR, "could not open '%s': %m", fn);
+	    s->fileno++;
+	} else {
+	    current_lineno = 1;
+	    current_file = strdup(fn);
+	    yy_switch_to_buffer(yy_create_buffer(s->file, YY_BUF_SIZE));
+	    source_stack_ptr++;
+	    s->fileno++;
+	    return 0;
+	}
+    }
+    return -1;
+}
+
+static void do_source(char *fn)
+{
+    struct source_stack *s = &source_stack[source_stack_ptr];
+
+    if (source_stack_ptr >= MAX_SOURCE_DEPTH) {
+	syslog(LOG_ERR, "source depth limit exceeded");
+	return;
+    }
+#ifdef HAS_WORDEXP
+    wordexp(fn, &s->word, 0);
+#else
+    glob(fn, GLOB_NOCHECK, NULL, &s->glob);
+#endif
+    s->fileno = 0;
+    s->buffer = YY_CURRENT_BUFFER;
+    s->lineno = current_lineno;
+    s->filename = current_file;
+    get_glob();
+}
+
+static int do_eof(void)
+{
+    struct source_stack *s = &source_stack[--source_stack_ptr];
+    if (source_stack_ptr < 0) {
+	if (parse_env == 0) {
+	    char *t = getenv("PCMCIA_OPTS");
+	    if (t == NULL) return -1;
+	    parse_env = 1;
+	    source_stack_ptr = 0;
+	    current_file = "PCMCIA_OPTS";
+	    current_lineno = 1;
+	    yy_scan_string(t);
+	    return 0;
+	} else
+	    return -1;
+    }
+    fclose(s->file);
+    free(current_file);
+    yy_delete_buffer(YY_CURRENT_BUFFER);
+    if (get_glob() != 0) {
+	yy_switch_to_buffer(s->buffer);
+	current_lineno = s->lineno;
+	current_file = s->filename;
+    }
+    return 0;
+}
+
+/*======================================================================
+
+    The main entry point... returns -1 if the file can't be accessed.
+
+======================================================================*/
+
+int parse_configfile(char *fn)
+{
+    FILE *f;
+    
+    f = fopen(fn, "r");
+    if (!f) {
+	syslog(LOG_ERR, "could not open '%s': %m", fn);
+	return -1;
+    }
+    current_lineno = 1;
+    current_file = fn;
+    source_stack_ptr = 0;
+    yyrestart(f);
+    yyparse();
+    fclose(f);
+    return 0;
+}
+
diff -urN busybox.orig/hotplug/pcmcia.h busybox/hotplug/pcmcia.h
--- busybox.orig/hotplug/pcmcia.h	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/pcmcia.h	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,1446 @@
+/* version.h 1.94 2000/10/03 17:55:48 (David Hinds) */
+
+#define CS_RELEASE "3.1.22"
+#define CS_RELEASE_CODE 0x3116
+/*
+ * cs_types.h 1.18 2000/06/12 21:55:40
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CS_TYPES_H
+#define _LINUX_CS_TYPES_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <sys/types.h>
+#endif
+
+#if defined(__arm__) || defined(__mips__)
+typedef u_int   ioaddr_t;
+#else
+typedef u_short	ioaddr_t;
+#endif
+
+typedef u_short	socket_t;
+typedef u_int	event_t;
+typedef u_char	cisdata_t;
+typedef u_short	page_t;
+
+struct client_t;
+typedef struct client_t *client_handle_t;
+
+struct window_t;
+typedef struct window_t *window_handle_t;
+
+struct region_t;
+typedef struct region_t *memory_handle_t;
+
+struct eraseq_t;
+typedef struct eraseq_t *eraseq_handle_t;
+
+#ifndef DEV_NAME_LEN
+#define DEV_NAME_LEN 32
+#endif
+
+typedef char dev_info_t[DEV_NAME_LEN];
+
+#endif /* _LINUX_CS_TYPES_H */
+/*
+ * cs.h 1.74 2001/10/04 03:15:22
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CS_H
+#define _LINUX_CS_H
+
+/* For AccessConfigurationRegister */
+typedef struct conf_reg_t {
+    u_char	Function;
+    u_int	Action;
+    off_t	Offset;
+    u_int	Value;
+} conf_reg_t;
+
+/* Actions */
+#define CS_READ		1
+#define CS_WRITE	2
+
+/* for AdjustResourceInfo */
+typedef struct adjust_t {
+    u_int	Action;
+    u_int	Resource;
+    u_int	Attributes;
+    union {
+	struct memory {
+	    u_long	Base;
+	    u_long	Size;
+	} memory;
+	struct io {
+	    ioaddr_t	BasePort;
+	    ioaddr_t	NumPorts;
+	    u_int	IOAddrLines;
+	} io;
+	struct irq {
+	    u_int	IRQ;
+	} irq;
+    } resource;
+} adjust_t;
+
+/* Action field */
+#define REMOVE_MANAGED_RESOURCE		1
+#define ADD_MANAGED_RESOURCE		2
+#define GET_FIRST_MANAGED_RESOURCE	3
+#define GET_NEXT_MANAGED_RESOURCE	4
+/* Resource field */
+#define RES_MEMORY_RANGE		1
+#define RES_IO_RANGE			2
+#define RES_IRQ				3
+/* Attribute field */
+#define RES_IRQ_TYPE			0x03
+#define RES_IRQ_TYPE_EXCLUSIVE		0
+#define RES_IRQ_TYPE_TIME		1
+#define RES_IRQ_TYPE_DYNAMIC		2
+#define RES_IRQ_CSC			0x04
+#define RES_SHARED			0x08
+#define RES_RESERVED			0x10
+#define RES_ALLOCATED			0x20
+#define RES_REMOVED			0x40
+
+typedef struct servinfo_t {
+    char	Signature[2];
+    u_int	Count;
+    u_int	Revision;
+    u_int	CSLevel;
+    char	*VendorString;
+} servinfo_t;
+
+typedef struct event_callback_args_t {
+    client_handle_t client_handle;
+    void	*info;
+    void	*mtdrequest;
+    void	*buffer;
+    void	*misc;
+    void	*client_data;
+    struct bus_operations *bus;
+} event_callback_args_t;
+
+/* for GetConfigurationInfo */
+typedef struct config_info_t {
+    u_char	Function;
+    u_int	Attributes;
+    u_int	Vcc, Vpp1, Vpp2;
+    u_int	IntType;
+    u_int	ConfigBase;
+    u_char	Status, Pin, Copy, Option, ExtStatus;
+    u_int	Present;
+    u_int	CardValues;
+    u_int	AssignedIRQ;
+    u_int	IRQAttributes;
+    ioaddr_t	BasePort1;
+    ioaddr_t	NumPorts1;
+    u_int	Attributes1;
+    ioaddr_t	BasePort2;
+    ioaddr_t	NumPorts2;
+    u_int	Attributes2;
+    u_int	IOAddrLines;
+} config_info_t;
+
+/* For CardValues field */
+#define CV_OPTION_VALUE		0x01
+#define CV_STATUS_VALUE		0x02
+#define CV_PIN_REPLACEMENT	0x04
+#define CV_COPY_VALUE		0x08
+#define CV_EXT_STATUS		0x10
+
+/* For GetFirst/NextClient */
+typedef struct client_req_t {
+    socket_t	Socket;
+    u_int	Attributes;
+} client_req_t;
+
+#define CLIENT_THIS_SOCKET	0x01
+
+/* For RegisterClient */
+typedef struct client_reg_t {
+    dev_info_t	*dev_info;
+    u_int	Attributes;
+    u_int	EventMask;
+    int		(*event_handler)(event_t event, int priority,
+				 event_callback_args_t *);
+    event_callback_args_t event_callback_args;
+    u_int	Version;
+} client_reg_t;
+
+/* ModifyConfiguration */
+typedef struct modconf_t {
+    u_int	Attributes;
+    u_int	Vcc, Vpp1, Vpp2;
+} modconf_t;
+
+/* Attributes for ModifyConfiguration */
+#define CONF_IRQ_CHANGE_VALID	0x100
+#define CONF_VCC_CHANGE_VALID	0x200
+#define CONF_VPP1_CHANGE_VALID	0x400
+#define CONF_VPP2_CHANGE_VALID	0x800
+
+/* For RequestConfiguration */
+typedef struct config_req_t {
+    u_int	Attributes;
+    u_int	Vcc, Vpp1, Vpp2;
+    u_int	IntType;
+    u_int	ConfigBase;
+    u_char	Status, Pin, Copy, ExtStatus;
+    u_char	ConfigIndex;
+    u_int	Present;
+} config_req_t;
+
+/* Attributes for RequestConfiguration */
+#define CONF_ENABLE_IRQ		0x01
+#define CONF_ENABLE_DMA		0x02
+#define CONF_ENABLE_SPKR	0x04
+#define CONF_VALID_CLIENT	0x100
+
+/* IntType field */
+#define INT_MEMORY		0x01
+#define INT_MEMORY_AND_IO	0x02
+#define INT_CARDBUS		0x04
+#define INT_ZOOMED_VIDEO	0x08
+
+/* For RequestIO and ReleaseIO */
+typedef struct io_req_t {
+    ioaddr_t	BasePort1;
+    ioaddr_t	NumPorts1;
+    u_int	Attributes1;
+    ioaddr_t	BasePort2;
+    ioaddr_t	NumPorts2;
+    u_int	Attributes2;
+    u_int	IOAddrLines;
+} io_req_t;
+
+/* Attributes for RequestIO and ReleaseIO */
+#define IO_SHARED		0x01
+#define IO_FIRST_SHARED		0x02
+#define IO_FORCE_ALIAS_ACCESS	0x04
+#define IO_DATA_PATH_WIDTH	0x18
+#define IO_DATA_PATH_WIDTH_8	0x00
+#define IO_DATA_PATH_WIDTH_16	0x08
+#define IO_DATA_PATH_WIDTH_AUTO	0x10
+
+/* For RequestIRQ and ReleaseIRQ */
+typedef struct irq_req_t {
+    u_int	Attributes;
+    u_int	AssignedIRQ;
+    u_int	IRQInfo1, IRQInfo2;
+    void	*Handler;
+    void	*Instance;
+} irq_req_t;
+
+/* Attributes for RequestIRQ and ReleaseIRQ */
+#define IRQ_TYPE			0x03
+#define IRQ_TYPE_EXCLUSIVE		0x00
+#define IRQ_TYPE_TIME			0x01
+#define IRQ_TYPE_DYNAMIC_SHARING	0x02
+#define IRQ_FORCED_PULSE		0x04
+#define IRQ_FIRST_SHARED		0x08
+#define IRQ_HANDLE_PRESENT		0x10
+#define IRQ_PULSE_ALLOCATED		0x100
+
+/* Bits in IRQInfo1 field */
+#define IRQ_MASK		0x0f
+#define IRQ_NMI_ID		0x01
+#define IRQ_IOCK_ID		0x02
+#define IRQ_BERR_ID		0x04
+#define IRQ_VEND_ID		0x08
+#define IRQ_INFO2_VALID		0x10
+#define IRQ_LEVEL_ID		0x20
+#define IRQ_PULSE_ID		0x40
+#define IRQ_SHARE_ID		0x80
+
+typedef struct eventmask_t {
+    u_int	Attributes;
+    u_int	EventMask;
+} eventmask_t;
+
+#define CONF_EVENT_MASK_VALID	0x01
+
+/* Configuration registers present */
+#define PRESENT_OPTION		0x001
+#define PRESENT_STATUS		0x002
+#define PRESENT_PIN_REPLACE	0x004
+#define PRESENT_COPY		0x008
+#define PRESENT_EXT_STATUS	0x010
+#define PRESENT_IOBASE_0	0x020
+#define PRESENT_IOBASE_1	0x040
+#define PRESENT_IOBASE_2	0x080
+#define PRESENT_IOBASE_3	0x100
+#define PRESENT_IOSIZE		0x200
+
+/* For GetMemPage, MapMemPage */
+typedef struct memreq_t {
+    u_int	CardOffset;
+    page_t	Page;
+} memreq_t;
+
+/* For ModifyWindow */
+typedef struct modwin_t {
+    u_int	Attributes;
+    u_int	AccessSpeed;
+} modwin_t;
+
+/* For RequestWindow */
+typedef struct win_req_t {
+    u_int	Attributes;
+    u_long	Base;
+    u_int	Size;
+    u_int	AccessSpeed;
+} win_req_t;
+
+/* Attributes for RequestWindow */
+#define WIN_ADDR_SPACE		0x0001
+#define WIN_ADDR_SPACE_MEM	0x0000
+#define WIN_ADDR_SPACE_IO	0x0001
+#define WIN_MEMORY_TYPE		0x0002
+#define WIN_MEMORY_TYPE_CM	0x0000
+#define WIN_MEMORY_TYPE_AM	0x0002
+#define WIN_ENABLE		0x0004
+#define WIN_DATA_WIDTH		0x0018
+#define WIN_DATA_WIDTH_8	0x0000
+#define WIN_DATA_WIDTH_16	0x0008
+#define WIN_DATA_WIDTH_32	0x0010
+#define WIN_PAGED		0x0020
+#define WIN_SHARED		0x0040
+#define WIN_FIRST_SHARED	0x0080
+#define WIN_USE_WAIT		0x0100
+#define WIN_STRICT_ALIGN	0x0200
+#define WIN_MAP_BELOW_1MB	0x0400
+#define WIN_PREFETCH		0x0800
+#define WIN_CACHEABLE		0x1000
+#define WIN_BAR_MASK		0xe000
+#define WIN_BAR_SHIFT		13
+
+/* Attributes for RegisterClient */
+#define INFO_MASTER_CLIENT	0x01
+#define INFO_IO_CLIENT		0x02
+#define INFO_MTD_CLIENT		0x04
+#define INFO_MEM_CLIENT		0x08
+#define MAX_NUM_CLIENTS		3
+
+#define INFO_CARD_SHARE		0x10
+#define INFO_CARD_EXCL		0x20
+
+typedef struct cs_status_t {
+    u_char	Function;
+    event_t 	CardState;
+    event_t	SocketState;
+} cs_status_t;
+
+typedef struct error_info_t {
+    int		func;
+    int		retcode;
+} error_info_t;
+
+/* Special stuff for binding drivers to sockets */
+typedef struct bind_req_t {
+    socket_t	Socket;
+    u_char	Function;
+    dev_info_t	*dev_info;
+} bind_req_t;
+
+/* Flag to bind to all functions */
+#define BIND_FN_ALL	0xff
+
+typedef struct mtd_bind_t {
+    socket_t	Socket;
+    u_int	Attributes;
+    u_int	CardOffset;
+    dev_info_t	*dev_info;
+} mtd_bind_t;
+
+/* Events */
+#define CS_EVENT_PRI_LOW		0
+#define CS_EVENT_PRI_HIGH		1
+
+#define CS_EVENT_WRITE_PROTECT		0x000001
+#define CS_EVENT_CARD_LOCK		0x000002
+#define CS_EVENT_CARD_INSERTION		0x000004
+#define CS_EVENT_CARD_REMOVAL		0x000008
+#define CS_EVENT_BATTERY_DEAD		0x000010
+#define CS_EVENT_BATTERY_LOW		0x000020
+#define CS_EVENT_READY_CHANGE		0x000040
+#define CS_EVENT_CARD_DETECT		0x000080
+#define CS_EVENT_RESET_REQUEST		0x000100
+#define CS_EVENT_RESET_PHYSICAL		0x000200
+#define CS_EVENT_CARD_RESET		0x000400
+#define CS_EVENT_REGISTRATION_COMPLETE	0x000800
+#define CS_EVENT_RESET_COMPLETE		0x001000
+#define CS_EVENT_PM_SUSPEND		0x002000
+#define CS_EVENT_PM_RESUME		0x004000
+#define CS_EVENT_INSERTION_REQUEST	0x008000
+#define CS_EVENT_EJECTION_REQUEST	0x010000
+#define CS_EVENT_MTD_REQUEST		0x020000
+#define CS_EVENT_ERASE_COMPLETE		0x040000
+#define CS_EVENT_REQUEST_ATTENTION	0x080000
+#define CS_EVENT_CB_DETECT		0x100000
+#define CS_EVENT_3VCARD			0x200000
+#define CS_EVENT_XVCARD			0x400000
+
+/* Return codes */
+#define CS_SUCCESS		0x00
+#define CS_BAD_ADAPTER		0x01
+#define CS_BAD_ATTRIBUTE	0x02
+#define CS_BAD_BASE		0x03
+#define CS_BAD_EDC		0x04
+#define CS_BAD_IRQ		0x06
+#define CS_BAD_OFFSET		0x07
+#define CS_BAD_PAGE		0x08
+#define CS_READ_FAILURE		0x09
+#define CS_BAD_SIZE		0x0a
+#define CS_BAD_SOCKET		0x0b
+#define CS_BAD_TYPE		0x0d
+#define CS_BAD_VCC		0x0e
+#define CS_BAD_VPP		0x0f
+#define CS_BAD_WINDOW		0x11
+#define CS_WRITE_FAILURE	0x12
+#define CS_NO_CARD		0x14
+#define CS_UNSUPPORTED_FUNCTION	0x15
+#define CS_UNSUPPORTED_MODE	0x16
+#define CS_BAD_SPEED		0x17
+#define CS_BUSY			0x18
+#define CS_GENERAL_FAILURE	0x19
+#define CS_WRITE_PROTECTED	0x1a
+#define CS_BAD_ARG_LENGTH	0x1b
+#define CS_BAD_ARGS		0x1c
+#define CS_CONFIGURATION_LOCKED	0x1d
+#define CS_IN_USE		0x1e
+#define CS_NO_MORE_ITEMS	0x1f
+#define CS_OUT_OF_RESOURCE	0x20
+#define CS_BAD_HANDLE		0x21
+
+#define CS_BAD_TUPLE		0x40
+
+#ifdef __KERNEL__
+
+/*
+ *  The main Card Services entry point
+ */
+
+enum service {
+    AccessConfigurationRegister, AddSocketServices,
+    AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
+    DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
+    GetClientInfo, GetConfigurationInfo, GetEventMask,
+    GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
+    GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
+    GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
+    MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
+    OpenMemory, ParseTuple, ReadMemory, RegisterClient,
+    RegisterEraseQueue, RegisterMTD, RegisterTimer,
+    ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
+    ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
+    RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
+    RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
+    SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
+    WriteMemory, BindDevice, BindMTD, ReportError,
+    SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
+    GetFirstWindow, GetNextWindow, GetMemPage
+};
+
+#ifdef IN_CARD_SERVICES
+extern int CardServices(int func, void *a1, void *a2, void *a3);
+#else
+extern int CardServices(int func, ...);
+#endif
+
+int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg);
+int pcmcia_bind_device(bind_req_t *req);
+int pcmcia_bind_mtd(mtd_bind_t *req);
+int pcmcia_deregister_client(client_handle_t handle);
+int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config);
+int pcmcia_get_card_services_info(servinfo_t *info);
+int pcmcia_get_first_client(client_handle_t *handle, client_req_t *req);
+int pcmcia_get_next_client(client_handle_t *handle, client_req_t *req);
+int pcmcia_get_window(window_handle_t *handle, int idx, win_req_t *req);
+int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
+int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
+int pcmcia_get_status(client_handle_t handle, cs_status_t *status);
+int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
+int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
+int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod);
+int pcmcia_modify_window(window_handle_t win, modwin_t *req);
+int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
+int pcmcia_release_configuration(client_handle_t handle);
+int pcmcia_release_io(client_handle_t handle, io_req_t *req);
+int pcmcia_release_irq(client_handle_t handle, irq_req_t *req);
+int pcmcia_release_window(window_handle_t win);
+int pcmcia_request_configuration(client_handle_t handle, config_req_t *req);
+int pcmcia_request_io(client_handle_t handle, io_req_t *req);
+int pcmcia_request_irq(client_handle_t handle, irq_req_t *req);
+int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh);
+int pcmcia_reset_card(client_handle_t handle, client_req_t *req);
+int pcmcia_suspend_card(client_handle_t handle, client_req_t *req);
+int pcmcia_resume_card(client_handle_t handle, client_req_t *req);
+int pcmcia_eject_card(client_handle_t handle, client_req_t *req);
+int pcmcia_insert_card(client_handle_t handle, client_req_t *req);
+int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask);
+int pcmcia_report_error(client_handle_t handle, error_info_t *err);
+struct pci_bus *pcmcia_lookup_bus(client_handle_t handle);
+
+/* rsrc_mgr.c */
+int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj);
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_CS_H */
+/*
+ * cistpl.h 1.34 2000/06/19 23:18:12
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CISTPL_H
+#define _LINUX_CISTPL_H
+
+#define CISTPL_NULL		0x00
+#define CISTPL_DEVICE		0x01
+#define CISTPL_LONGLINK_CB	0x02
+#define CISTPL_INDIRECT		0x03
+#define CISTPL_CONFIG_CB	0x04
+#define CISTPL_CFTABLE_ENTRY_CB	0x05
+#define CISTPL_LONGLINK_MFC	0x06
+#define CISTPL_BAR		0x07
+#define CISTPL_PWR_MGMNT	0x08
+#define CISTPL_EXTDEVICE	0x09
+#define CISTPL_CHECKSUM		0x10
+#define CISTPL_LONGLINK_A	0x11
+#define CISTPL_LONGLINK_C	0x12
+#define CISTPL_LINKTARGET	0x13
+#define CISTPL_NO_LINK		0x14
+#define CISTPL_VERS_1		0x15
+#define CISTPL_ALTSTR		0x16
+#define CISTPL_DEVICE_A		0x17
+#define CISTPL_JEDEC_C		0x18
+#define CISTPL_JEDEC_A		0x19
+#define CISTPL_CONFIG		0x1a
+#define CISTPL_CFTABLE_ENTRY	0x1b
+#define CISTPL_DEVICE_OC	0x1c
+#define CISTPL_DEVICE_OA	0x1d
+#define CISTPL_DEVICE_GEO	0x1e
+#define CISTPL_DEVICE_GEO_A	0x1f
+#define CISTPL_MANFID		0x20
+#define CISTPL_FUNCID		0x21
+#define CISTPL_FUNCE		0x22
+#define CISTPL_SWIL		0x23
+#define CISTPL_END		0xff
+/* Layer 2 tuples */
+#define CISTPL_VERS_2		0x40
+#define CISTPL_FORMAT		0x41
+#define CISTPL_GEOMETRY		0x42
+#define CISTPL_BYTEORDER	0x43
+#define CISTPL_DATE		0x44
+#define CISTPL_BATTERY		0x45
+#define CISTPL_FORMAT_A		0x47
+/* Layer 3 tuples */
+#define CISTPL_ORG		0x46
+#define CISTPL_SPCL		0x90
+
+typedef struct cistpl_longlink_t {
+    u_int	addr;
+} cistpl_longlink_t;
+
+typedef struct cistpl_checksum_t {
+    u_short	addr;
+    u_short	len;
+    u_char	sum;
+} cistpl_checksum_t;
+
+#define CISTPL_MAX_FUNCTIONS	8
+#define CISTPL_MFC_ATTR		0x00
+#define CISTPL_MFC_COMMON	0x01
+
+typedef struct cistpl_longlink_mfc_t {
+    u_char	nfn;
+    struct {
+	u_char	space;
+	u_int	addr;
+    } fn[CISTPL_MAX_FUNCTIONS];
+} cistpl_longlink_mfc_t;
+
+#define CISTPL_MAX_ALTSTR_STRINGS	4
+
+typedef struct cistpl_altstr_t {
+    u_char	ns;
+    u_char	ofs[CISTPL_MAX_ALTSTR_STRINGS];
+    char	str[254];
+} cistpl_altstr_t;
+
+#define CISTPL_DTYPE_NULL	0x00
+#define CISTPL_DTYPE_ROM	0x01
+#define CISTPL_DTYPE_OTPROM	0x02
+#define CISTPL_DTYPE_EPROM	0x03
+#define CISTPL_DTYPE_EEPROM	0x04
+#define CISTPL_DTYPE_FLASH	0x05
+#define CISTPL_DTYPE_SRAM	0x06
+#define CISTPL_DTYPE_DRAM	0x07
+#define CISTPL_DTYPE_FUNCSPEC	0x0d
+#define CISTPL_DTYPE_EXTEND	0x0e
+
+#define CISTPL_MAX_DEVICES	4
+
+typedef struct cistpl_device_t {
+    u_char	ndev;
+    struct {
+	u_char 	type;
+	u_char	wp;
+	u_int	speed;
+	u_int	size;
+    } dev[CISTPL_MAX_DEVICES];
+} cistpl_device_t;
+
+#define CISTPL_DEVICE_MWAIT	0x01
+#define CISTPL_DEVICE_3VCC	0x02
+
+typedef struct cistpl_device_o_t {
+    u_char		flags;
+    cistpl_device_t	device;
+} cistpl_device_o_t;
+
+#define CISTPL_VERS_1_MAX_PROD_STRINGS	4
+
+typedef struct cistpl_vers_1_t {
+    u_char	major;
+    u_char	minor;
+    u_char	ns;
+    u_char	ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
+    char	str[254];
+} cistpl_vers_1_t;
+
+typedef struct cistpl_jedec_t {
+    u_char	nid;
+    struct {
+	u_char	mfr;
+	u_char	info;
+    } id[CISTPL_MAX_DEVICES];
+} cistpl_jedec_t;
+
+typedef struct cistpl_manfid_t {
+    u_short	manf;
+    u_short	card;
+} cistpl_manfid_t;
+
+#define CISTPL_FUNCID_MULTI	0x00
+#define CISTPL_FUNCID_MEMORY	0x01
+#define CISTPL_FUNCID_SERIAL	0x02
+#define CISTPL_FUNCID_PARALLEL	0x03
+#define CISTPL_FUNCID_FIXED	0x04
+#define CISTPL_FUNCID_VIDEO	0x05
+#define CISTPL_FUNCID_NETWORK	0x06
+#define CISTPL_FUNCID_AIMS	0x07
+#define CISTPL_FUNCID_SCSI	0x08
+
+#define CISTPL_SYSINIT_POST	0x01
+#define CISTPL_SYSINIT_ROM	0x02
+
+typedef struct cistpl_funcid_t {
+    u_char	func;
+    u_char	sysinit;
+} cistpl_funcid_t;
+
+typedef struct cistpl_funce_t {
+    u_char	type;
+    u_char	data[0];
+} cistpl_funce_t;
+
+/*======================================================================
+
+    Modem Function Extension Tuples
+
+======================================================================*/
+
+#define CISTPL_FUNCE_SERIAL_IF		0x00
+#define CISTPL_FUNCE_SERIAL_CAP		0x01
+#define CISTPL_FUNCE_SERIAL_SERV_DATA	0x02
+#define CISTPL_FUNCE_SERIAL_SERV_FAX	0x03
+#define CISTPL_FUNCE_SERIAL_SERV_VOICE	0x04
+#define CISTPL_FUNCE_SERIAL_CAP_DATA	0x05
+#define CISTPL_FUNCE_SERIAL_CAP_FAX	0x06
+#define CISTPL_FUNCE_SERIAL_CAP_VOICE	0x07
+#define CISTPL_FUNCE_SERIAL_IF_DATA	0x08
+#define CISTPL_FUNCE_SERIAL_IF_FAX	0x09
+#define CISTPL_FUNCE_SERIAL_IF_VOICE	0x0a
+
+/* UART identification */
+#define CISTPL_SERIAL_UART_8250		0x00
+#define CISTPL_SERIAL_UART_16450	0x01
+#define CISTPL_SERIAL_UART_16550	0x02
+#define CISTPL_SERIAL_UART_8251		0x03
+#define CISTPL_SERIAL_UART_8530		0x04
+#define CISTPL_SERIAL_UART_85230	0x05
+
+/* UART capabilities */
+#define CISTPL_SERIAL_UART_SPACE	0x01
+#define CISTPL_SERIAL_UART_MARK		0x02
+#define CISTPL_SERIAL_UART_ODD		0x04
+#define CISTPL_SERIAL_UART_EVEN		0x08
+#define CISTPL_SERIAL_UART_5BIT		0x01
+#define CISTPL_SERIAL_UART_6BIT		0x02
+#define CISTPL_SERIAL_UART_7BIT		0x04
+#define CISTPL_SERIAL_UART_8BIT		0x08
+#define CISTPL_SERIAL_UART_1STOP	0x10
+#define CISTPL_SERIAL_UART_MSTOP	0x20
+#define CISTPL_SERIAL_UART_2STOP	0x40
+
+typedef struct cistpl_serial_t {
+    u_char	uart_type;
+    u_char	uart_cap_0;
+    u_char	uart_cap_1;
+} cistpl_serial_t;
+
+typedef struct cistpl_modem_cap_t {
+    u_char	flow;
+    u_char	cmd_buf;
+    u_char	rcv_buf_0, rcv_buf_1, rcv_buf_2;
+    u_char	xmit_buf_0, xmit_buf_1, xmit_buf_2;
+} cistpl_modem_cap_t;
+
+#define CISTPL_SERIAL_MOD_103		0x01
+#define CISTPL_SERIAL_MOD_V21		0x02
+#define CISTPL_SERIAL_MOD_V23		0x04
+#define CISTPL_SERIAL_MOD_V22		0x08
+#define CISTPL_SERIAL_MOD_212A		0x10
+#define CISTPL_SERIAL_MOD_V22BIS	0x20
+#define CISTPL_SERIAL_MOD_V26		0x40
+#define CISTPL_SERIAL_MOD_V26BIS	0x80
+#define CISTPL_SERIAL_MOD_V27BIS	0x01
+#define CISTPL_SERIAL_MOD_V29		0x02
+#define CISTPL_SERIAL_MOD_V32		0x04
+#define CISTPL_SERIAL_MOD_V32BIS	0x08
+#define CISTPL_SERIAL_MOD_V34		0x10
+
+#define CISTPL_SERIAL_ERR_MNP2_4	0x01
+#define CISTPL_SERIAL_ERR_V42_LAPM	0x02
+
+#define CISTPL_SERIAL_CMPR_V42BIS	0x01
+#define CISTPL_SERIAL_CMPR_MNP5		0x02
+
+#define CISTPL_SERIAL_CMD_AT1		0x01
+#define CISTPL_SERIAL_CMD_AT2		0x02
+#define CISTPL_SERIAL_CMD_AT3		0x04
+#define CISTPL_SERIAL_CMD_MNP_AT	0x08
+#define CISTPL_SERIAL_CMD_V25BIS	0x10
+#define CISTPL_SERIAL_CMD_V25A		0x20
+#define CISTPL_SERIAL_CMD_DMCL		0x40
+
+typedef struct cistpl_data_serv_t {
+    u_char	max_data_0;
+    u_char	max_data_1;
+    u_char	modulation_0;
+    u_char	modulation_1;
+    u_char	error_control;
+    u_char	compression;
+    u_char	cmd_protocol;
+    u_char	escape;
+    u_char	encrypt;
+    u_char	misc_features;
+    u_char	ccitt_code[0];
+} cistpl_data_serv_t;
+
+typedef struct cistpl_fax_serv_t {
+    u_char	max_data_0;
+    u_char	max_data_1;
+    u_char	modulation;
+    u_char	encrypt;
+    u_char	features_0;
+    u_char	features_1;
+    u_char	ccitt_code[0];
+} cistpl_fax_serv_t;
+
+typedef struct cistpl_voice_serv_t {
+    u_char	max_data_0;
+    u_char	max_data_1;
+} cistpl_voice_serv_t;
+
+/*======================================================================
+
+    LAN Function Extension Tuples
+
+======================================================================*/
+
+#define CISTPL_FUNCE_LAN_TECH		0x01
+#define CISTPL_FUNCE_LAN_SPEED		0x02
+#define CISTPL_FUNCE_LAN_MEDIA		0x03
+#define CISTPL_FUNCE_LAN_NODE_ID	0x04
+#define CISTPL_FUNCE_LAN_CONNECTOR	0x05
+
+/* LAN technologies */
+#define CISTPL_LAN_TECH_ARCNET		0x01
+#define CISTPL_LAN_TECH_ETHERNET	0x02
+#define CISTPL_LAN_TECH_TOKENRING	0x03
+#define CISTPL_LAN_TECH_LOCALTALK	0x04
+#define CISTPL_LAN_TECH_FDDI		0x05
+#define CISTPL_LAN_TECH_ATM		0x06
+#define CISTPL_LAN_TECH_WIRELESS	0x07
+
+typedef struct cistpl_lan_tech_t {
+    u_char	tech;
+} cistpl_lan_tech_t;
+
+typedef struct cistpl_lan_speed_t {
+    u_int	speed;
+} cistpl_lan_speed_t;
+
+/* LAN media definitions */
+#define CISTPL_LAN_MEDIA_UTP		0x01
+#define CISTPL_LAN_MEDIA_STP		0x02
+#define CISTPL_LAN_MEDIA_THIN_COAX	0x03
+#define CISTPL_LAN_MEDIA_THICK_COAX	0x04
+#define CISTPL_LAN_MEDIA_FIBER		0x05
+#define CISTPL_LAN_MEDIA_900MHZ		0x06
+#define CISTPL_LAN_MEDIA_2GHZ		0x07
+#define CISTPL_LAN_MEDIA_5GHZ		0x08
+#define CISTPL_LAN_MEDIA_DIFF_IR	0x09
+#define CISTPL_LAN_MEDIA_PTP_IR		0x0a
+
+typedef struct cistpl_lan_media_t {
+    u_char	media;
+} cistpl_lan_media_t;
+
+typedef struct cistpl_lan_node_id_t {
+    u_char	nb;
+    u_char	id[16];
+} cistpl_lan_node_id_t;
+
+typedef struct cistpl_lan_connector_t {
+    u_char	code;
+} cistpl_lan_connector_t;
+
+/*======================================================================
+
+    IDE Function Extension Tuples
+
+======================================================================*/
+
+#define CISTPL_IDE_INTERFACE		0x01
+
+typedef struct cistpl_ide_interface_t {
+    u_char	interface;
+} cistpl_ide_interface_t;
+
+/* First feature byte */
+#define CISTPL_IDE_SILICON		0x04
+#define CISTPL_IDE_UNIQUE		0x08
+#define CISTPL_IDE_DUAL			0x10
+
+/* Second feature byte */
+#define CISTPL_IDE_HAS_SLEEP		0x01
+#define CISTPL_IDE_HAS_STANDBY		0x02
+#define CISTPL_IDE_HAS_IDLE		0x04
+#define CISTPL_IDE_LOW_POWER		0x08
+#define CISTPL_IDE_REG_INHIBIT		0x10
+#define CISTPL_IDE_HAS_INDEX		0x20
+#define CISTPL_IDE_IOIS16		0x40
+
+typedef struct cistpl_ide_feature_t {
+    u_char	feature1;
+    u_char	feature2;
+} cistpl_ide_feature_t;
+
+#define CISTPL_FUNCE_IDE_IFACE		0x01
+#define CISTPL_FUNCE_IDE_MASTER		0x02
+#define CISTPL_FUNCE_IDE_SLAVE		0x03
+
+/*======================================================================
+
+    Configuration Table Entries
+
+======================================================================*/
+
+#define CISTPL_BAR_SPACE	0x07
+#define CISTPL_BAR_SPACE_IO	0x10
+#define CISTPL_BAR_PREFETCH	0x20
+#define CISTPL_BAR_CACHEABLE	0x40
+#define CISTPL_BAR_1MEG_MAP	0x80
+
+typedef struct cistpl_bar_t {
+    u_char	attr;
+    u_int	size;
+} cistpl_bar_t;
+
+typedef struct cistpl_config_t {
+    u_char	last_idx;
+    u_int	base;
+    u_int	rmask[4];
+    u_char	subtuples;
+} cistpl_config_t;
+
+/* These are bits in the 'present' field, and indices in 'param' */
+#define CISTPL_POWER_VNOM	0
+#define CISTPL_POWER_VMIN	1
+#define CISTPL_POWER_VMAX	2
+#define CISTPL_POWER_ISTATIC	3
+#define CISTPL_POWER_IAVG	4
+#define CISTPL_POWER_IPEAK	5
+#define CISTPL_POWER_IDOWN	6
+
+#define CISTPL_POWER_HIGHZ_OK	0x01
+#define CISTPL_POWER_HIGHZ_REQ	0x02
+
+typedef struct cistpl_power_t {
+    u_char	present;
+    u_char	flags;
+    u_int	param[7];
+} cistpl_power_t;
+
+typedef struct cistpl_timing_t {
+    u_int	wait, waitscale;
+    u_int	ready, rdyscale;
+    u_int	reserved, rsvscale;
+} cistpl_timing_t;
+
+#define CISTPL_IO_LINES_MASK	0x1f
+#define CISTPL_IO_8BIT		0x20
+#define CISTPL_IO_16BIT		0x40
+#define CISTPL_IO_RANGE		0x80
+
+#define CISTPL_IO_MAX_WIN	16
+
+typedef struct cistpl_io_t {
+    u_char	flags;
+    u_char	nwin;
+    struct {
+	u_int	base;
+	u_int	len;
+    } win[CISTPL_IO_MAX_WIN];
+} cistpl_io_t;
+
+typedef struct cistpl_irq_t {
+    u_int	IRQInfo1;
+    u_int	IRQInfo2;
+} cistpl_irq_t;
+
+#define CISTPL_MEM_MAX_WIN	8
+
+typedef struct cistpl_mem_t {
+    u_char	flags;
+    u_char	nwin;
+    struct {
+	u_int	len;
+	u_int	card_addr;
+	u_int	host_addr;
+    } win[CISTPL_MEM_MAX_WIN];
+} cistpl_mem_t;
+
+#define CISTPL_CFTABLE_DEFAULT		0x0001
+#define CISTPL_CFTABLE_BVDS		0x0002
+#define CISTPL_CFTABLE_WP		0x0004
+#define CISTPL_CFTABLE_RDYBSY		0x0008
+#define CISTPL_CFTABLE_MWAIT		0x0010
+#define CISTPL_CFTABLE_AUDIO		0x0800
+#define CISTPL_CFTABLE_READONLY		0x1000
+#define CISTPL_CFTABLE_PWRDOWN		0x2000
+
+typedef struct cistpl_cftable_entry_t {
+    u_char		index;
+    u_short		flags;
+    u_char		interface;
+    cistpl_power_t	vcc, vpp1, vpp2;
+    cistpl_timing_t	timing;
+    cistpl_io_t		io;
+    cistpl_irq_t	irq;
+    cistpl_mem_t	mem;
+    u_char		subtuples;
+} cistpl_cftable_entry_t;
+
+#define CISTPL_CFTABLE_MASTER		0x000100
+#define CISTPL_CFTABLE_INVALIDATE	0x000200
+#define CISTPL_CFTABLE_VGA_PALETTE	0x000400
+#define CISTPL_CFTABLE_PARITY		0x000800
+#define CISTPL_CFTABLE_WAIT		0x001000
+#define CISTPL_CFTABLE_SERR		0x002000
+#define CISTPL_CFTABLE_FAST_BACK	0x004000
+#define CISTPL_CFTABLE_BINARY_AUDIO	0x010000
+#define CISTPL_CFTABLE_PWM_AUDIO	0x020000
+
+typedef struct cistpl_cftable_entry_cb_t {
+    u_char		index;
+    u_int		flags;
+    cistpl_power_t	vcc, vpp1, vpp2;
+    u_char		io;
+    cistpl_irq_t	irq;
+    u_char		mem;
+    u_char		subtuples;
+} cistpl_cftable_entry_cb_t;
+
+typedef struct cistpl_device_geo_t {
+    u_char		ngeo;
+    struct {
+	u_char		buswidth;
+	u_int		erase_block;
+	u_int		read_block;
+	u_int		write_block;
+	u_int		partition;
+	u_int		interleave;
+    } geo[CISTPL_MAX_DEVICES];
+} cistpl_device_geo_t;
+
+typedef struct cistpl_vers_2_t {
+    u_char	vers;
+    u_char	comply;
+    u_short	dindex;
+    u_char	vspec8, vspec9;
+    u_char	nhdr;
+    u_char	vendor, info;
+    char	str[244];
+} cistpl_vers_2_t;
+
+typedef struct cistpl_org_t {
+    u_char	data_org;
+    char	desc[30];
+} cistpl_org_t;
+
+#define CISTPL_ORG_FS		0x00
+#define CISTPL_ORG_APPSPEC	0x01
+#define CISTPL_ORG_XIP		0x02
+
+typedef struct cistpl_format_t {
+    u_char	type;
+    u_char	edc;
+    u_int	offset;
+    u_int	length;
+} cistpl_format_t;
+
+#define CISTPL_FORMAT_DISK	0x00
+#define CISTPL_FORMAT_MEM	0x01
+
+#define CISTPL_EDC_NONE		0x00
+#define CISTPL_EDC_CKSUM	0x01
+#define CISTPL_EDC_CRC		0x02
+#define CISTPL_EDC_PCC		0x03
+
+typedef union cisparse_t {
+    cistpl_device_t		device;
+    cistpl_checksum_t		checksum;
+    cistpl_longlink_t		longlink;
+    cistpl_longlink_mfc_t	longlink_mfc;
+    cistpl_vers_1_t		version_1;
+    cistpl_altstr_t		altstr;
+    cistpl_jedec_t		jedec;
+    cistpl_manfid_t		manfid;
+    cistpl_funcid_t		funcid;
+    cistpl_funce_t		funce;
+    cistpl_bar_t		bar;
+    cistpl_config_t		config;
+    cistpl_cftable_entry_t	cftable_entry;
+    cistpl_cftable_entry_cb_t	cftable_entry_cb;
+    cistpl_device_geo_t		device_geo;
+    cistpl_vers_2_t		vers_2;
+    cistpl_org_t		org;
+    cistpl_format_t		format;
+} cisparse_t;
+
+typedef struct tuple_t {
+    u_int	Attributes;
+    cisdata_t 	DesiredTuple;
+    u_int	Flags;		/* internal use */
+    u_int	LinkOffset;	/* internal use */
+    u_int	CISOffset;	/* internal use */
+    cisdata_t	TupleCode;
+    cisdata_t	TupleLink;
+    cisdata_t	TupleOffset;
+    cisdata_t	TupleDataMax;
+    cisdata_t	TupleDataLen;
+    cisdata_t	*TupleData;
+} tuple_t;
+
+/* Special cisdata_t value */
+#define RETURN_FIRST_TUPLE	0xff
+
+/* Attributes for tuple calls */
+#define TUPLE_RETURN_LINK	0x01
+#define TUPLE_RETURN_COMMON	0x02
+
+/* For ValidateCIS */
+typedef struct cisinfo_t {
+    u_int	Chains;
+} cisinfo_t;
+
+#define CISTPL_MAX_CIS_SIZE	0x200
+
+/* For ReplaceCIS */
+typedef struct cisdump_t {
+    u_int	Length;
+    cisdata_t	Data[CISTPL_MAX_CIS_SIZE];
+} cisdump_t;
+
+int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple);
+int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple);
+int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple);
+int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse);
+
+int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info);
+int pcmcia_replace_cis(client_handle_t handle, cisdump_t *cis);
+
+#endif /* LINUX_CISTPL_H */
+/*
+ * ds.h 1.56 2000/06/12 21:55:40
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_DS_H
+#define _LINUX_DS_H
+
+/* driver_ops.h 1.15 2000/06/12 21:55:40 */
+#ifndef _LINUX_DRIVER_OPS_H
+#define _LINUX_DRIVER_OPS_H
+
+#ifndef DEV_NAME_LEN
+#define DEV_NAME_LEN	32
+#endif
+
+#endif /* _LINUX_DRIVER_OPS_H */
+
+/* Definitions for bulk memory services */
+#ifndef _LINUX_BULKMEM_H
+#define _LINUX_BULKMEM_H
+
+/* For GetFirstRegion and GetNextRegion */
+typedef struct region_info_t {
+    u_int		Attributes;
+    u_int		CardOffset;
+    u_int		RegionSize;
+    u_int		AccessSpeed;
+    u_int		BlockSize;
+    u_int		PartMultiple;
+    u_char		JedecMfr, JedecInfo;
+    memory_handle_t	next;
+} region_info_t;
+
+#define REGION_TYPE		0x0001
+#define REGION_TYPE_CM		0x0000
+#define REGION_TYPE_AM		0x0001
+#define REGION_PREFETCH		0x0008
+#define REGION_CACHEABLE	0x0010
+#define REGION_BAR_MASK		0xe000
+#define REGION_BAR_SHIFT	13
+
+/* For OpenMemory */
+typedef struct open_mem_t {
+    u_int		Attributes;
+    u_int		Offset;
+} open_mem_t;
+
+/* Attributes for OpenMemory */
+#define MEMORY_TYPE		0x0001
+#define MEMORY_TYPE_CM		0x0000
+#define MEMORY_TYPE_AM		0x0001
+#define MEMORY_EXCLUSIVE	0x0002
+#define MEMORY_PREFETCH		0x0008
+#define MEMORY_CACHEABLE	0x0010
+#define MEMORY_BAR_MASK		0xe000
+#define MEMORY_BAR_SHIFT	13
+
+typedef struct eraseq_entry_t {
+    memory_handle_t	Handle;
+    u_char		State;
+    u_int		Size;
+    u_int		Offset;
+    void		*Optional;
+} eraseq_entry_t;
+
+typedef struct eraseq_hdr_t {
+    int			QueueEntryCnt;
+    eraseq_entry_t	*QueueEntryArray;
+} eraseq_hdr_t;
+
+#define ERASE_QUEUED		0x00
+#define ERASE_IN_PROGRESS(n)	(((n) > 0) && ((n) < 0x80))
+#define ERASE_IDLE		0xff
+#define ERASE_PASSED		0xe0
+#define ERASE_FAILED		0xe1
+
+#define ERASE_MISSING		0x80
+#define ERASE_MEDIA_WRPROT	0x84
+#define ERASE_NOT_ERASABLE	0x85
+#define ERASE_BAD_OFFSET	0xc1
+#define ERASE_BAD_TECH		0xc2
+#define ERASE_BAD_SOCKET	0xc3
+#define ERASE_BAD_VCC		0xc4
+#define ERASE_BAD_VPP		0xc5
+#define ERASE_BAD_SIZE		0xc6
+
+/* For CopyMemory */
+typedef struct copy_op_t {
+    u_int		Attributes;
+    u_int		SourceOffset;
+    u_int		DestOffset;
+    u_int		Count;
+} copy_op_t;
+
+/* For ReadMemory and WriteMemory */
+typedef struct mem_op_t {
+    u_int	Attributes;
+    u_int	Offset;
+    u_int	Count;
+} mem_op_t;
+
+#define MEM_OP_BUFFER		0x01
+#define MEM_OP_BUFFER_USER	0x00
+#define MEM_OP_BUFFER_KERNEL	0x01
+#define MEM_OP_DISABLE_ERASE	0x02
+#define MEM_OP_VERIFY		0x04
+
+/* For RegisterMTD */
+typedef struct mtd_reg_t {
+    u_int	Attributes;
+    u_int	Offset;
+    u_long	MediaID;
+} mtd_reg_t;
+
+/*
+ *  Definitions for MTD requests
+ */
+
+typedef struct mtd_request_t {
+    u_int	SrcCardOffset;
+    u_int	DestCardOffset;
+    u_int	TransferLength;
+    u_int	Function;
+    u_long	MediaID;
+    u_int	Status;
+    u_int	Timeout;
+} mtd_request_t;
+
+/* Fields in MTD Function */
+#define MTD_REQ_ACTION		0x003
+#define MTD_REQ_ERASE		0x000
+#define MTD_REQ_READ		0x001
+#define MTD_REQ_WRITE		0x002
+#define MTD_REQ_COPY		0x003
+#define MTD_REQ_NOERASE		0x004
+#define MTD_REQ_VERIFY		0x008
+#define MTD_REQ_READY		0x010
+#define MTD_REQ_TIMEOUT		0x020
+#define MTD_REQ_LAST		0x040
+#define MTD_REQ_FIRST		0x080
+#define MTD_REQ_KERNEL		0x100
+
+/* Status codes */
+#define MTD_WAITREQ	0x00
+#define MTD_WAITTIMER	0x01
+#define MTD_WAITRDY	0x02
+#define MTD_WAITPOWER	0x03
+
+/*
+ *  Definitions for MTD helper functions
+ */
+
+/* For MTDModifyWindow */
+typedef struct mtd_mod_win_t {
+    u_int	Attributes;
+    u_int	AccessSpeed;
+    u_int	CardOffset;
+} mtd_mod_win_t;
+
+/* For MTDSetVpp */
+typedef struct mtd_vpp_req_t {
+    u_char	Vpp1, Vpp2;
+} mtd_vpp_req_t;
+
+/* For MTDRDYMask */
+typedef struct mtd_rdy_req_t {
+    u_int	Mask;
+} mtd_rdy_req_t;
+
+enum mtd_helper {
+    MTDRequestWindow, MTDModifyWindow, MTDReleaseWindow,
+    MTDSetVpp, MTDRDYMask
+};
+
+#ifdef IN_CARD_SERVICES
+extern int MTDHelperEntry(int func, void *a1, void *a2);
+#else
+extern int MTDHelperEntry(int func, ...);
+#endif
+
+int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn);
+int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn);
+int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg);
+int pcmcia_register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header, eraseq_handle_t *e);
+int pcmcia_deregister_erase_queue(eraseq_handle_t eraseq);
+int pcmcia_check_erase_queue(eraseq_handle_t eraseq);
+int pcmcia_open_memory(client_handle_t *handle, open_mem_t *Xopen, memory_handle_t *m);
+int pcmcia_close_memory(memory_handle_t handle);
+int pcmcia_read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
+int pcmcia_write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
+int pcmcia_copy_memory(memory_handle_t handle, copy_op_t *req);
+
+#endif /* _LINUX_BULKMEM_H */
+
+typedef struct tuple_parse_t {
+    tuple_t		tuple;
+    cisdata_t		data[255];
+    cisparse_t		parse;
+} tuple_parse_t;
+
+typedef struct win_info_t {
+    window_handle_t	handle;
+    win_req_t		window;
+    memreq_t		map;
+} win_info_t;
+
+typedef struct bind_info_t {
+    dev_info_t		dev_info;
+    u_char		function;
+    struct dev_link_t	*instance;
+    char		name[DEV_NAME_LEN];
+    u_short		major, minor;
+    void		*next;
+} bind_info_t;
+
+typedef struct mtd_info_t {
+    dev_info_t		dev_info;
+    u_int		Attributes;
+    u_int		CardOffset;
+} mtd_info_t;
+
+typedef union ds_ioctl_arg_t {
+    servinfo_t		servinfo;
+    adjust_t		adjust;
+    config_info_t	config;
+    tuple_t		tuple;
+    tuple_parse_t	tuple_parse;
+    client_req_t	client_req;
+    cs_status_t		status;
+    conf_reg_t		conf_reg;
+    cisinfo_t		cisinfo;
+    region_info_t	region;
+    bind_info_t		bind_info;
+    mtd_info_t		mtd_info;
+    win_info_t		win_info;
+    cisdump_t		cisdump;
+} ds_ioctl_arg_t;
+
+#define DS_GET_CARD_SERVICES_INFO	_IOR ('d', 1, servinfo_t)
+#define DS_ADJUST_RESOURCE_INFO		_IOWR('d', 2, adjust_t)
+#define DS_GET_CONFIGURATION_INFO	_IOWR('d', 3, config_info_t)
+#define DS_GET_FIRST_TUPLE		_IOWR('d', 4, tuple_t)
+#define DS_GET_NEXT_TUPLE		_IOWR('d', 5, tuple_t)
+#define DS_GET_TUPLE_DATA		_IOWR('d', 6, tuple_parse_t)
+#define DS_PARSE_TUPLE			_IOWR('d', 7, tuple_parse_t)
+#define DS_RESET_CARD			_IO  ('d', 8)
+#define DS_GET_STATUS			_IOWR('d', 9, cs_status_t)
+#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
+#define DS_VALIDATE_CIS			_IOR ('d', 11, cisinfo_t)
+#define DS_SUSPEND_CARD			_IO  ('d', 12)
+#define DS_RESUME_CARD			_IO  ('d', 13)
+#define DS_EJECT_CARD			_IO  ('d', 14)
+#define DS_INSERT_CARD			_IO  ('d', 15)
+#define DS_GET_FIRST_REGION		_IOWR('d', 16, region_info_t)
+#define DS_GET_NEXT_REGION		_IOWR('d', 17, region_info_t)
+#define DS_REPLACE_CIS			_IOWR('d', 18, cisdump_t)
+#define DS_GET_FIRST_WINDOW		_IOR ('d', 19, win_info_t)
+#define DS_GET_NEXT_WINDOW		_IOWR('d', 20, win_info_t)
+#define DS_GET_MEM_PAGE			_IOWR('d', 21, win_info_t)
+
+#define DS_BIND_REQUEST			_IOWR('d', 60, bind_info_t)
+#define DS_GET_DEVICE_INFO		_IOWR('d', 61, bind_info_t)
+#define DS_GET_NEXT_DEVICE		_IOWR('d', 62, bind_info_t)
+#define DS_UNBIND_REQUEST		_IOW ('d', 63, bind_info_t)
+#define DS_BIND_MTD			_IOWR('d', 64, mtd_info_t)
+
+#endif /* _LINUX_DS_H */
diff -urN busybox.orig/hotplug/yacc_config.c_shipped busybox/hotplug/yacc_config.c_shipped
--- busybox.orig/hotplug/yacc_config.c_shipped	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/yacc_config.c_shipped	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,1914 @@
+/* A Bison parser, made by GNU Bison 1.875a.  */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* Written by Richard Stallman by simplifying the original so called
+   ``semantic'' parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Using locations.  */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     DEVICE = 258,
+     CARD = 259,
+     ANONYMOUS = 260,
+     TUPLE = 261,
+     MANFID = 262,
+     VERSION = 263,
+     FUNCTION = 264,
+     PCI = 265,
+     BIND = 266,
+     CIS = 267,
+     TO = 268,
+     NEEDS_MTD = 269,
+     MODULE = 270,
+     OPTS = 271,
+     CLASS = 272,
+     REGION = 273,
+     JEDEC = 274,
+     DTYPE = 275,
+     DEFAULT = 276,
+     MTD = 277,
+     INCLUDE = 278,
+     EXCLUDE = 279,
+     RESERVE = 280,
+     IRQ_NO = 281,
+     PORT = 282,
+     MEMORY = 283,
+     STRING = 284,
+     NUMBER = 285,
+     SOURCE = 286
+   };
+#endif
+#define DEVICE 258
+#define CARD 259
+#define ANONYMOUS 260
+#define TUPLE 261
+#define MANFID 262
+#define VERSION 263
+#define FUNCTION 264
+#define PCI 265
+#define BIND 266
+#define CIS 267
+#define TO 268
+#define NEEDS_MTD 269
+#define MODULE 270
+#define OPTS 271
+#define CLASS 272
+#define REGION 273
+#define JEDEC 274
+#define DTYPE 275
+#define DEFAULT 276
+#define MTD 277
+#define INCLUDE 278
+#define EXCLUDE 279
+#define RESERVE 280
+#define IRQ_NO 281
+#define PORT 282
+#define MEMORY 283
+#define STRING 284
+#define NUMBER 285
+#define SOURCE 286
+
+
+
+
+/* Copy the first part of user declarations.  */
+#line 1 "../hotplug/yacc_config.y"
+
+/*
+ * yacc_config.y 1.59 2003/06/12 07:24:27
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License. 
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+    
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+#include <sys/types.h>
+
+#include "pcmcia.h"
+#include "cardmgr.h"
+
+/* If bison: generate nicer error messages */ 
+#define YYERROR_VERBOSE 1
+ 
+/* from lex_config, for nice error messages */
+extern char *current_file;
+extern int current_lineno;
+
+void yyerror(char *msg, ...);
+
+static int add_binding(card_info_t *card, char *name, char *class, int fn);
+static int add_module(device_info_t *card, char *name);
+
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 61 "../hotplug/yacc_config.y"
+typedef union YYSTYPE {
+    char *str;
+    u_long num;
+    struct device_info_t *device;
+    struct card_info_t *card;
+    struct mtd_ident_t *mtd;
+    struct adjust_list_t *adjust;
+} YYSTYPE;
+/* Line 191 of yacc.c.  */
+#line 201 "../hotplug/yacc_config.c"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations.  */
+
+
+/* Line 214 of yacc.c.  */
+#line 213 "../hotplug/yacc_config.c"
+
+#if ! defined (yyoverflow) || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# if YYSTACK_USE_ALLOCA
+#  define YYSTACK_ALLOC alloca
+# else
+#  ifndef YYSTACK_USE_ALLOCA
+#   if defined (alloca) || defined (_ALLOCA_H)
+#    define YYSTACK_ALLOC alloca
+#   else
+#    ifdef __GNUC__
+#     define YYSTACK_ALLOC __builtin_alloca
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's `empty if-body' warning. */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# else
+#  if defined (__STDC__) || defined (__cplusplus)
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   define YYSIZE_T size_t
+#  endif
+#  define YYSTACK_ALLOC malloc
+#  define YYSTACK_FREE free
+# endif
+#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
+
+
+#if (! defined (yyoverflow) \
+     && (! defined (__cplusplus) \
+	 || (YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  short yyss;
+  YYSTYPE yyvs;
+  };
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
+      + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  register YYSIZE_T yyi;		\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (0)
+#  endif
+# endif
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack)					\
+    do									\
+      {									\
+	YYSIZE_T yynewbytes;						\
+	YYCOPY (&yyptr->Stack, Stack, yysize);				\
+	Stack = &yyptr->Stack;						\
+	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+	yyptr += yynewbytes / sizeof (*yyptr);				\
+      }									\
+    while (0)
+
+#endif
+
+#if defined (__STDC__) || defined (__cplusplus)
+   typedef signed char yysigned_char;
+#else
+   typedef short yysigned_char;
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL  2
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   99
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS  34
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS  24
+/* YYNRULES -- Number of rules. */
+#define YYNRULES  62
+/* YYNRULES -- Number of states. */
+#define YYNSTATES  116
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   286
+
+#define YYTRANSLATE(YYX) 						\
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const unsigned char yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,    32,    33,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+      25,    26,    27,    28,    29,    30,    31
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const unsigned char yyprhs[] =
+{
+       0,     0,     3,     4,     7,    10,    13,    16,    19,    22,
+      25,    28,    31,    34,    37,    41,    44,    49,    54,    57,
+      59,    61,    63,    66,    68,    70,    72,    74,    76,    78,
+      80,    82,    85,    93,    99,   105,   109,   113,   117,   121,
+     125,   131,   137,   145,   149,   155,   161,   169,   172,   177,
+     181,   185,   189,   193,   196,   198,   200,   202,   206,   211,
+     214,   218,   222
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yysigned_char yyrhs[] =
+{
+      35,     0,    -1,    -1,    35,    36,    -1,    35,    38,    -1,
+      35,    56,    -1,    35,    39,    -1,    35,    49,    -1,    35,
+      57,    -1,    35,    31,    -1,    35,     1,    -1,    23,    37,
+      -1,    24,    37,    -1,    25,    37,    -1,    36,    32,    37,
+      -1,    26,    30,    -1,    27,    30,    33,    30,    -1,    28,
+      30,    33,    30,    -1,     3,    29,    -1,    48,    -1,    50,
+      -1,    51,    -1,     4,    29,    -1,    40,    -1,    41,    -1,
+      42,    -1,    43,    -1,    44,    -1,    45,    -1,    47,    -1,
+      46,    -1,    39,     5,    -1,    39,     6,    30,    32,    30,
+      32,    29,    -1,    39,     7,    30,    32,    30,    -1,    39,
+      10,    30,    32,    30,    -1,    39,     8,    29,    -1,    44,
+      32,    29,    -1,    39,     9,    30,    -1,    39,    12,    29,
+      -1,    39,    11,    29,    -1,    39,    11,    29,    17,    29,
+      -1,    39,    11,    29,    13,    30,    -1,    39,    11,    29,
+      17,    29,    13,    30,    -1,    47,    32,    29,    -1,    47,
+      32,    29,    17,    29,    -1,    47,    32,    29,    13,    30,
+      -1,    47,    32,    29,    17,    29,    13,    30,    -1,    38,
+      14,    -1,    15,    29,    16,    29,    -1,    38,    15,    29,
+      -1,    50,    16,    29,    -1,    50,    32,    29,    -1,    38,
+      17,    29,    -1,    18,    29,    -1,    53,    -1,    54,    -1,
+      55,    -1,    52,    20,    30,    -1,    52,    19,    30,    30,
+      -1,    52,    21,    -1,    52,    22,    29,    -1,    56,    16,
+      29,    -1,    22,    29,    16,    29,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const unsigned short yyrline[] =
+{
+       0,    78,    78,    79,    85,    90,   103,   121,   122,   123,
+     124,   127,   132,   137,   143,   152,   158,   169,   182,   189,
+     190,   191,   194,   200,   201,   202,   203,   204,   205,   206,
+     207,   210,   221,   234,   245,   256,   266,   277,   288,   292,
+     297,   302,   307,   312,   317,   322,   327,   334,   340,   363,
+     368,   378,   385,   395,   401,   402,   403,   406,   417,   429,
+     444,   452,   463
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE
+/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "DEVICE", "CARD", "ANONYMOUS", "TUPLE", 
+  "MANFID", "VERSION", "FUNCTION", "PCI", "BIND", "CIS", "TO", 
+  "NEEDS_MTD", "MODULE", "OPTS", "CLASS", "REGION", "JEDEC", "DTYPE", 
+  "DEFAULT", "MTD", "INCLUDE", "EXCLUDE", "RESERVE", "IRQ_NO", "PORT", 
+  "MEMORY", "STRING", "NUMBER", "SOURCE", "','", "'-'", "$accept", "list", 
+  "adjust", "resource", "device", "card", "anonymous", "tuple", "manfid", 
+  "pci", "version", "function", "cis", "bind", "needs_mtd", "opts", 
+  "module", "class", "region", "dtype", "jedec", "default", "mtd", 
+  "mtd_opts", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const unsigned short yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
+     285,   286,    44,    45
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const unsigned char yyr1[] =
+{
+       0,    34,    35,    35,    35,    35,    35,    35,    35,    35,
+      35,    36,    36,    36,    36,    37,    37,    37,    38,    38,
+      38,    38,    39,    39,    39,    39,    39,    39,    39,    39,
+      39,    40,    41,    42,    43,    44,    44,    45,    46,    47,
+      47,    47,    47,    47,    47,    47,    47,    48,    49,    50,
+      50,    50,    51,    52,    52,    52,    52,    53,    54,    55,
+      56,    56,    57
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const unsigned char yyr2[] =
+{
+       0,     2,     0,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     3,     2,     4,     4,     2,     1,
+       1,     1,     2,     1,     1,     1,     1,     1,     1,     1,
+       1,     2,     7,     5,     5,     3,     3,     3,     3,     3,
+       5,     5,     7,     3,     5,     5,     7,     2,     4,     3,
+       3,     3,     3,     2,     1,     1,     1,     3,     4,     2,
+       3,     3,     4
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const unsigned char yydefact[] =
+{
+       2,     0,     1,    10,     0,     0,     0,     0,     0,     0,
+       0,     0,     9,     3,     4,     6,    23,    24,    25,    26,
+      27,    28,    30,    29,    19,     7,    20,    21,     0,    54,
+      55,    56,     5,     8,    18,    22,     0,    53,     0,     0,
+       0,     0,    11,    12,    13,     0,    47,     0,     0,    31,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    59,     0,     0,     0,     0,    15,     0,
+       0,    14,    49,    52,     0,     0,    35,    37,     0,    39,
+      38,    36,    43,    50,    51,     0,    57,    60,    61,    48,
+      62,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      58,    16,    17,     0,    33,    34,    41,    40,    45,    44,
+       0,     0,     0,    32,    42,    46
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yysigned_char yydefgoto[] =
+{
+      -1,     1,    13,    42,    14,    15,    16,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
+      30,    31,    32,    33
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -26
+static const yysigned_char yypact[] =
+{
+     -26,     2,   -26,   -26,   -25,   -13,    -8,     0,     1,    18,
+      18,    18,   -26,    -1,    26,     3,   -26,   -26,   -26,   -26,
+      10,   -26,   -26,    16,   -26,   -26,    -9,   -26,    17,   -26,
+     -26,   -26,    31,   -26,   -26,   -26,    33,   -26,    34,   -11,
+       4,    21,   -26,   -26,   -26,    18,   -26,    23,    24,   -26,
+      25,    27,    29,    30,    32,    35,    36,    37,    38,    39,
+      40,    41,    42,   -26,    44,    45,    46,    47,   -26,    28,
+      48,   -26,   -26,   -26,    22,    50,   -26,   -26,    51,     5,
+     -26,   -26,    15,   -26,   -26,    49,   -26,   -26,   -26,   -26,
+     -26,    54,    55,    56,    57,    58,    59,    61,    62,    64,
+     -26,   -26,   -26,    63,   -26,   -26,   -26,    43,   -26,    65,
+      67,    68,    69,   -26,   -26,   -26
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const yysigned_char yypgoto[] =
+{
+     -26,   -26,   -26,   -10,   -26,   -26,   -26,   -26,   -26,   -26,
+     -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,
+     -26,   -26,   -26,   -26
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If zero, do what YYDEFACT says.
+   If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -1
+static const unsigned char yytable[] =
+{
+      43,    44,     2,     3,    34,     4,     5,    59,    49,    50,
+      51,    52,    53,    54,    55,    56,    35,     6,    96,    68,
+       7,    36,    97,    60,     8,     9,    10,    11,    98,    37,
+      38,    45,    99,    12,    69,    71,    61,    62,    63,    64,
+      46,    47,    57,    48,    39,    40,    41,    65,    58,    66,
+      67,    70,    72,    73,    93,    74,   111,    75,    76,     0,
+      77,    91,    78,     0,    79,    80,    81,    82,    83,    84,
+       0,    85,    86,    87,    88,    89,    90,     0,   112,   100,
+       0,    92,    94,    95,   101,   102,   103,   104,   105,   106,
+     107,     0,   108,   109,     0,   110,   113,     0,   114,   115
+};
+
+static const yysigned_char yycheck[] =
+{
+      10,    11,     0,     1,    29,     3,     4,    16,     5,     6,
+       7,     8,     9,    10,    11,    12,    29,    15,    13,    30,
+      18,    29,    17,    32,    22,    23,    24,    25,    13,    29,
+      29,    32,    17,    31,    30,    45,    19,    20,    21,    22,
+      14,    15,    32,    17,    26,    27,    28,    16,    32,    16,
+      16,    30,    29,    29,    32,    30,    13,    30,    29,    -1,
+      30,    33,    30,    -1,    29,    29,    29,    29,    29,    29,
+      -1,    30,    30,    29,    29,    29,    29,    -1,    13,    30,
+      -1,    33,    32,    32,    30,    30,    30,    30,    30,    30,
+      29,    -1,    30,    29,    -1,    32,    29,    -1,    30,    30
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const unsigned char yystos[] =
+{
+       0,    35,     0,     1,     3,     4,    15,    18,    22,    23,
+      24,    25,    31,    36,    38,    39,    40,    41,    42,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    57,    29,    29,    29,    29,    29,    26,
+      27,    28,    37,    37,    37,    32,    14,    15,    17,     5,
+       6,     7,     8,     9,    10,    11,    12,    32,    32,    16,
+      32,    19,    20,    21,    22,    16,    16,    16,    30,    30,
+      30,    37,    29,    29,    30,    30,    29,    30,    30,    29,
+      29,    29,    29,    29,    29,    30,    30,    29,    29,    29,
+      29,    33,    33,    32,    32,    32,    13,    17,    13,    17,
+      30,    30,    30,    30,    30,    30,    30,    29,    30,    29,
+      32,    13,    13,    29,    30,    30
+};
+
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# if defined (__STDC__) || defined (__cplusplus)
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# endif
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
+
+#define yyerrok		(yyerrstatus = 0)
+#define yyclearin	(yychar = YYEMPTY)
+#define YYEMPTY		(-2)
+#define YYEOF		0
+
+#define YYACCEPT	goto yyacceptlab
+#define YYABORT		goto yyabortlab
+#define YYERROR		goto yyerrlab1
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+
+#define YYFAIL		goto yyerrlab
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)					\
+do								\
+  if (yychar == YYEMPTY && yylen == 1)				\
+    {								\
+      yychar = (Token);						\
+      yylval = (Value);						\
+      yytoken = YYTRANSLATE (yychar);				\
+      YYPOPSTACK;						\
+      goto yybackup;						\
+    }								\
+  else								\
+    { 								\
+      yyerror ("syntax error: cannot back up");\
+      YYERROR;							\
+    }								\
+while (0)
+
+#define YYTERROR	1
+#define YYERRCODE	256
+
+/* YYLLOC_DEFAULT -- Compute the default location (before the actions
+   are run).  */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)         \
+  Current.first_line   = Rhs[1].first_line;      \
+  Current.first_column = Rhs[1].first_column;    \
+  Current.last_line    = Rhs[N].last_line;       \
+  Current.last_column  = Rhs[N].last_column;
+#endif
+
+/* YYLEX -- calling `yylex' with the right arguments.  */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)			\
+do {						\
+  if (yydebug)					\
+    YYFPRINTF Args;				\
+} while (0)
+
+# define YYDSYMPRINT(Args)			\
+do {						\
+  if (yydebug)					\
+    yysymprint Args;				\
+} while (0)
+
+# define YYDSYMPRINTF(Title, Token, Value, Location)		\
+do {								\
+  if (yydebug)							\
+    {								\
+      YYFPRINTF (stderr, "%s ", Title);				\
+      yysymprint (stderr, 					\
+                  Token, Value);	\
+      YYFPRINTF (stderr, "\n");					\
+    }								\
+} while (0)
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (cinluded).                                                   |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_stack_print (short *bottom, short *top)
+#else
+static void
+yy_stack_print (bottom, top)
+    short *bottom;
+    short *top;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (/* Nothing. */; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)				\
+do {								\
+  if (yydebug)							\
+    yy_stack_print ((Bottom), (Top));				\
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_reduce_print (int yyrule)
+#else
+static void
+yy_reduce_print (yyrule)
+    int yyrule;
+#endif
+{
+  int yyi;
+  unsigned int yylineno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+             yyrule - 1, yylineno);
+  /* Print the symbols being reduced, and their result.  */
+  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
+    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
+  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
+}
+
+# define YY_REDUCE_PRINT(Rule)		\
+do {					\
+  if (yydebug)				\
+    yy_reduce_print (Rule);		\
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YYDSYMPRINT(Args)
+# define YYDSYMPRINTF(Title, Token, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef	YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#if YYMAXDEPTH == 0
+# undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined (__GLIBC__) && defined (_STRING_H)
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+static YYSIZE_T
+#   if defined (__STDC__) || defined (__cplusplus)
+yystrlen (const char *yystr)
+#   else
+yystrlen (yystr)
+     const char *yystr;
+#   endif
+{
+  register const char *yys = yystr;
+
+  while (*yys++ != '\0')
+    continue;
+
+  return yys - yystr - 1;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+static char *
+#   if defined (__STDC__) || defined (__cplusplus)
+yystpcpy (char *yydest, const char *yysrc)
+#   else
+yystpcpy (yydest, yysrc)
+     char *yydest;
+     const char *yysrc;
+#   endif
+{
+  register char *yyd = yydest;
+  register const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+#endif /* !YYERROR_VERBOSE */
+
+
+
+#if YYDEBUG
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yysymprint (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  /* Pacify ``unused variable'' warnings.  */
+  (void) yyvaluep;
+
+  if (yytype < YYNTOKENS)
+    {
+      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+# ifdef YYPRINT
+      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+    }
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  switch (yytype)
+    {
+      default:
+        break;
+    }
+  YYFPRINTF (yyoutput, ")");
+}
+
+#endif /* ! YYDEBUG */
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yydestruct (int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yytype, yyvaluep)
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  /* Pacify ``unused variable'' warnings.  */
+  (void) yyvaluep;
+
+  switch (yytype)
+    {
+
+      default:
+        break;
+    }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes.  */
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM);
+# else
+int yyparse ();
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The lookahead symbol.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM)
+# else
+int yyparse (YYPARSE_PARAM)
+  void *YYPARSE_PARAM;
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+  
+  register int yystate;
+  register int yyn;
+  int yyresult;
+  /* Number of tokens to shift before error messages enabled.  */
+  int yyerrstatus;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+
+  /* Three stacks and their tools:
+     `yyss': related to states,
+     `yyvs': related to semantic values,
+     `yyls': related to locations.
+
+     Refer to the stacks thru separate pointers, to allow yyoverflow
+     to reallocate them elsewhere.  */
+
+  /* The state stack.  */
+  short	yyssa[YYINITDEPTH];
+  short *yyss = yyssa;
+  register short *yyssp;
+
+  /* The semantic value stack.  */
+  YYSTYPE yyvsa[YYINITDEPTH];
+  YYSTYPE *yyvs = yyvsa;
+  register YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK   (yyvsp--, yyssp--)
+
+  YYSIZE_T yystacksize = YYINITDEPTH;
+
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
+  /* When reducing, the number of symbols on the RHS of the reduced
+     rule.  */
+  int yylen;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY;		/* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss;
+  yyvsp = yyvs;
+
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed. so pushing a state here evens the stacks.
+     */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+	/* Give user a chance to reallocate the stack. Use copies of
+	   these so that the &'s don't force the real ones into
+	   memory.  */
+	YYSTYPE *yyvs1 = yyvs;
+	short *yyss1 = yyss;
+
+
+	/* Each stack pointer address is followed by the size of the
+	   data in use in that stack, in bytes.  This used to be a
+	   conditional around just the two extra args, but that might
+	   be undefined if yyoverflow is a macro.  */
+	yyoverflow ("parser stack overflow",
+		    &yyss1, yysize * sizeof (*yyssp),
+		    &yyvs1, yysize * sizeof (*yyvsp),
+
+		    &yystacksize);
+
+	yyss = yyss1;
+	yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyoverflowlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+	goto yyoverflowlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+	yystacksize = YYMAXDEPTH;
+
+      {
+	short *yyss1 = yyss;
+	union yyalloc *yyptr =
+	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+	if (! yyptr)
+	  goto yyoverflowlab;
+	YYSTACK_RELOCATE (yyss);
+	YYSTACK_RELOCATE (yyvs);
+
+#  undef YYSTACK_RELOCATE
+	if (yyss1 != yyssa)
+	  YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+		  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+	YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+/* Do appropriate processing given the current state.  */
+/* Read a lookahead token if we need one and don't already have one.  */
+/* yyresume: */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+
+  yyn = yypact[yystate];
+  if (yyn == YYPACT_NINF)
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = YYLEX;
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yyn == 0 || yyn == YYTABLE_NINF)
+	goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Shift the lookahead token.  */
+  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
+
+  /* Discard the token being shifted unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
+
+  *++yyvsp = yylval;
+
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     `$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 3:
+#line 80 "../hotplug/yacc_config.y"
+    {
+		    adjust_list_t **tail = &root_adjust;
+		    while (*tail != NULL) tail = &(*tail)->next;
+		    *tail = yyvsp[0].adjust;
+		}
+    break;
+
+  case 4:
+#line 86 "../hotplug/yacc_config.y"
+    {
+		    yyvsp[0].device->next = root_device;
+		    root_device = yyvsp[0].device;
+		}
+    break;
+
+  case 5:
+#line 91 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[0].mtd->mtd_type == 0) {
+			yyerror("no ID method for '%s'", yyvsp[0].mtd->name);
+			YYERROR;
+		    }
+		    if (yyvsp[0].mtd->module == NULL) {
+			yyerror("no MTD module for '%s'", yyvsp[0].mtd->name);
+			YYERROR;
+		    }
+		    yyvsp[0].mtd->next = root_mtd;
+		    root_mtd = yyvsp[0].mtd;
+		}
+    break;
+
+  case 6:
+#line 104 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[0].card->ident_type == 0) {
+			yyerror("no ID method for '%s'", yyvsp[0].card->name);
+			YYERROR;
+		    }
+		    if (yyvsp[0].card->bindings == 0) {
+			yyerror("no driver bindings for '%s'", yyvsp[0].card->name);
+			YYERROR;
+		    }
+		    if (yyvsp[0].card->ident_type == FUNC_IDENT) {
+			yyvsp[0].card->next = root_func;
+			root_func = yyvsp[0].card;
+		    } else {
+			yyvsp[0].card->next = root_card;
+			root_card = yyvsp[0].card;
+		    }
+		}
+    break;
+
+  case 11:
+#line 128 "../hotplug/yacc_config.y"
+    {
+		    yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;
+		    yyval.adjust = yyvsp[0].adjust;
+		}
+    break;
+
+  case 12:
+#line 133 "../hotplug/yacc_config.y"
+    {
+		    yyvsp[0].adjust->adj.Action = REMOVE_MANAGED_RESOURCE;
+		    yyval.adjust = yyvsp[0].adjust;
+		}
+    break;
+
+  case 13:
+#line 138 "../hotplug/yacc_config.y"
+    {
+		    yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;
+		    yyvsp[0].adjust->adj.Attributes |= RES_RESERVED;
+		    yyval.adjust = yyvsp[0].adjust;
+		}
+    break;
+
+  case 14:
+#line 144 "../hotplug/yacc_config.y"
+    {
+		    yyvsp[0].adjust->adj.Action = yyvsp[-2].adjust->adj.Action;
+		    yyvsp[0].adjust->adj.Attributes = yyvsp[-2].adjust->adj.Attributes;
+		    yyvsp[0].adjust->next = yyvsp[-2].adjust;
+		    yyval.adjust = yyvsp[0].adjust;
+		}
+    break;
+
+  case 15:
+#line 153 "../hotplug/yacc_config.y"
+    {
+		    yyval.adjust = calloc(sizeof(adjust_list_t), 1);
+		    yyval.adjust->adj.Resource = RES_IRQ;
+		    yyval.adjust->adj.resource.irq.IRQ = yyvsp[0].num;
+		}
+    break;
+
+  case 16:
+#line 159 "../hotplug/yacc_config.y"
+    {
+		    if ((yyvsp[0].num < yyvsp[-2].num) || (yyvsp[0].num > 0xffff)) {
+			yyerror("invalid port range 0x%x-0x%x", yyvsp[-2].num, yyvsp[0].num);
+			YYERROR;
+		    }
+		    yyval.adjust = calloc(sizeof(adjust_list_t), 1);
+		    yyval.adjust->adj.Resource = RES_IO_RANGE;
+		    yyval.adjust->adj.resource.io.BasePort = yyvsp[-2].num;
+		    yyval.adjust->adj.resource.io.NumPorts = yyvsp[0].num - yyvsp[-2].num + 1;
+		}
+    break;
+
+  case 17:
+#line 170 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[0].num < yyvsp[-2].num) {
+			yyerror("invalid address range 0x%x-0x%x", yyvsp[-2].num, yyvsp[0].num);
+			YYERROR;
+		    }
+		    yyval.adjust = calloc(sizeof(adjust_list_t), 1);
+		    yyval.adjust->adj.Resource = RES_MEMORY_RANGE;
+		    yyval.adjust->adj.resource.memory.Base = yyvsp[-2].num;
+		    yyval.adjust->adj.resource.memory.Size = yyvsp[0].num - yyvsp[-2].num + 1;
+		}
+    break;
+
+  case 18:
+#line 183 "../hotplug/yacc_config.y"
+    {
+		    yyval.device = calloc(sizeof(device_info_t), 1);
+		    yyval.device->refs = 1;
+		    strcpy(yyval.device->dev_info, yyvsp[0].str);
+		    free(yyvsp[0].str);
+		}
+    break;
+
+  case 22:
+#line 195 "../hotplug/yacc_config.y"
+    {
+		    yyval.card = calloc(sizeof(card_info_t), 1);
+		    yyval.card->refs = 1;
+		    yyval.card->name = yyvsp[0].str;
+		}
+    break;
+
+  case 31:
+#line 211 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-1].card->ident_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-1].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-1].card->ident_type = BLANK_IDENT;
+		    blank_card = yyvsp[-1].card;
+		}
+    break;
+
+  case 32:
+#line 222 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-6].card->ident_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-6].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-6].card->ident_type = TUPLE_IDENT;
+		    yyvsp[-6].card->id.tuple.code = yyvsp[-4].num;
+		    yyvsp[-6].card->id.tuple.ofs = yyvsp[-2].num;
+		    yyvsp[-6].card->id.tuple.info = yyvsp[0].str;
+		}
+    break;
+
+  case 33:
+#line 235 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-4].card->ident_type & (EXCL_IDENT|MANFID_IDENT)) {
+			yyerror("ID method already defined for '%s'", yyvsp[-4].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-4].card->ident_type |= MANFID_IDENT;
+		    yyvsp[-4].card->manfid.manf = yyvsp[-2].num;
+		    yyvsp[-4].card->manfid.card = yyvsp[0].num;
+		}
+    break;
+
+  case 34:
+#line 246 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-4].card->ident_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-4].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-4].card->ident_type = PCI_IDENT;
+		    yyvsp[-4].card->manfid.manf = yyvsp[-2].num;
+		    yyvsp[-4].card->manfid.card = yyvsp[0].num;
+		}
+    break;
+
+  case 35:
+#line 257 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].card->ident_type & (EXCL_IDENT|VERS_1_IDENT)) {
+			yyerror("ID method already defined for '%s'", yyvsp[-2].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-2].card->ident_type |= VERS_1_IDENT;
+		    yyvsp[-2].card->id.vers.ns = 1;
+		    yyvsp[-2].card->id.vers.pi[0] = yyvsp[0].str;
+		}
+    break;
+
+  case 36:
+#line 267 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].card->id.vers.ns == 4) {
+			yyerror("too many version strings for '%s'", yyvsp[-2].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-2].card->id.vers.pi[yyvsp[-2].card->id.vers.ns] = yyvsp[0].str;
+		    yyvsp[-2].card->id.vers.ns++;
+		}
+    break;
+
+  case 37:
+#line 278 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].card->ident_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-2].card->name);
+			YYERROR;
+		    }
+		    yyvsp[-2].card->ident_type = FUNC_IDENT;
+		    yyvsp[-2].card->id.func.funcid = yyvsp[0].num;
+		}
+    break;
+
+  case 38:
+#line 289 "../hotplug/yacc_config.y"
+    { yyvsp[-2].card->cis_file = strdup(yyvsp[0].str); }
+    break;
+
+  case 39:
+#line 293 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-2].card, yyvsp[0].str, NULL, 0) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 40:
+#line 298 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-4].card, yyvsp[-2].str, yyvsp[0].str, 0) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 41:
+#line 303 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-4].card, yyvsp[-2].str, NULL, yyvsp[0].num) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 42:
+#line 308 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-6].card, yyvsp[-4].str, yyvsp[-2].str, yyvsp[0].num) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 43:
+#line 313 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-2].card, yyvsp[0].str, NULL, 0) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 44:
+#line 318 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-4].card, yyvsp[-2].str, yyvsp[0].str, 0) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 45:
+#line 323 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-4].card, yyvsp[-2].str, NULL, yyvsp[0].num) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 46:
+#line 328 "../hotplug/yacc_config.y"
+    {
+		    if (add_binding(yyvsp[-6].card, yyvsp[-4].str, yyvsp[-2].str, yyvsp[0].num) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 47:
+#line 335 "../hotplug/yacc_config.y"
+    {
+		    yyvsp[-1].device->needs_mtd = 1;
+		}
+    break;
+
+  case 48:
+#line 341 "../hotplug/yacc_config.y"
+    {
+		    device_info_t *d;
+		    int i, found = 0;
+		    for (d = root_device; d; d = d->next) {
+			for (i = 0; i < d->modules; i++)
+			    if (strcmp(yyvsp[-2].str, d->module[i]) == 0) break;
+			if (i < d->modules) {
+			    if (d->opts[i])
+				free(d->opts[i]);
+			    d->opts[i] = strdup(yyvsp[0].str);
+			    found = 1;
+			}
+		    }
+		    if (!found) {
+			yyerror("module name '%s' not found", yyvsp[-2].str);
+			free(yyvsp[-2].str); free(yyvsp[0].str);
+			YYERROR;
+		    }
+		    free(yyvsp[-2].str); free(yyvsp[0].str);
+		}
+    break;
+
+  case 49:
+#line 364 "../hotplug/yacc_config.y"
+    {
+		    if (add_module(yyvsp[-2].device, yyvsp[0].str) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 50:
+#line 369 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].device->opts[yyvsp[-2].device->modules-1] == NULL) {
+			yyvsp[-2].device->opts[yyvsp[-2].device->modules-1] = yyvsp[0].str;
+		    } else {
+			yyerror("too many module options for '%s'",
+				yyvsp[-2].device->module[yyvsp[-2].device->modules-1]);
+			YYERROR;
+		    }
+		}
+    break;
+
+  case 51:
+#line 379 "../hotplug/yacc_config.y"
+    {
+		    if (add_module(yyvsp[-2].device, yyvsp[0].str) != 0)
+			YYERROR;
+		}
+    break;
+
+  case 52:
+#line 386 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].device->class != NULL) {
+			yyerror("extra class string '%s'", yyvsp[0].str);
+			YYERROR;
+		    }
+		    yyvsp[-2].device->class = yyvsp[0].str;
+		}
+    break;
+
+  case 53:
+#line 396 "../hotplug/yacc_config.y"
+    {
+		    yyval.mtd = calloc(sizeof(mtd_ident_t), 1);
+		    yyval.mtd->refs = 1;
+		    yyval.mtd->name = yyvsp[0].str;
+		}
+    break;
+
+  case 57:
+#line 407 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].mtd->mtd_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-2].mtd->name);
+			YYERROR;
+		    }
+		    yyvsp[-2].mtd->mtd_type = DTYPE_MTD;
+		    yyvsp[-2].mtd->dtype = yyvsp[0].num;
+		}
+    break;
+
+  case 58:
+#line 418 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-3].mtd->mtd_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-3].mtd->name);
+			YYERROR;
+		    }
+		    yyvsp[-3].mtd->mtd_type = JEDEC_MTD;
+		    yyvsp[-3].mtd->jedec_mfr = yyvsp[-1].num;
+		    yyvsp[-3].mtd->jedec_info = yyvsp[0].num;
+		}
+    break;
+
+  case 59:
+#line 430 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-1].mtd->mtd_type) {
+			yyerror("ID method already defined for '%s'", yyvsp[-1].mtd->name);
+			YYERROR;
+		    }
+		    if (default_mtd) {
+			yyerror("Default MTD already defined");
+			YYERROR;
+		    }
+		    yyvsp[-1].mtd->mtd_type = DEFAULT_MTD;
+		    default_mtd = yyvsp[-1].mtd;
+		}
+    break;
+
+  case 60:
+#line 445 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].mtd->module != NULL) {
+			yyerror("extra MTD entry for '%s'", yyvsp[-2].mtd->name);
+			YYERROR;
+		    }
+		    yyvsp[-2].mtd->module = yyvsp[0].str;
+		}
+    break;
+
+  case 61:
+#line 453 "../hotplug/yacc_config.y"
+    {
+		    if (yyvsp[-2].mtd->opts == NULL) {
+			yyvsp[-2].mtd->opts = yyvsp[0].str;
+		    } else {
+			yyerror("too many module options for '%s'", yyvsp[-2].mtd->module);
+			YYERROR;
+		    }
+		}
+    break;
+
+  case 62:
+#line 464 "../hotplug/yacc_config.y"
+    {
+		    mtd_ident_t *m;
+		    int found = 0;
+		    for (m = root_mtd; m; m = m->next)
+			if (strcmp(yyvsp[-2].str, m->module) == 0) break;
+		    if (m) {
+			if (m->opts) free(m->opts);
+			m->opts = strdup(yyvsp[0].str);
+			found = 1;
+		    }
+		    free(yyvsp[-2].str); free(yyvsp[0].str);
+		    if (!found) {
+			yyerror("MTD name '%s' not found", yyvsp[-2].str);
+			YYERROR;
+		    }
+		}
+    break;
+
+
+    }
+
+/* Line 999 of yacc.c.  */
+#line 1655 "../hotplug/yacc_config.c"
+
+  yyvsp -= yylen;
+  yyssp -= yylen;
+
+
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+
+
+  /* Now `shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if YYERROR_VERBOSE
+      yyn = yypact[yystate];
+
+      if (YYPACT_NINF < yyn && yyn < YYLAST)
+	{
+	  YYSIZE_T yysize = 0;
+	  int yytype = YYTRANSLATE (yychar);
+	  char *yymsg;
+	  int yyx, yycount;
+
+	  yycount = 0;
+	  /* Start YYX at -YYN if negative to avoid negative indexes in
+	     YYCHECK.  */
+	  for (yyx = yyn < 0 ? -yyn : 0;
+	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
+	  yysize += yystrlen ("syntax error, unexpected ") + 1;
+	  yysize += yystrlen (yytname[yytype]);
+	  yymsg = (char *) YYSTACK_ALLOC (yysize);
+	  if (yymsg != 0)
+	    {
+	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
+	      yyp = yystpcpy (yyp, yytname[yytype]);
+
+	      if (yycount < 5)
+		{
+		  yycount = 0;
+		  for (yyx = yyn < 0 ? -yyn : 0;
+		       yyx < (int) (sizeof (yytname) / sizeof (char *));
+		       yyx++)
+		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+		      {
+			const char *yyq = ! yycount ? ", expecting " : " or ";
+			yyp = yystpcpy (yyp, yyq);
+			yyp = yystpcpy (yyp, yytname[yyx]);
+			yycount++;
+		      }
+		}
+	      yyerror (yymsg);
+	      YYSTACK_FREE (yymsg);
+	    }
+	  else
+	    yyerror ("syntax error; also virtual memory exhausted");
+	}
+      else
+#endif /* YYERROR_VERBOSE */
+	yyerror ("syntax error");
+    }
+
+
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+	 error, discard it.  */
+
+      /* Return failure if at end of input.  */
+      if (yychar == YYEOF)
+        {
+	  /* Pop the error token.  */
+          YYPOPSTACK;
+	  /* Pop the rest of the stack.  */
+	  while (yyss < yyssp)
+	    {
+	      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+	      yydestruct (yystos[*yyssp], yyvsp);
+	      YYPOPSTACK;
+	    }
+	  YYABORT;
+        }
+
+      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
+      yydestruct (yytoken, &yylval);
+      yychar = YYEMPTY;
+
+    }
+
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*----------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action.  |
+`----------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (yyn != YYPACT_NINF)
+	{
+	  yyn += YYTERROR;
+	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+	    {
+	      yyn = yytable[yyn];
+	      if (0 < yyn)
+		break;
+	    }
+	}
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+	YYABORT;
+
+      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+      yydestruct (yystos[yystate], yyvsp);
+      yyvsp--;
+      yystate = *--yyssp;
+
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  YYDPRINTF ((stderr, "Shifting error token, "));
+
+  *++yyvsp = yylval;
+
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#ifndef yyoverflow
+/*----------------------------------------------.
+| yyoverflowlab -- parser overflow comes here.  |
+`----------------------------------------------*/
+yyoverflowlab:
+  yyerror ("parser stack overflow");
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+  return yyresult;
+}
+
+
+#line 482 "../hotplug/yacc_config.y"
+
+void yyerror(char *msg, ...)
+{
+     va_list ap;
+     char str[256];
+
+     va_start(ap, msg);
+     sprintf(str, "error in file '%s' line %d: ",
+	     current_file, current_lineno);
+     vsprintf(str+strlen(str), msg, ap);
+#if YYDEBUG
+     fprintf(stderr, "%s\n", str);
+#else
+     syslog(LOG_ERR, "%s", str);
+#endif
+     va_end(ap);
+}
+
+static int add_binding(card_info_t *card, char *name, char *class, int fn)
+{
+    device_info_t *dev = root_device;
+    if (card->bindings == MAX_BINDINGS) {
+	yyerror("too many bindings\n");
+	return -1;
+    }
+    for (; dev; dev = dev->next)
+	if (strcmp((char *)dev->dev_info, name) == 0) break;
+    if (dev == NULL) {
+	yyerror("unknown device '%s'", name);
+	return -1;
+    }
+    card->device[card->bindings] = dev;
+    card->dev_fn[card->bindings] = fn;
+    if (class)
+	card->class[card->bindings] = strdup(class);
+    card->bindings++;
+    free(name);
+    return 0;
+}
+
+static int add_module(device_info_t *dev, char *name)
+{
+    if (dev->modules == MAX_MODULES) {
+	yyerror("too many modules for '%s'", dev->dev_info);
+	return -1;
+    }
+    dev->module[dev->modules] = name;
+    dev->opts[dev->modules] = NULL;
+    dev->modules++;
+    return 0;
+}
+
+#if YYDEBUG
+adjust_list_t *root_adjust = NULL;
+device_info_t *root_device = NULL;
+card_info_t *root_card = NULL, *blank_card = NULL, *root_func = NULL;
+mtd_ident_t *root_mtd = NULL, *default_mtd = NULL;
+
+void main(int argc, char *argv[])
+{
+    yydebug = 1;
+    if (argc > 1)
+	parse_configfile(argv[1]);
+}
+#endif
+
diff -urN busybox.orig/hotplug/yacc_config.h busybox/hotplug/yacc_config.h
--- busybox.orig/hotplug/yacc_config.h	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/yacc_config.h	2004-04-17 03:29:50.000000000 -0600
@@ -0,0 +1,116 @@
+/* A Bison parser, made by GNU Bison 1.875a.  */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     DEVICE = 258,
+     CARD = 259,
+     ANONYMOUS = 260,
+     TUPLE = 261,
+     MANFID = 262,
+     VERSION = 263,
+     FUNCTION = 264,
+     PCI = 265,
+     BIND = 266,
+     CIS = 267,
+     TO = 268,
+     NEEDS_MTD = 269,
+     MODULE = 270,
+     OPTS = 271,
+     CLASS = 272,
+     REGION = 273,
+     JEDEC = 274,
+     DTYPE = 275,
+     DEFAULT = 276,
+     MTD = 277,
+     INCLUDE = 278,
+     EXCLUDE = 279,
+     RESERVE = 280,
+     IRQ_NO = 281,
+     PORT = 282,
+     MEMORY = 283,
+     STRING = 284,
+     NUMBER = 285,
+     SOURCE = 286
+   };
+#endif
+#define DEVICE 258
+#define CARD 259
+#define ANONYMOUS 260
+#define TUPLE 261
+#define MANFID 262
+#define VERSION 263
+#define FUNCTION 264
+#define PCI 265
+#define BIND 266
+#define CIS 267
+#define TO 268
+#define NEEDS_MTD 269
+#define MODULE 270
+#define OPTS 271
+#define CLASS 272
+#define REGION 273
+#define JEDEC 274
+#define DTYPE 275
+#define DEFAULT 276
+#define MTD 277
+#define INCLUDE 278
+#define EXCLUDE 279
+#define RESERVE 280
+#define IRQ_NO 281
+#define PORT 282
+#define MEMORY 283
+#define STRING 284
+#define NUMBER 285
+#define SOURCE 286
+
+
+
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 61 "hotplug/yacc_config.y"
+typedef union YYSTYPE {
+    char *str;
+    u_long num;
+    struct device_info_t *device;
+    struct card_info_t *card;
+    struct mtd_ident_t *mtd;
+    struct adjust_list_t *adjust;
+} YYSTYPE;
+/* Line 1240 of yacc.c.  */
+#line 108 "hotplug/yacc_config.h"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
+
+
diff -urN busybox.orig/hotplug/yacc_config.y busybox/hotplug/yacc_config.y
--- busybox.orig/hotplug/yacc_config.y	1969-12-31 17:00:00.000000000 -0700
+++ busybox/hotplug/yacc_config.y	2004-04-17 03:29:17.000000000 -0600
@@ -0,0 +1,546 @@
+%{
+/*
+ * yacc_config.y 1.59 2003/06/12 07:24:27
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License. 
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+    
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+#include <sys/types.h>
+
+#include "pcmcia.h"
+#include "cardmgr.h"
+
+/* If bison: generate nicer error messages */ 
+#define YYERROR_VERBOSE 1
+ 
+/* from lex_config, for nice error messages */
+extern char *current_file;
+extern int current_lineno;
+
+void yyerror(char *msg, ...);
+
+static int add_binding(card_info_t *card, char *name, char *class, int fn);
+static int add_module(device_info_t *card, char *name);
+
+%}
+
+%token DEVICE CARD ANONYMOUS TUPLE MANFID VERSION FUNCTION PCI
+%token BIND CIS TO NEEDS_MTD MODULE OPTS CLASS
+%token REGION JEDEC DTYPE DEFAULT MTD
+%token INCLUDE EXCLUDE RESERVE IRQ_NO PORT MEMORY
+%token STRING NUMBER SOURCE
+
+%union {
+    char *str;
+    u_long num;
+    struct device_info_t *device;
+    struct card_info_t *card;
+    struct mtd_ident_t *mtd;
+    struct adjust_list_t *adjust;
+}
+
+%type <str> STRING
+%type <num> NUMBER
+%type <adjust> adjust resource
+%type <device> device needs_mtd module class
+%type <card> card anonymous tuple manfid pci version function bind cis
+%type <mtd> region jedec dtype default mtd
+%%
+
+list:	  /* nothing */
+	| list adjust
+		{
+		    adjust_list_t **tail = &root_adjust;
+		    while (*tail != NULL) tail = &(*tail)->next;
+		    *tail = $2;
+		}
+	| list device
+		{
+		    $2->next = root_device;
+		    root_device = $2;
+		}
+	| list mtd
+		{
+		    if ($2->mtd_type == 0) {
+			yyerror("no ID method for '%s'", $2->name);
+			YYERROR;
+		    }
+		    if ($2->module == NULL) {
+			yyerror("no MTD module for '%s'", $2->name);
+			YYERROR;
+		    }
+		    $2->next = root_mtd;
+		    root_mtd = $2;
+		}
+	| list card
+		{
+		    if ($2->ident_type == 0) {
+			yyerror("no ID method for '%s'", $2->name);
+			YYERROR;
+		    }
+		    if ($2->bindings == 0) {
+			yyerror("no driver bindings for '%s'", $2->name);
+			YYERROR;
+		    }
+		    if ($2->ident_type == FUNC_IDENT) {
+			$2->next = root_func;
+			root_func = $2;
+		    } else {
+			$2->next = root_card;
+			root_card = $2;
+		    }
+		}
+	| list opts
+	| list mtd_opts
+	| list SOURCE
+	| list error
+	;
+
+adjust:   INCLUDE resource
+		{
+		    $2->adj.Action = ADD_MANAGED_RESOURCE;
+		    $$ = $2;
+		}
+	| EXCLUDE resource
+		{
+		    $2->adj.Action = REMOVE_MANAGED_RESOURCE;
+		    $$ = $2;
+		}
+	| RESERVE resource
+		{
+		    $2->adj.Action = ADD_MANAGED_RESOURCE;
+		    $2->adj.Attributes |= RES_RESERVED;
+		    $$ = $2;
+		}
+	| adjust ',' resource
+		{
+		    $3->adj.Action = $1->adj.Action;
+		    $3->adj.Attributes = $1->adj.Attributes;
+		    $3->next = $1;
+		    $$ = $3;
+		}
+	;
+
+resource: IRQ_NO NUMBER
+		{
+		    $$ = calloc(sizeof(adjust_list_t), 1);
+		    $$->adj.Resource = RES_IRQ;
+		    $$->adj.resource.irq.IRQ = $2;
+		}
+	| PORT NUMBER '-' NUMBER
+		{
+		    if (($4 < $2) || ($4 > 0xffff)) {
+			yyerror("invalid port range 0x%x-0x%x", $2, $4);
+			YYERROR;
+		    }
+		    $$ = calloc(sizeof(adjust_list_t), 1);
+		    $$->adj.Resource = RES_IO_RANGE;
+		    $$->adj.resource.io.BasePort = $2;
+		    $$->adj.resource.io.NumPorts = $4 - $2 + 1;
+		}
+	| MEMORY NUMBER '-' NUMBER
+		{
+		    if ($4 < $2) {
+			yyerror("invalid address range 0x%x-0x%x", $2, $4);
+			YYERROR;
+		    }
+		    $$ = calloc(sizeof(adjust_list_t), 1);
+		    $$->adj.Resource = RES_MEMORY_RANGE;
+		    $$->adj.resource.memory.Base = $2;
+		    $$->adj.resource.memory.Size = $4 - $2 + 1;
+		}
+	;
+
+device:	  DEVICE STRING
+		{
+		    $$ = calloc(sizeof(device_info_t), 1);
+		    $$->refs = 1;
+		    strcpy($$->dev_info, $2);
+		    free($2);
+		}
+	| needs_mtd
+	| module
+	| class
+	;
+
+card:	  CARD STRING
+		{
+		    $$ = calloc(sizeof(card_info_t), 1);
+		    $$->refs = 1;
+		    $$->name = $2;
+		}
+	| anonymous
+	| tuple
+	| manfid
+	| pci
+	| version
+	| function
+	| bind
+	| cis
+	;
+
+anonymous: card ANONYMOUS
+		{
+		    if ($1->ident_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->ident_type = BLANK_IDENT;
+		    blank_card = $1;
+		}
+	;
+
+tuple:	  card TUPLE NUMBER ',' NUMBER ',' STRING
+		{
+		    if ($1->ident_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->ident_type = TUPLE_IDENT;
+		    $1->id.tuple.code = $3;
+		    $1->id.tuple.ofs = $5;
+		    $1->id.tuple.info = $7;
+		}
+	;
+
+manfid:	  card MANFID NUMBER ',' NUMBER
+		{
+		    if ($1->ident_type & (EXCL_IDENT|MANFID_IDENT)) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->ident_type |= MANFID_IDENT;
+		    $1->manfid.manf = $3;
+		    $1->manfid.card = $5;
+		}
+
+pci:	  card PCI NUMBER ',' NUMBER
+		{
+		    if ($1->ident_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->ident_type = PCI_IDENT;
+		    $1->manfid.manf = $3;
+		    $1->manfid.card = $5;
+		}
+
+version:  card VERSION STRING
+		{
+		    if ($1->ident_type & (EXCL_IDENT|VERS_1_IDENT)) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->ident_type |= VERS_1_IDENT;
+		    $1->id.vers.ns = 1;
+		    $1->id.vers.pi[0] = $3;
+		}
+	| version ',' STRING
+		{
+		    if ($1->id.vers.ns == 4) {
+			yyerror("too many version strings for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->id.vers.pi[$1->id.vers.ns] = $3;
+		    $1->id.vers.ns++;
+		}
+	;
+
+function: card FUNCTION NUMBER
+		{
+		    if ($1->ident_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->ident_type = FUNC_IDENT;
+		    $1->id.func.funcid = $3;
+		}
+	;
+
+cis:	  card CIS STRING
+		{ $1->cis_file = strdup($3); }
+	;
+
+bind:	  card BIND STRING
+		{
+		    if (add_binding($1, $3, NULL, 0) != 0)
+			YYERROR;
+		}
+	| card BIND STRING CLASS STRING
+		{
+		    if (add_binding($1, $3, $5, 0) != 0)
+			YYERROR;
+		}
+	| card BIND STRING TO NUMBER
+		{
+		    if (add_binding($1, $3, NULL, $5) != 0)
+			YYERROR;
+		}
+	| card BIND STRING CLASS STRING TO NUMBER
+		{
+		    if (add_binding($1, $3, $5, $7) != 0)
+			YYERROR;
+		}
+	| bind ',' STRING
+		{
+		    if (add_binding($1, $3, NULL, 0) != 0)
+			YYERROR;
+		}
+	| bind ',' STRING CLASS STRING
+		{
+		    if (add_binding($1, $3, $5, 0) != 0)
+			YYERROR;
+		}
+	| bind ',' STRING TO NUMBER
+		{
+		    if (add_binding($1, $3, NULL, $5) != 0)
+			YYERROR;
+		}
+	| bind ',' STRING CLASS STRING TO NUMBER
+		{
+		    if (add_binding($1, $3, $5, $7) != 0)
+			YYERROR;
+		}
+	;
+
+needs_mtd: device NEEDS_MTD
+		{
+		    $1->needs_mtd = 1;
+		}
+	;
+
+opts:	  MODULE STRING OPTS STRING
+		{
+		    device_info_t *d;
+		    int i, found = 0;
+		    for (d = root_device; d; d = d->next) {
+			for (i = 0; i < d->modules; i++)
+			    if (strcmp($2, d->module[i]) == 0) break;
+			if (i < d->modules) {
+			    if (d->opts[i])
+				free(d->opts[i]);
+			    d->opts[i] = strdup($4);
+			    found = 1;
+			}
+		    }
+		    if (!found) {
+			yyerror("module name '%s' not found", $2);
+			free($2); free($4);
+			YYERROR;
+		    }
+		    free($2); free($4);
+		}
+	;
+
+module:	  device MODULE STRING
+		{
+		    if (add_module($1, $3) != 0)
+			YYERROR;
+		}
+	| module OPTS STRING
+		{
+		    if ($1->opts[$1->modules-1] == NULL) {
+			$1->opts[$1->modules-1] = $3;
+		    } else {
+			yyerror("too many module options for '%s'",
+				$1->module[$1->modules-1]);
+			YYERROR;
+		    }
+		}
+	| module ',' STRING
+		{
+		    if (add_module($1, $3) != 0)
+			YYERROR;
+		}
+	;
+
+class:	  device CLASS STRING
+		{
+		    if ($1->class != NULL) {
+			yyerror("extra class string '%s'", $3);
+			YYERROR;
+		    }
+		    $1->class = $3;
+		}
+	;
+
+region:	  REGION STRING
+		{
+		    $$ = calloc(sizeof(mtd_ident_t), 1);
+		    $$->refs = 1;
+		    $$->name = $2;
+		}
+	| dtype
+	| jedec
+	| default
+	;
+
+dtype:	  region DTYPE NUMBER
+		{
+		    if ($1->mtd_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->mtd_type = DTYPE_MTD;
+		    $1->dtype = $3;
+		}
+	;
+
+jedec:	  region JEDEC NUMBER NUMBER
+		{
+		    if ($1->mtd_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->mtd_type = JEDEC_MTD;
+		    $1->jedec_mfr = $3;
+		    $1->jedec_info = $4;
+		}
+	;
+
+default:  region DEFAULT
+		{
+		    if ($1->mtd_type) {
+			yyerror("ID method already defined for '%s'", $1->name);
+			YYERROR;
+		    }
+		    if (default_mtd) {
+			yyerror("Default MTD already defined");
+			YYERROR;
+		    }
+		    $1->mtd_type = DEFAULT_MTD;
+		    default_mtd = $1;
+		}
+	;
+
+mtd:	  region MTD STRING
+		{
+		    if ($1->module != NULL) {
+			yyerror("extra MTD entry for '%s'", $1->name);
+			YYERROR;
+		    }
+		    $1->module = $3;
+		}
+	| mtd OPTS STRING
+		{
+		    if ($1->opts == NULL) {
+			$1->opts = $3;
+		    } else {
+			yyerror("too many module options for '%s'", $1->module);
+			YYERROR;
+		    }
+		}
+	;
+
+mtd_opts:  MTD STRING OPTS STRING
+		{
+		    mtd_ident_t *m;
+		    int found = 0;
+		    for (m = root_mtd; m; m = m->next)
+			if (strcmp($2, m->module) == 0) break;
+		    if (m) {
+			if (m->opts) free(m->opts);
+			m->opts = strdup($4);
+			found = 1;
+		    }
+		    free($2); free($4);
+		    if (!found) {
+			yyerror("MTD name '%s' not found", $2);
+			YYERROR;
+		    }
+		}
+	;
+
+%%
+void yyerror(char *msg, ...)
+{
+     va_list ap;
+     char str[256];
+
+     va_start(ap, msg);
+     sprintf(str, "error in file '%s' line %d: ",
+	     current_file, current_lineno);
+     vsprintf(str+strlen(str), msg, ap);
+#if YYDEBUG
+     fprintf(stderr, "%s\n", str);
+#else
+     syslog(LOG_ERR, "%s", str);
+#endif
+     va_end(ap);
+}
+
+static int add_binding(card_info_t *card, char *name, char *class, int fn)
+{
+    device_info_t *dev = root_device;
+    if (card->bindings == MAX_BINDINGS) {
+	yyerror("too many bindings\n");
+	return -1;
+    }
+    for (; dev; dev = dev->next)
+	if (strcmp((char *)dev->dev_info, name) == 0) break;
+    if (dev == NULL) {
+	yyerror("unknown device '%s'", name);
+	return -1;
+    }
+    card->device[card->bindings] = dev;
+    card->dev_fn[card->bindings] = fn;
+    if (class)
+	card->class[card->bindings] = strdup(class);
+    card->bindings++;
+    free(name);
+    return 0;
+}
+
+static int add_module(device_info_t *dev, char *name)
+{
+    if (dev->modules == MAX_MODULES) {
+	yyerror("too many modules for '%s'", dev->dev_info);
+	return -1;
+    }
+    dev->module[dev->modules] = name;
+    dev->opts[dev->modules] = NULL;
+    dev->modules++;
+    return 0;
+}
+
+#if YYDEBUG
+adjust_list_t *root_adjust = NULL;
+device_info_t *root_device = NULL;
+card_info_t *root_card = NULL, *blank_card = NULL, *root_func = NULL;
+mtd_ident_t *root_mtd = NULL, *default_mtd = NULL;
+
+void main(int argc, char *argv[])
+{
+    yydebug = 1;
+    if (argc > 1)
+	parse_configfile(argv[1]);
+}
+#endif
diff -urN busybox.orig/include/applets.h busybox/include/applets.h
--- busybox.orig/include/applets.h	2004-04-06 10:59:43.000000000 -0600
+++ busybox/include/applets.h	2004-04-17 03:29:17.000000000 -0600
@@ -85,6 +85,9 @@
 #ifdef CONFIG_CAL
 	APPLET(cal, cal_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
 #endif
+#ifdef CONFIG_CARDMGR
+	APPLET(cardmgr, cardmgr_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
 #ifdef CONFIG_CAT
 	APPLET(cat, cat_main, _BB_DIR_BIN, _BB_SUID_NEVER)
 #endif
@@ -256,6 +259,9 @@
 #ifdef CONFIG_HOSTNAME
 	APPLET(hostname, hostname_main, _BB_DIR_BIN, _BB_SUID_NEVER)
 #endif
+#ifdef CONFIG_HOTPLUG
+	APPLET(hotplug, hotplug_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
 #ifdef CONFIG_HTTPD
 	APPLET(httpd, httpd_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
 #endif
@@ -268,6 +274,9 @@
 #ifdef CONFIG_ID
 	APPLET(id, id_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
 #endif
+#ifdef CONFIG_CARDMGR
+	APPLET(ide_info, ide_info_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
 #ifdef CONFIG_IFCONFIG
 	APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
 #endif
@@ -505,6 +514,9 @@
 #ifdef CONFIG_RX
 	APPLET(rx, rx_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
 #endif
+#ifdef CONFIG_CARDMGR
+	APPLET(scsi_info, scsi_info_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
 #ifdef CONFIG_SED
 	APPLET(sed, sed_main, _BB_DIR_BIN, _BB_SUID_NEVER)
 #endif
diff -urN busybox.orig/include/usage.h busybox/include/usage.h
--- busybox.orig/include/usage.h	2004-04-13 13:27:20.000000000 -0600
+++ busybox/include/usage.h	2004-04-17 03:29:17.000000000 -0600
@@ -110,6 +110,30 @@
        "\t-j\tUse julian dates.\n" \
        "\t-y\tDisplay the entire year."
 
+#define ide_info_trivial_usage \
+	"[device]"
+#define ide_info_full_usage \
+	"Obtain info about an IDE device"
+
+#define scsi_info_trivial_usage \
+	"[device]"
+#define scsi_info_full_usage \
+	"Obtain info about a SCSI device"
+
+#define cardmgr_trivial_usage \
+	"[-qvof] [-c configpath] [-m modpath] [-p pidfile] [-s stabfile]"
+#define cardmgr_full_usage \
+	"PCMCIA device manager.\n\n" \
+	"Options:" \
+	"\n\t-q\tquiet mode" \
+	"\n\t-v\tverbose mode" \
+	"\n\t-f\tforeground, do not fork" \
+	"\n\t-o\tone pass, do not daemonize" \
+	"\n\t-c PATH\tuse PATH to find config database (default /etc/pcmcia)" \
+	"\n\t-m PATH\tuse PATH to find kernel modules" \
+	"\n\t-p FILE\twrite cardmgr pid to FILE (default /var/run/cardmgr.pid)" \
+	"\n\t-s FILE\twrite socket info to FILE (default /var/lib/pcmcia/stab)"
+
 #define cat_trivial_usage \
 	"[-u] [FILE]..."
 #define cat_full_usage \
@@ -975,6 +999,11 @@
 	"$ hostname\n" \
 	"sage\n"
 
+#define hotplug_trivial_usage \
+	""
+#define hotplug_full_usage \
+	"Used by the kernel to process hot plug events."
+
 #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
   #define USAGE_HTTPD_BASIC_AUTH(a) a
   #ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5
diff -urN busybox.orig/sysdeps/linux/Config.in busybox/sysdeps/linux/Config.in
--- busybox.orig/sysdeps/linux/Config.in	2004-03-15 01:29:15.000000000 -0700
+++ busybox/sysdeps/linux/Config.in	2004-04-17 03:29:17.000000000 -0600
@@ -222,6 +222,7 @@
 source debianutils/Config.in
 source editors/Config.in
 source findutils/Config.in
+source hotplug/Config.in
 source init/Config.in
 source loginutils/Config.in
 source miscutils/Config.in
