linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* isapnp coldplug, once again
@ 2004-07-04  6:52 Alexander E. Patrakov
  2004-09-07 17:38 ` Jonathan Lyster
  2004-09-08  4:01 ` Alexander E. Patrakov
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander E. Patrakov @ 2004-07-04  6:52 UTC (permalink / raw)
  To: linux-hotplug

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

A new, reworked version of ISAPNP hardware detection script is attached
as a patch to the hotplug package.

This release is based entirely on Simone Gotti's approach. Simone 
Gotti's approach is preferred because it provides proper blacklist 
support. However, it is unsuitable for Debian because this script uses 
stuff from /usr/bin.

The artificial split into isapnp.rc and isapnp.agent has been removed.
Support for 2.4 kernels has been removed.

Two bugs reported against hotplug-isapnp-0.2.1 by Simone Gotti have been 
fixed:

1) bashism resulting in messages like "[: ==: binary operator expected"
2) wrong behaviour with empty /sys/bus/pnp/devices directory

As usual, this script will work only if the kernel has been compiled
with CONFIG_ISAPNP=y and CONFIG_PNPBIOS=y.

-- 
Alexander E. Patrakov

[-- Attachment #2: hotplug-2004_04_01-isapnp-4.patch --]
[-- Type: text/x-patch, Size: 4340 bytes --]

Submitted By: Alexander E. Patrakov
Date: 2004-07-01
Initial Package Version: 2004_04_01
Origin: based on hotplug-isapnp-0.2.1 by Simone Gotti
Upstream Status: will submit
Description: Includes ISAPNP hardware detection script

diff -urN hotplug-2004_04_01.orig/etc/hotplug/pnp.distmap hotplug-2004_04_01/etc/hotplug/pnp.distmap
--- hotplug-2004_04_01.orig/etc/hotplug/pnp.distmap	1970-01-01 05:00:00.000000000 +0500
+++ hotplug-2004_04_01/etc/hotplug/pnp.distmap	2004-07-01 15:52:19.000000000 +0600
@@ -0,0 +1,9 @@
+# isapnp module      cardvendor carddevice driver_data vendor     function   ...
+irtty-sir            0xffff     0xffff     0x00000000  0xd041     0x1005
+irtty-sir            0xffff     0xffff     0x00000000  0xd041     0x1105
+floppy               0xffff     0xffff     0x00000000  0xd041     0x0007    
+pcspkr               0xffff     0xffff     0x00000000  0xd041     0x0008    
+rtc                  0xffff     0xffff     0x00000000  0xd041     0x000b    
+atkbd                0xffff     0xffff     0x00000000  0xd041     0x0303
+psmouse              0xffff     0xffff     0x00000000  0xd041     0x130f
+analog               0xffff     0xffff     0x00000000  0xd041     0x2fb0
diff -urN hotplug-2004_04_01.orig/etc/hotplug/pnp.rc hotplug-2004_04_01/etc/hotplug/pnp.rc
--- hotplug-2004_04_01.orig/etc/hotplug/pnp.rc	1970-01-01 05:00:00.000000000 +0500
+++ hotplug-2004_04_01/etc/hotplug/pnp.rc	2004-07-01 16:57:34.748992112 +0600
@@ -0,0 +1,115 @@
+#!/bin/sh
+# vim: syntax=sh
+#
+#
+#  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 Alexander E. Patrakov (patrakov@ums.usu.ru)
+# Copyright (C) 2004 Simone Gotti (simone.gotti@email.it)
+# All Rights Reserved.
+#
+# Based on scripts by Simone Gotti, from:
+# http://members.xoom.virgilio.it/motaboy/hotplug-isapnp-0.2.1.tar.bz2
+#
+
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+
+cd /etc/hotplug
+. ./hotplug.functions
+
+MAP_CURRENT=$MODULE_DIR/modules.isapnpmap
+DRIVERS=
+
+decode_isapnp_vendor() {
+    echo -n $1 | od -A n -t d1 | ( read A B C
+    printf '%x\n' $(( 	( ( $A & 0x3f ) << 2) | \
+            		( ( $B & 0x18 ) >> 3) | \
+			( ( $B & 0x07 ) <<13) | \
+			( ( $C & 0x1f ) << 8) )) )
+}
+
+hex_swab() {
+    echo `echo $1 | cut -b3-4``echo $1 | cut -b1-2`
+}
+
+#
+# stdin is "modules.isapnpmap" syntax
+# on return, ONE matching module was added to $DRIVERS
+#
+isapnp_map_modules ()
+{
+    local module ignored
+
+    CHECKED_ID="0x`echo $ISAPNP_ID | cut -b1-4`0x`echo $ISAPNP_ID | cut -b5-8`"
+    # comment line lists (current) isapnp_device_id field names
+    read ignored
+
+    while read module cardvendor carddevice driver_data therest
+    do
+    # comments are lines that start with "#" ...
+    # be careful, they still get parsed by bash!
+        case "$module" in
+	\#*) continue ;;
+	esac
+	: checkmatch $module
+	set $therest
+	while [ $# -gt 0 ] 
+	do
+		id_temp=$2$1
+		if [ "$id_temp" = "$CHECKED_ID" ]; then
+        	    DRIVERS="$module $DRIVERS"
+        	    : drivers $DRIVERS
+	            break
+		fi
+	        shift
+	        shift
+	done
+    done
+}
+
+
+isapnp_boot_events ()
+{
+    if [ "$(echo /sys/bus/pnp/devices/*)" != "/sys/bus/pnp/devices/*" ]
+    then
+    	cd /sys/bus/pnp/devices/
+    	for ISAPNP_DEVICE in * ; do
+	    ISAPNP_STRING=`cat $ISAPNP_DEVICE/id`	
+	    rawcardvendor=`echo $ISAPNP_STRING | cut -b1-3`
+	    rawcarddevice=`echo $ISAPNP_STRING | cut -b4-7`
+	    cardvendor=`decode_isapnp_vendor $rawcardvendor`
+	    carddevice=`hex_swab $rawcarddevice`
+    	    ISAPNP_ID=$carddevice$cardvendor
+	    LABEL="ISAPNP id $ISAPNP_ID"
+	    load_drivers isapnp $MAP_CURRENT "$LABEL"
+	    load_drivers isapnp /etc/hotplug/pnp.distmap "$LABEL"
+	done
+    fi
+    return 0
+}
+
+
+# See how we were called.
+case "$1" in
+    start)
+        isapnp_boot_events
+    ;;
+    stop)
+    # echo $"isapnp stop -- ignored"
+    ;;
+    status)
+    # echo $"isapnp status -- ignored"
+    ;;
+    restart)
+    # always invoke by absolute path, else PATH=$PATH:
+    $0 stop && $0 start
+    ;;
+    *)
+    echo $"Usage: $0 {start|stop|status|restart}"
+    exit 1
+esac

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: isapnp coldplug, once again
  2004-07-04  6:52 isapnp coldplug, once again Alexander E. Patrakov
@ 2004-09-07 17:38 ` Jonathan Lyster
  2004-09-08  4:01 ` Alexander E. Patrakov
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Lyster @ 2004-09-07 17:38 UTC (permalink / raw)
  To: linux-hotplug

On Saturday 03 July 2004 23:52, Alexander E. Patrakov wrote:
> A new, reworked version of ISAPNP hardware detection script is attached
> as a patch to the hotplug package.

I'm experimenting with bootable CDs, working up hardware detection for 
essentially any kind of system Linux supports. I recently stumbled onto a bug 
(or perhaps "omission" is more accurate) in the pnp.rc script.

The problem is this: I found a system that uses an ISA pnp network card. The 
pnp.rc script doesn't load a driver for it because the card's identifier 
string (something like @@@5e90 -- I made up the numbers, but the beginning @ 
symbols are included in the card's id string).

The card includes a second, generic identifier string in the form PNP80d6. 
This generic identifier does resolve to a valid driver module.

I'm putting together a modification of your pnp.rc script that uses the 
generic identifier if the initial one doesn't turn up a driver. Would you 
rather do this yourself?


Regards;
   Jonathan

-- 
"One of the main reasons the Roman Empire fell was because of the lack of the 
numeral '0'. This meant they were unable to terminate their C programs 
correctly."
                                - Anonymous coder


"The French don't even have a word for 'entrepreneur'!"
                                - George W. Bush


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id\x10808&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: isapnp coldplug, once again
  2004-07-04  6:52 isapnp coldplug, once again Alexander E. Patrakov
  2004-09-07 17:38 ` Jonathan Lyster
@ 2004-09-08  4:01 ` Alexander E. Patrakov
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander E. Patrakov @ 2004-09-08  4:01 UTC (permalink / raw)
  To: linux-hotplug

Jonathan Lyster wrote:
> On Saturday 03 July 2004 23:52, Alexander E. Patrakov wrote:
> 
>>A new, reworked version of ISAPNP hardware detection script is attached
>>as a patch to the hotplug package.
> 
> 
> I'm experimenting with bootable CDs, working up hardware detection for 
> essentially any kind of system Linux supports. I recently stumbled onto a bug 
> (or perhaps "omission" is more accurate) in the pnp.rc script.

> The problem is this: I found a system that uses an ISA pnp network card. The 
> pnp.rc script doesn't load a driver for it because the card's identifier 
> string (something like @@@5e90 -- I made up the numbers, but the beginning @ 
> symbols are included in the card's id string).
> 
> The card includes a second, generic identifier string in the form PNP80d6. 
> This generic identifier does resolve to a valid driver module.

Could you please execute the following commands:

cd /tmp
cp -a /sys .
tar zcf sys.tar.gz sys

and mail the resulting sys.tar.gz file to me (off-list)?

-- 
Alexander E. Patrakov


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id\x10808&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-08  4:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-04  6:52 isapnp coldplug, once again Alexander E. Patrakov
2004-09-07 17:38 ` Jonathan Lyster
2004-09-08  4:01 ` Alexander E. Patrakov

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).