linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simone Gotti <simone.gotti@email.it>
To: linux-hotplug@vger.kernel.org
Subject: Re: Little script for ISAPNP hotplug
Date: Sat, 10 Apr 2004 17:16:29 +0000	[thread overview]
Message-ID: <200404101916.29563.simone.gotti@email.it> (raw)
In-Reply-To: <200404092044.54429.simone.gotti@email.it>

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

On Friday 09 April 2004 20:44, Simone Gotti wrote:

By the way, today I've did the C modules.isapnp parser program.

The program is called "strange but true" isapnpmodules.
it's very simple, as I've used like base the code of usbmodules.

The scripts are 2 and a patch for hotplug.functions:

isapnp.rc 
isapnp.agent
hotplug.functions.patch (the patch is against hotplug-20040401, the latest 
avaible on my gentoo system) 

I've noticed that for the 2.6 kernel is prefered the bash parsing and not the 
use of usbmodules and pcimodules. 
The problem with isapnp is that in a standard PC there are more then 10 isa 
devices so in this way modules.isapnp is parsed a lot of times and all is 
slow (at least 16 seconds). 
Using the isapnpmodules it take not more than 2 seconds. So I've prefered it 
to bash parsing in the 2.6 kernel too.

I don't know it I've do something wrong due to my low level of documentation 
on how isapnp works.

isapnp.rc:
It checks if isapnp exists, then it look for the presence of sysfs. If both 
exists then sysfs data is used. This because sysfs reports the id of the 
isapnpdevice in a "string" form, like PNP0501. And I'm not able to convert it 
in the Vendor and Function hex form with a bash script.

if they don't exists then "procfs" is used. The vendor and function hex value 
are retrieved from "/proc/bus/pnp/devices" and sent to the isapnp.agent

isapnp.agent:
This agent act like the pci agent.

I hope it'll be useful.

Bye!
-- 
Simone Gotti
<simone.gotti@email.it>

[-- Attachment #2: hotplug.functions.patch --]
[-- Type: text/x-diff, Size: 1640 bytes --]

--- hotplug.functions	2004-04-10 18:53:02.000000000 +0200
+++ hotplug.functions.isapnp	2004-04-10 18:50:16.150626368 +0200
@@ -77,14 +77,20 @@
     FILENAME=$2
     DESCRIPTION=$3
 
+	case $TYPE in
+	isapnp)
+		LISTER=`which ${TYPE}modules 2> /dev/null` 
+		;;
+	*)
     # should we use usbmodules, pcimodules?  not on 2.5+, because sysfs
     # ought to expose the data we need to find all candidate drivers.
     # (on 2.5.48 it does for usb; but maybe not yet for pci.)
     case "$KERNEL" in
-    2.2*|2.3*|2.4*)	LISTER=`which ${TYPE}modules` ;;
+    2.2*|2.3*|2.4*)	LISTER=`which ${TYPE}modules 2> /dev/null` ;;
     *)			LISTER="" ;;
     esac
-
+	esac
+	
     if [ "$LISTER" != "" ]; then
 	# lister programs MIGHT be preferable to parsing from shell scripts:
 	# - usbmodules used for (a) multi-interface devices, (b) coldplug
@@ -105,12 +111,30 @@
 	    debug_mesg "pcimodules is scanning more than $PCI_SLOT ..."
 	    DRIVERS=`$LISTER`
 	    ;;
+	isapnp)
+		if [ "$ISAPNP_ID" != "" ]; then 
+		debug_mesg "isapnpmodules is scanning for the ISAPNP Id $ISAPNP_ID ..."
+	    DRIVERS=`$LISTER --id $ISAPNP_ID`
+		elif [ "$ISAPNP_STRING" != "" ]; then 
+		debug_mesg "isapnpmodules is scanning for the ISAPNP String $ISAPNP_STRING ..."
+	    DRIVERS=`$LISTER --string $ISAPNP_STRING`
+		fi
+	    ;;
 	esac
     fi
 
     # try parsing by shell scripts if no luck yet
     if [ "$DRIVERS" = "" ]; then
+	case $TYPE in
+	isapnp)
+		if [ "$LISTER" = "" ]; then
+		${TYPE}_map_modules < $FILENAME
+		fi
+		;;
+	*)
 	${TYPE}_map_modules < $FILENAME
+	;;
+	esac
     fi
 
     # FIXME remove dups and blacklisted modules from $DRIVERS here

[-- Attachment #3: isapnp.agent --]
[-- Type: application/x-shellscript, Size: 2196 bytes --]

[-- Attachment #4: isapnp.rc --]
[-- Type: application/x-shellscript, Size: 2006 bytes --]

[-- Attachment #5: isapnpmodules-0.1.tar.bz2 --]
[-- Type: application/x-tbz, Size: 3151 bytes --]

  reply	other threads:[~2004-04-10 17:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-09 18:44 Little script for ISAPNP hotplug Simone Gotti
2004-04-10 17:16 ` Simone Gotti [this message]
2004-04-11 17:09 ` Simone Gotti
2004-04-12  2:25 ` Alexander E. Patrakov
2004-04-12  9:57 ` Simone Gotti
2004-04-13 15:47 ` Alexander E. Patrakov
2004-04-13 17:06 ` Simone Gotti
2004-04-18 19:10 ` Simone Gotti
2004-04-22 18:14 ` Simone Gotti
2004-04-22 19:28 ` Marco d'Itri
2004-04-23  9:42 ` Simone Gotti
2004-04-23 16:19 ` Bill Nottingham
2004-04-23 16:23 ` Marco d'Itri
2004-04-23 16:30 ` Bill Nottingham
2004-04-24  9:15 ` Simone Gotti
2004-04-24  9:15 ` Simone Gotti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404101916.29563.simone.gotti@email.it \
    --to=simone.gotti@email.it \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).