cvs commit: patches/hotplug hotplug-2004_04_01-cosmetic-2.patch hotplug-2004_04_01-device-2.patch hotplug-2004_04_01-isapnp-2.patch

jim at linuxfromscratch.org jim at linuxfromscratch.org
Sun May 16 08:57:18 PDT 2004


jim         04/05/16 09:57:18

  Added:       hotplug  hotplug-2004_04_01-cosmetic-2.patch
                        hotplug-2004_04_01-device-2.patch
                        hotplug-2004_04_01-isapnp-2.patch
  Log:
  Added: hotplug-2004_04_01-cosmetic-2.patch hotplug-2004_04_01-device-2.patch hotplug-2004_04_01-isapnp-2.patch
  
  Revision  Changes    Path
  1.1                  patches/hotplug/hotplug-2004_04_01-cosmetic-2.patch
  
  Index: hotplug-2004_04_01-cosmetic-2.patch
  ===================================================================
  Submitted By: Alexander E. Patrakov
  Date: 2004-05-16
  Initial Package Version: 2004_04_01
  Upstream Status: LFS-specific
  Origin: Alexander E. Patrakov
  Description: Makes the output more verbose and looking like the output of
  other LFS bootscripts. Removes references to RedHat-specific
  /var/lock/subsys directory, puts the initscript into /etc/rc.d/init.d.
  
  diff -ur hotplug-2004_04_01.orig/etc/rc.d/init.d/hotplug hotplug-2004_04_01/etc/rc.d/init.d/hotplug
  --- hotplug-2004_04_01.orig/etc/rc.d/init.d/hotplug	2003-03-28 05:25:03.000000000 +0500
  +++ hotplug-2004_04_01/etc/rc.d/init.d/hotplug	2004-05-16 12:50:43.911080688 +0600
  @@ -22,29 +22,38 @@
   
   case "$1" in
       start|restart|status)
  -	for RC in /etc/hotplug/*.rc
  -	do
  -	    $RC $1
  -	done
  -	touch /var/lock/subsys/hotplug
  +        for RC in /etc/hotplug/*.rc
  +        do
  +            echo "Loading modules for" \
  +                `basename $RC .rc | tr [:lower:] [:upper:]` "hardware"
  +            $RC $1
  +            print_status success
  +        done
   	;;
       stop)
  -	for RC in /etc/hotplug/*.rc
  +        for RC in /etc/hotplug/*.rc
           do
  +            echo "Unoading modules for" \
  +                `basename $RC .rc | tr [:lower:] [:upper:]` "hardware"
               $RC stop
  +            print_status success
           done
  -        rm -f /var/lock/subsys/hotplug
           ;;
       force-reload)
  -	for RC in /etc/hotplug/*.rc
  +        for RC in /etc/hotplug/*.rc
           do
  +            echo "Unoading modules for" \
  +                `basename $RC .rc | tr [:lower:] [:upper:]` "hardware"
               $RC stop
  +            print_status success
           done
  -	for RC in /etc/hotplug/*.rc
  +        for RC in /etc/hotplug/*.rc
           do
  -            $RC start
  +            echo "Loading modules for" \
  +                `basename $RC .rc | tr [:lower:] [:upper:]` "hardware"
  +            $RC $1
  +            print_status success
           done
  -        rm -f /var/lock/subsys/hotplug
           ;;
   
       *)
  diff -ur hotplug-2004_04_01.orig/Makefile hotplug-2004_04_01/Makefile
  --- hotplug-2004_04_01.orig/Makefile	2003-06-28 06:13:10.000000000 +0600
  +++ hotplug-2004_04_01/Makefile	2004-05-16 12:51:01.434416736 +0600
  @@ -91,7 +91,7 @@
   	for F in etc/hotplug/{blacklist,usb.{user,hand,dist}map} ; do \
   	    ${INSTALL_DATA} $$F $(etcdir)/hotplug ; \
   	    done
  -	${INSTALL_SCRIPT} -D etc/rc.d/init.d/hotplug $(etcdir)/init.d/hotplug
  +	${INSTALL_SCRIPT} -D etc/rc.d/init.d/hotplug $(etcdir)/rc.d/init.d/hotplug
   	$(INSTALL_DATA) -D hotplug.8  $(mandir)/man8/hotplug.8
   	$(INSTALL) -d $(prefix)/var/log/hotplug $(prefix)/var/run
   	$(INSTALL) -d -m 700 $(prefix)/var/run/usb
  
  
  
  1.1                  patches/hotplug/hotplug-2004_04_01-device-2.patch
  
  Index: hotplug-2004_04_01-device-2.patch
  ===================================================================
  Submitted By: Alexander E. Patrakov
  Date: 2004-05-16
  Initial Package Version: 2004_04_01
  Upstream Status: will send a copy to linux-hotplug-devel at lists.sourceforge.net
  Origin: Alexander E. Patrakov
  Description: Provides the correct DEVICE variable for USB coldplug events
  for 2.6.x kernels. The grep ...\$ is used instead of tail -c 4 because LFS has
  the tail command in /usr/bin. That's even more illogical because head
  is in /bin.
  This patch requires a 2.6.6 kernel. 2.6.4 is too old.
  
  diff -ur hotplug-2004_04_01.orig/etc/hotplug/usb.rc hotplug-2004_04_01/etc/hotplug/usb.rc
  --- hotplug-2004_04_01.orig/etc/hotplug/usb.rc	2004-04-01 23:38:59.000000000 +0600
  +++ hotplug-2004_04_01/etc/hotplug/usb.rc	2004-05-16 13:00:17.631861872 +0600
  @@ -90,25 +90,23 @@
   	DEVICE=
   	export ACTION PRODUCT TYPE INTERFACE DEVPATH DEVFS DEVICE
   
  -	# these notifications will be handled by usbmodules
  -	# NOTE: we're not providing a full set of hotplug
  -	# parameters for USB.  that's why "usbmodules" is a
  -	# requirement: it reads usbfs to get the others.
  -	# (it's included in usbutils 0.8 and later)
  -	#
  -	# FIXME usbmodules, or something, should set real
  -	# PRODUCT and DEVICE strings so /etc/hotplug/usb/*
  -	# scripts can rely on them ...
  -	# FIXME: this comment is out of date.
   	if [ -d /sys/bus ]; then
   	    if [ -d /sys/bus/usb/devices ]; then
   		cd /sys/bus/usb/devices
  -		# XXX FIXME this is not the right way...
   		for device in /sys/bus/usb/devices/[0-9]*; do
  -		    DEVPATH=${device#/sys/}
  -		    if [ -f $device/idVendor ]; then
  -			 PRODUCT="$(cat $device/idVendor)/$(cat $device/idProduct)/$(cat $device/bcdDevice)"
  -			 /etc/hotplug/usb.agent
  +		    devlink=$( readlink -f $device )
  +		    DEVPATH=${devlink#/sys}
  +		    if [ -f $devlink/../idVendor ]; then
  +			PRODUCT="$(cat $devlink/../idVendor)/$(cat $devlink/../idProduct)/$(cat $devlink/../bcdDevice)"
  +		        if [ -f $devlink/../../devnum ]
  +			then
  +			    devbus=$( ( echo -n 000 ; cat $devlink/../../devnum ) | grep -o ...\$ )
  +			    devdev=$( ( echo -n 000 ; cat $devlink/../devnum ) | grep -o ...\$ )
  +			    DEVICE="/proc/bus/usb/$devbus/$devdev"
  +			else
  +			    DEVICE=
  +			fi
  +			/etc/hotplug/usb.agent
   		    fi	
   		done
   	    fi
  
  
  
  1.1                  patches/hotplug/hotplug-2004_04_01-isapnp-2.patch
  
  Index: hotplug-2004_04_01-isapnp-2.patch
  ===================================================================
  Submitted By: Alexander E. Patrakov
  Date: 2004-05-15
  Initial Package Version: 2004_04_01
  Origin: Marco d'Itri, Simone Gotti
  Upstream Status: posted to linux-hotplug-devel list, no useful response yet
  Description: Includes two versions of ISAPNP hardware detection script.
  
  The one by Simone Gotti (isapnp.{rc,agent}) gives more precise results
  for hardware properly supported in kernel,
  while the version by Marco d'Itri (pnp.rc) is much simpler and contains
  workarounds for some modules, including floppy, PC speaker
  and PS/2 mouse.
  
  The version by Marco d'Itri needs the following entries in
  /etc/modprobe.conf, due to a kernel bug:
  
  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
  
  The script by Simone Gotti requires a 2.6.6 kernel. 2.6.4 is too old.
  
  diff -urN hotplug-2004_04_01.orig/etc/hotplug/isapnp.agent hotplug-2004_04_01/etc/hotplug/isapnp.agent
  --- hotplug-2004_04_01.orig/etc/hotplug/isapnp.agent	1970-01-01 05:00:00.000000000 +0500
  +++ hotplug-2004_04_01/etc/hotplug/isapnp.agent	2004-05-16 12:22:20.000000000 +0600
  @@ -0,0 +1,103 @@
  +#!/bin/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.
  +#
  +# ISAPNP-specific hotplug policy agent.
  +#
  +# This should handle 2.4.* and 2.6.* ISAPNP (for now only coldplugging),
  +#
  +# Kernel ISAPNP params are:
  +#	
  +#	ACTION=%s [add or remove]
  +#	ISAPNP_ID=%08X
  +#
  +# Copyright (C) 2004 Simone Gotti, All Rights Reserved.
  +#
  +# HISTORY:
  +#
  +# 2004/04/08 Simone Gotti 	first version
  +# 2004/04/11 Simone Gotti	make the modules.isapnp parsing more fast 
  +#                           we don't need the isapnpmodules C program anymore.
  +#
  +
  +cd /etc/hotplug
  +. ./hotplug.functions
  +
  +# generated by modutils, for current 2.4.x kernels
  +MAP_CURRENT=$MODULE_DIR/modules.isapnpmap
  +
  +# accumulates list of modules we may care about
  +DRIVERS=
  +
  +if [ "$ISAPNP_ID" = "" ]; then
  +    mesg Bad ISAPNP agent invocation
  +    exit 1
  +fi
  +
  +#
  +# stdin is "modules.isapnpmap" syntax
  +# on return, ONE matching module was added to $DRIVERS
  +#
  +isapnp_map_modules ()
  +{
  +    local module ignored
  +
  +    # 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
  +}
  +
  +#
  +# What to do with this ISAPNP hotplug event?
  +#
  +case $ACTION in
  +
  +add)	
  +
  +    LABEL="ISAPNP id $ISAPNP_ID"
  +    CHECKED_ID="0x`echo $ISAPNP_ID | cut -b1-4`0x`echo $ISAPNP_ID | cut -b5-8`"
  +    
  +    # on 2.4 systems, modutils maintains MAP_CURRENT
  +    if [ -r $MAP_CURRENT ]; then
  +        load_drivers isapnp $MAP_CURRENT "$LABEL"
  +    fi
  +
  +    if [ "$DRIVERS" = "" ]; then
  +        debug_mesg "... no modules for $LABEL"
  +        exit 2
  +    fi
  +    ;;
  +
  +*)
  +    debug_mesg ISAPNP $ACTION event not supported
  +    exit 1
  +    ;;
  +
  +esac
  diff -urN hotplug-2004_04_01.orig/etc/hotplug/isapnp.rc hotplug-2004_04_01/etc/hotplug/isapnp.rc
  --- hotplug-2004_04_01.orig/etc/hotplug/isapnp.rc	1970-01-01 05:00:00.000000000 +0500
  +++ hotplug-2004_04_01/etc/hotplug/isapnp.rc	2004-04-12 18:51:59.000000000 +0600
  @@ -0,0 +1,106 @@
  +#!/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.
  +#
  +# isapnp.rc	mostly to recover lost boot-time isapnp hotplug events
  +#	
  +# Copyright (C) 2004 Simone Gotti, All Rights Reserved.
  +#
  +#	2004/04/08 Simone Gotti (simone.gotti at email.it)
  +#	2004/04/11 Alexander E. Patrakov (patrakov at ums.usu.ru)
  +#                  Bash functions for converting ISAPNP_STRING to ID
  +#
  +#
  +
  +PATH=/sbin:/bin:/usr/sbin:/usr/bin
  +
  +cd /etc/hotplug
  +. ./hotplug.functions
  +
  +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`
  +}
  +
  +isapnp_boot_events ()
  +{
  +    # make sure the isapnp agent will run
  +    ACTION=add
  +    DOCK=0/0/0
  +    ISAPNP_SLOT=00:00
  +    ISAPNP_ID=
  +
  +    export ACTION DOCK ISAPNP_ID 
  +
  +    if [ -d /sys/bus ]; then
  +    # 2.6 kernels
  +        if [ -d /sys/bus/pnp/devices/ ]; then
  +            cd /sys/bus/pnp/devices/
  +            for ISAPNP_DEVICE in *; do
  +            # read the String id value 
  +            ISAPNP_STRING=`cat $ISAPNP_DEVICE/id`	
  +            #convert the string in the ISAPNP_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
  +            /sbin/hotplug isapnp
  +            done
  +        fi
  +    else
  +        # Check for /proc/bus/pnp/ 	
  +        if [ -d /proc/bus/pnp/ ]; then
  +            cat /proc/bus/pnp/devices |
  +            while read line
  +            do
  +                ISAPNP_ID=`echo $line | cut -d' ' -f2` 
  +                /sbin/hotplug isapnp
  +            done
  +
  +        # Check for /proc/bus/isapnp/ 	
  +        elif [ -d /proc/bus/isapnp/ ]; then
  +            cat /proc/bus/isapnp/devices |
  +            while read line
  +            do
  +                ISAPNP_ID=`echo $line | cut -d' ' -f2` 
  +                /sbin/hotplug isapnp
  +            done
  +        #else
  +            #echo "/proc/bus/pnp/ or /proc/bus/isapnp/ not found, Is it enabled in your kernel?"
  +        fi
  +    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
  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-05-16 12:05:32.000000000 +0600
  @@ -0,0 +1,56 @@
  +#!/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 at email.it>
  +#  Copyright (C) 2004 Marco d'Itri <md at 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
  +	$MODPROBE -q pnp:d$MODULE || true
  +    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
  +
  
  
  



More information about the patches mailing list