linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* isapnp.rc
@ 2004-05-03 20:29 Marco d'Itri
  0 siblings, 0 replies; only message in thread
From: Marco d'Itri @ 2004-05-03 20:29 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

I'm attaching a new version of isapnp.rc and a companion aliases file
to be installed as /etc/modprobe.d/isapnp (because this is easier than
writing the kernel patches needed and waiting for Linus to accept them).

The purpose of isapnp.rc is to automatically load the driver modules
needed by non-PCI hardware devices like floppy and rtc to allow udev to
create the /dev nodes.
It only supports 2.6 kernels, but this is probably acceptable because
older kernels do not support udev and can use on-demand modules loading.
(Older versions tried to support 2.4 kernels but this proved very hard
if not impossibile because tools in /usr/bin were required and the
script became too much complex.)

I'm going to add it to the next release of the debian hotplug package.
Comments are welcome.

-- 
ciao, |
Marco | [6102 l'4b7sTdpvT/Q]

[-- Attachment #2: isapnp.rc --]
[-- Type: text/plain, Size: 1434 bytes --]

#!/bin/sh -e
#
# isapnp.rc	synthesizes isapnp hotplug events at boot time
#		it requires a 2.6 kernel with CONFIG_ISAPNP defined
#
#  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.
#	
#  Copyright (C) 2004 Simone Gotti <simone.gotti@email.it>
#  Copyright (C) 2004 Marco d'Itri <md@linux.it>
#

# only 2.6 kernels are supported
[ -d /sys/bus/pnp/devices/ ] || return 0

cd /etc/hotplug
. ./hotplug.functions

isapnp_boot_events()
{
    if [ "$(echo /sys/bus/pnp/devices/*/id)" = "/sys/bus/pnp/devices/*/id" ];
    then
	return 0
    fi

    cat /sys/bus/pnp/devices/*/id \
    | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
    | while read MODULE; do
	# ignore blacklisted devices
	if grep -qi "^$MODULE\$" /etc/hotplug/blacklist; then
	    return 0
	fi

	# see do_pnp_entry() in /usr/src/linux/scripts/file2alias.c
	if $MODPROBE -q pnp:d$MODULE; then
	    mesg "     $MODULE: loaded sucessfully"
	else
	    mesg "     $MODULE: can't be loaded"
	fi
    done
}

# See how we were called.
case "$1" in
    start|restart)
	isapnp_boot_events
	;;
    stop)
	# echo "isapnp stop -- ignored"
	;;
    status)
	# echo "isapnp status -- ignored"
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac


[-- Attachment #3: isapnp.aliases --]
[-- Type: text/plain, Size: 399 bytes --]

# These aliases are used by /etc/hotplug/isapnp.rc and are needed here
# because the modules themselves are not providing them.
alias pnp:dPNP0400 parport_pc
alias pnp:dPNP0401 parport_pc
alias pnp:dPNP0510 irtty-sir
alias pnp:dPNP0511 irtty-sir
alias pnp:dPNP0700 floppy
alias pnp:dPNP0800 pcspkr
alias pnp:dPNP0B00 rtc
alias pnp:dPNP0303 atkbd
alias pnp:dPNP0F13 psmouse
alias pnp:dPNPB02F analog

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-03 20:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-03 20:29 isapnp.rc Marco d'Itri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).