r859 - trunk/udev

jim at linuxfromscratch.org jim at linuxfromscratch.org
Tue Dec 6 22:41:12 PST 2005


Author: jim
Date: 2005-12-06 23:41:11 -0700 (Tue, 06 Dec 2005)
New Revision: 859

Added:
   trunk/udev/05-udev-early.rules
   trunk/udev/README.debug
   trunk/udev/ide.sh
   trunk/udev/input.sh
Removed:
   trunk/udev/10-wait-for-sysfs.rules
   trunk/udev/input_device.sh
   trunk/udev/load_ide_modules.sh
Modified:
   trunk/udev/
   trunk/udev/50-udev.rules
   trunk/udev/Makefile
   trunk/udev/boot.udev
   trunk/udev/boot.udev_retry
   trunk/udev/load_floppy_module.sh
   trunk/udev/mount.sh
Log:
 r994 at server:  jim | 2005-12-06 22:39:42 -0800
 Updates from 077 OpenSuse Package



Property changes on: trunk/udev
___________________________________________________________________
Name: svk:merge
   + 3949c430-d905-0410-97b6-f115d20341b5:/udev:994

Added: trunk/udev/05-udev-early.rules
===================================================================
--- trunk/udev/05-udev-early.rules	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/05-udev-early.rules	2005-12-07 06:41:11 UTC (rev 859)
@@ -0,0 +1,40 @@
+########################################################################
+#
+# Description : 05-udev-early.rules
+#
+# Authors     : Based on Open Suse Udev Rules
+#               kay.sievers at suse.de
+#
+# Adapted to  : Jim Gifford
+# LFS
+#
+# Version     : 00.01
+#
+# Notes       :
+#
+########################################################################
+
+########################################################################
+#
+# Description : 05-udev-early.rules
+#
+# Authors     : Based on Open Suse Udev Rules
+#               kay.sievers at suse.de
+#
+# Adapted to  : Jim Gifford
+# LFS
+#
+# Version     : 00.01
+#
+# Notes       :
+#
+########################################################################
+
+# sysfs is populated after the event is sent
+#
+ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
+
+# ignore these events until someone needs them
+#
+SUBSYSTEM=="drivers",		OPTIONS="ignore_device"
+SUBSYSTEM=="module",		OPTIONS="ignore_device"

Deleted: trunk/udev/10-wait-for-sysfs.rules
===================================================================
--- trunk/udev/10-wait-for-sysfs.rules	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/10-wait-for-sysfs.rules	2005-12-07 06:41:11 UTC (rev 859)
@@ -1,17 +0,0 @@
-########################################################################
-#
-# Description : Wait for SYSFS
-#
-# Authors     : Based on Open Suse Udev Rules
-#               kay.sievers at suse.de
-#
-# Adapted to  : Jim Gifford
-# LFS
-#
-# Version     : 00.01
-#
-# Notes       :
-#
-########################################################################
-
-ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"

Modified: trunk/udev/50-udev.rules
===================================================================
--- trunk/udev/50-udev.rules	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/50-udev.rules	2005-12-07 06:41:11 UTC (rev 859)
@@ -14,10 +14,6 @@
 #
 ########################################################################
 
-# ignore these events until someone needs them
-SUBSYSTEM=="drivers",		OPTIONS="last_rule"
-SUBSYSTEM=="module",		OPTIONS="last_rule"
-
 # console
 KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule"
 KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule"
@@ -55,10 +51,6 @@
 # dvb
 SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video"
 
-# Kino jogshuttle support
-SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino"
-SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="5f3/240/*", RUN+="/usr/bin/killall --quiet -USR2 kino"
-
 # input devices
 KERNEL=="mice",			NAME="input/%k", MODE="0640"
 KERNEL=="mouse*",		NAME="input/%k", MODE="0640"
@@ -67,8 +59,7 @@
 KERNEL=="ts*",			NAME="input/%k", MODE="0600"
 KERNEL=="uinput",		NAME="input/%k", MODE="0600"
 KERNEL=="lirc0",		NAME="%k", SYMLINK+="lirc"
-KERNEL=="input[0-9]*",		RUN+="/lib/udev/input_device.sh"
-KERNEL=="input[0-9]*",		ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev"
+KERNEL=="input[0-9]*", ACTION=="add", RUN+="input.sh"
 
 # printer
 SUBSYSTEM=="usb",		KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp"
@@ -94,6 +85,9 @@
 # 167 /dev/specialix_sxctl Specialix serial control
 KERNEL=="sxctl",		NAME="specialix_sxctl", SYMLINK+="%k"
 
+# network
+KERNEL=="tun", NAME="net/%k", MODE="0600"
+
 # misc devices
 KERNEL=="mem",			NAME="%k", GROUP="kmem", MODE="640"
 KERNEL=="kmem",			NAME="%k", GROUP="kmem", MODE="640"
@@ -120,13 +114,14 @@
 KERNEL=="mmtimer",		NAME="%k", MODE="444"
 KERNEL=="auer[0-9]*"		NAME="usb/%k"
 
+# packet writing interface
 KERNEL=="pktcdvd",		NAME="pktcdvd/control"
 KERNEL=="pktcdvd[0-9]*",	NAME="pktcdvd/%k"
 
 # fix floppy devices
-KERNEL=="nvram", ACTION=="add", RUN+="/lib/udev/load_floppy_module.sh"
-KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/lib/udev/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k"
-KERNEL=="fd*", ACTION=="remove", RUN+="/lib/udev/remove_floppy_devices.sh %k"
+KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh"
+KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k"
+KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*"
 
 # block devices
 SUBSYSTEM=="block", GROUP="disk", MODE="0640"
@@ -142,14 +137,14 @@
 SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod"
 SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg"
 
-# IDE modules
-SUBSYSTEM=="ide", ACTION=="add", RUN+="/lib/udev/load_ide_modules.sh"
+# load IDE modules
+SUBSYSTEM=="ide", ACTION=="add", RUN+="ide.sh"
 
 # device mapper
-KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control"
+KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control"
 
 # check fstab and possibly mount
-SUBSYSTEM=="block", KERNEL=="sd*[0-9]|hd*[0-9]", ACTION=="add", RUN+="/lib/udev/mount.sh"
+SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]", RUN+="mount.sh"
 
 # misc storage devices (non-block)
 KERNEL=="sg*",			NAME="%k", GROUP="disk", MODE="640"
@@ -178,5 +173,5 @@
 # libusb device access
 SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644"
 
-# firmware loader
-SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware.sh"
+# kernel firmware loader
+SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh"

Modified: trunk/udev/Makefile
===================================================================
--- trunk/udev/Makefile	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/Makefile	2005-12-07 06:41:11 UTC (rev 859)
@@ -9,7 +9,7 @@
 install: device_dirs device_link rules scripts boot
 
 rules:
-	install -m ${RULESMODE} ${DESTDIR}/etc/udev/rules.d/10-wait-for-sysfs.rules
+	install -m ${RULESMODE} ${DESTDIR}/etc/udev/rules.d/05-udev-early.rules
 	install -m ${RULESMODE} ${DESTDIR}/etc/udev/rules.d/50-udev.rules
 	install -m ${RULESMODE} ${DESTDIR}/etc/udev/rules.d/60-persistent.rules
 	install -m ${RULESMODE} ${DESTDIR}/etc/udev/rules.d/80-sysconfig.rules
@@ -18,9 +18,9 @@
 scripts:
 	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/remove_floppy_devices.sh
 	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/load_floppy_module.sh
-	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/load_ide_modules.sh
+	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/ide.sh
 	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/firmware.sh
-	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/input_device.sh
+	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/input.sh
 	install -m ${SCRIPTMODE) ${DESTDIR}/lib/udev/mount.sh
 	install -m ${CONFMODE} ${DESTDIR}/etc/scsi_id.config
 	install -m ${SCRIPTMODE) ${DESTDIR}/usr/bin/udev.count_events

Added: trunk/udev/README.debug
===================================================================
--- trunk/udev/README.debug	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/README.debug	2005-12-07 06:41:11 UTC (rev 859)
@@ -0,0 +1,70 @@
+Debugging the udev event processing
+===================================
+
+To visualize the driver core events and the udev event processes, use:
+  udevmonitor
+
+it prints:
+  UEVENT[1132632714.285362] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2
+  UEVENT[1132632714.288166] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
+  UEVENT[1132632714.309485] add@/class/input/input6
+  UEVENT[1132632714.309511] add@/class/input/input6/mouse2
+  UEVENT[1132632714.309524] add@/class/usb_device/usbdev2.12
+  UDEV  [1132632714.348966] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2
+  UDEV  [1132632714.420947] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
+  UDEV  [1132632714.427298] add@/class/input/input6
+  UDEV  [1132632714.434223] add@/class/usb_device/usbdev2.12
+  UDEV  [1132632714.439934] add@/class/input/input6/mouse2
+
+UEVENT lines show the events the kernel sends over netlink, the UDEV lines
+show the finished udev event handlers. The timing is printed in microseconds.
+The time between UEVENT and UDEV is the time udev took to process this event
+or was queued to synchronize it with other events.
+
+If called with:
+  udevmonitor --env
+
+it prints the whole event environment:
+  UDEV  [1132633002.937243] add@/class/input/input7
+  UDEV_LOG=3
+  ACTION=add
+  DEVPATH=/class/input/input7
+  SUBSYSTEM=input
+  SEQNUM=1043
+  PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
+  PHYSDEVBUS=usb
+  PHYSDEVDRIVER=usbhid
+  PRODUCT=3/46d/c03e/2000
+  NAME="Logitech USB-PS/2 Optical Mouse"
+
+
+Udev also sends messages to syslog according to the configured debugging
+level. Udev specific tools which are called, also respect the setting
+of udev_log. But there might be some which need special actions to make
+them verbose.
+
+Set  udevs loglevel in the damon at runtime with:
+  udevcontrol log_priority=<level>
+
+Enable logging permanently, set (it may make udev _very_ slow):
+  udev_log=info in /etc/udev/udev.conf.
+
+
+For further processing of the logging output you should get a clean logfile at
+next boot. Just move the old logfile away. (Syslog will still use the moved file
+until it's restarted).
+
+The script 'show_event_log' provided along with this file, can be used to
+extract info out of /var/log/messages. Call it:
+  show_event_log <first> [<last> [<list of event types>] ]
+<first> is the sequence number of the first event you are interested in.
+<last>  is the number of the last event. You may write 'last' literally. It may
+        also be omitted if you want to see a single event. 
+<list>  is a list of event types you like to see. If you omit it, you get most
+        events, not all. Some are exclude by default. Use " " as list if you
+        want to see really all. Or edit the list of skipped events in the first
+        lines of the script
+
+If you don't use /var/log/messages as the logfile you may set the environment
+variable MESSAGES=<logfile>.
+

Modified: trunk/udev/boot.udev
===================================================================
--- trunk/udev/boot.udev	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/boot.udev	2005-12-07 06:41:11 UTC (rev 859)
@@ -19,10 +19,6 @@
 . /etc/sysconfig/rc
 . ${rc_functions}
 
-PATH="/sbin:/bin"
-DAEMON=/sbin/udevd
-udevd_args="--daemon"
-
 function trigger_device_events() {
 	# generate events with the sysfs trigger
 	list=$(echo /sys/bus/*/devices/*/uevent)
@@ -57,17 +53,20 @@
 
 case "$1" in
     start)
-
 	# disable hotplug helper, udevd listens to netlink
 	echo "" > /proc/sys/kernel/hotplug
 
 	# start udevd
-	boot_mesg "Starting udevd"
-	loadproc $DAEMON $udevd_args
+	bootmesg "Starting udevd..."
+	loadproc /sbin/udevd --daemon
 
 	# cleanup some stuff
+	rm -f /var/run/sysconfig/network
 	rm -rf /events/*
 
+	# start coldplugging
+	bootmesg "Performing Coldplugging..."
+
 	# unlikely, but we may be faster than the first event
 	mkdir -p /dev/.udev/queue
 
@@ -81,18 +80,21 @@
 	    test "$loop" -gt 300 && break
 	    loop=$(($loop + 1))
 	done
+
+	echo_ok
 	;;
 
     stop)
-	boot_mesg "Stopping udevd:"
+	bootmesg "Stopping udevd..."
 	echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
-	killproc $DAEMON
+	killproc /sbin/udevd
 	;;
 
     restart)
-	${0} stop
-        sleep 1
-        ${0} start
+	bootmesg "Restarting udevd..."
+	killproc /sbin/udevd
+	loadproc /sbin/udevd --daemon
+	evaluate_retval
 	;;
 
     status)
@@ -100,20 +102,21 @@
 	;;
 
     reload)
-	boot_mesg "Reloading udev rules:"
+	bootmesg "Reloading udev rules..."
 	udevcontrol reload_rules
 	cp --preserve=all --recursive --update /lib/udev/devices/* /dev
 	evaluate_retval
 	;;
 
     force-reload)
-	boot_mesg "Updating all available device nodes in /dev: "
+	bootmesg "Updating all available device nodes in /dev..."
 	udevcontrol reload_rules
 	rm -rf /dev/.udev /dev/disk
 	cp --preserve=all --recursive --update /lib/udev/devices/* /dev
 	trigger_device_events
 	evaluate_retval
 	;;
+
     *)
 	echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
 	exit 1

Modified: trunk/udev/boot.udev_retry
===================================================================
--- trunk/udev/boot.udev_retry	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/boot.udev_retry	2005-12-07 06:41:11 UTC (rev 859)
@@ -21,10 +21,9 @@
 . ${rc_functions}
 
 case "$1" in
-
     start)
 	if test -d /dev/.udev/failed; then
-	    boot_mesg "Retry device configuration"
+	    bootmesg "Retry device configuration..."
 	    list=$(echo /dev/.udev/failed/*)
 	    for i in $list; do
 		device="$(readlink $i)/uevent"

Added: trunk/udev/ide.sh
===================================================================
--- trunk/udev/ide.sh	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/ide.sh	2005-12-07 06:41:11 UTC (rev 859)
@@ -0,0 +1,51 @@
+#!/bin/sh
+########################################################################
+#
+# Description : Load ide
+#
+# Authors     : Based on Open Suse Udev Rules
+#               kay.sievers at suse.de
+#
+# Adapted to  : Jim Gifford
+# LFS
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+# calculate device name from bus and drive number
+device=${DEVPATH#/devices/*/ide?/}
+drive=${device#?.}
+bus=${device%.?}
+unitnum=$((96 + 1 + $drive + $bus * 2))
+name=$(printf "hd\\$(printf '%o' $unitnum)")
+procfile="/proc/ide/$name/media"
+
+# wait for /proc file to appear
+loop=30
+while ! test -e $procfile; do
+    sleep 0.1;
+    test "$loop" -gt 0 || break
+    loop=$(($loop - 1))
+done
+
+read media < $procfile
+case "$media" in
+    cdrom)
+	/sbin/modprobe ide-cd
+	;;
+    disk)
+	/sbin/modprobe ide-disk
+	;;
+    floppy)
+	/sbin/modprobe ide-floppy
+	;;
+    tape)
+	/sbin/modprobe ide-tape
+	;;
+    *)
+	/sbin/modprobe ide-generic
+	;;
+esac


Property changes on: trunk/udev/ide.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/udev/input.sh
===================================================================
--- trunk/udev/input.sh	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/input.sh	2005-12-07 06:41:11 UTC (rev 859)
@@ -0,0 +1,217 @@
+#!/bin/sh
+########################################################################
+#
+# Description : Input devices
+#
+# Authors     : Based on Open Suse Udev Rules
+#               kay.sievers at suse.de
+#
+# Adapted to  : Jim Gifford
+# LFS
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+input_join_words() {
+    local array="$1" tmp
+    [ "$array" ] || return 0
+
+    set $array
+    tmp="$1"
+    shift
+    while [ "$#" -gt 0 ]; do
+	tmp="$tmp:$1"
+	shift
+    done
+
+    echo "$tmp"
+}
+
+input_convert_vars() {
+    i_bustype=0; i_vendor=0; i_product=0; i_version=0; i_evBits=0
+
+    if [ "$PRODUCT" ]; then
+	set -- $(IFS='/'; echo $PRODUCT '')
+	i_bustype=$((0x$1))
+	i_vendor=$((0x$2))
+	i_product=$((0x$3))
+	[ "$4" ] && i_version=$((0x$4)) # XXX
+    fi
+
+    [ "$EV" ] && i_evBits=$((0x$EV))
+
+    i_keyBits=$(input_join_words "$KEY")
+    i_relBits=$(input_join_words "$REL")
+    i_absBits=$(input_join_words "$ABS")
+    i_mscBits=$(input_join_words "$MSC")
+    i_ledBits=$(input_join_words "$LED")
+    i_sndBits=$(input_join_words "$SND")
+    i_ffBits=$( input_join_words "$FF")
+}
+
+input_match_bits() {
+    local mod_bits="$1" dev_bits="$2"
+    [ "$dev_bits" ] || return 0
+
+    local mword dword
+    mword=$((0x${mod_bits##*:}))
+    dword=$((0x${dev_bits##*:}))
+
+    while true; do
+	if [ $(( $mword & $dword != $mword )) -eq 1 ]; then
+	    return 1
+	fi
+
+	mod_bits=${mod_bits%:*}
+	dev_bits=${dev_bits%:*}
+
+	case "$mod_bits-$dev_bits" in
+	    *:*-*:*)		continue ;;
+	    *:*-*|*-*:*)	return 0 ;;
+	    *)			return 1 ;;
+	esac
+    done
+}
+
+load_drivers() {
+    local TYPE="$1" FILENAME="$2"
+
+    ${TYPE}_map_modules < $FILENAME
+
+    for MODULE in $DRIVERS; do
+	/sbin/modprobe $MODULE || true
+    done
+}
+
+input_map_modules() {
+    local line module
+    local relBits mscBits ledBits sndBits keyBits absBits ffBits
+
+    while read line; do
+	# comments are lines that start with "#" ...
+	# be careful, they still get parsed by bash!
+	case "$line" in
+	\#*) continue ;;
+	esac
+
+	set $line
+
+	module="$1"
+	matchBits=$(($2))
+
+	bustype=$(($3))
+	vendor=$(($4))
+	product=$(($5))
+	version=$(($6))
+
+	evBits="$7"
+	keyBits="$8"
+	relBits="$9"
+
+	shift 9
+	absBits="$1"
+	cbsBits="$2"
+	ledBits="$3"
+	sndBits="$4"
+	ffBits="$5"
+	driverInfo=$(($6))
+
+	if [ $INPUT_DEVICE_ID_MATCH_BUS -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_BUS )) ] && 
+		[ $bustype -ne $i_bustype ]; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_VENDOR -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_VENDOR )) ] && 
+		[ $vendor -ne $i_vendor ]; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_PRODUCT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_PRODUCT )) ] && 
+		[ $product -ne $i_product ]; then
+	    continue
+	fi
+
+	# version i_version $i_version < version $version
+	if [ $INPUT_DEVICE_ID_MATCH_VERSION -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_VERSION )) ] && 
+		[ $version -ge $i_version ]; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_EVBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_EVBIT )) ] && 
+		input_match_bits "$evBits" "$i_evBits"; then
+	    continue
+	fi
+	if [ $INPUT_DEVICE_ID_MATCH_KEYBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_KEYBIT )) ] && 
+		input_match_bits "$keyBits" "$i_keyBits"; then
+	    continue
+	fi
+	if [ $INPUT_DEVICE_ID_MATCH_RELBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_RELBIT )) ] && 
+		input_match_bits "$relBits" "$i_relBits"; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_ABSBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_ABSBIT )) ] && 
+		input_match_bits "$absBits" "$i_absBits"; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_MSCBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_MSCBIT )) ] && 
+		input_match_bits "$mscBits" "$i_mscBits"; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_LEDBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_LEDBIT )) ] && 
+		input_match_bits "$ledBits" "$i_ledBits"; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_SNDBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_SNDBIT )) ] && 
+		input_match_bits "$sndBits" "$i_sndBits"; then
+	    continue
+	fi
+
+	if [ $INPUT_DEVICE_ID_MATCH_FFBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_FFBIT )) ] && 
+		input_match_bits "$ffBits" "$i_ffBits"; then
+	    continue
+	fi
+
+	if [ $matchBits -eq 0 -a $driverInfo -eq 0 ]; then
+		continue
+	fi
+
+	# It was a match!
+	case " $DRIVERS " in
+	    *" $module "*)
+		: already found
+	    ;;
+	    *)
+		DRIVERS="$module $DRIVERS"
+	    ;;
+	esac
+
+    done
+}
+
+INPUT_DEVICE_ID_MATCH_BUS=1
+INPUT_DEVICE_ID_MATCH_VENDOR=2
+INPUT_DEVICE_ID_MATCH_PRODUCT=4
+INPUT_DEVICE_ID_MATCH_VERSION=8
+INPUT_DEVICE_ID_MATCH_EVBIT=$((0x010))
+INPUT_DEVICE_ID_MATCH_KEYBIT=$((0x020))
+INPUT_DEVICE_ID_MATCH_RELBIT=$((0x040))
+INPUT_DEVICE_ID_MATCH_ABSBIT=$((0x080))
+INPUT_DEVICE_ID_MATCH_MSCBIT=$((0x100))
+INPUT_DEVICE_ID_MATCH_LEDBIT=$((0x200))
+INPUT_DEVICE_ID_MATCH_SNDBIT=$((0x400))
+INPUT_DEVICE_ID_MATCH_FFBIT=$((0x800))
+
+MAP_CURRENT="/lib/modules/$(uname -r)/modules.inputmap"
+[ -r $MAP_CURRENT ] || exit 0
+
+input_convert_vars
+load_drivers input $MAP_CURRENT
+
+exit 0


Property changes on: trunk/udev/input.sh
___________________________________________________________________
Name: svn:executable
   + *

Deleted: trunk/udev/input_device.sh
===================================================================
--- trunk/udev/input_device.sh	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/input_device.sh	2005-12-07 06:41:11 UTC (rev 859)
@@ -1,302 +0,0 @@
-#!/bin/bash
-# $Id$
-#
-# input-device specific hotplug policy agent.
-#
-# This should handle 2.6.* input hotplugging,
-# with a consistent framework for adding device and driver
-# specific handling.
-#
-# Normally, adding a input device will modprobe handler(s) for
-# this device.
-#
-# Kernel input hotplug params include (not all of them may be available):
-#
-#        ACTION=%s [add or remove]
-#        PRODUCT=%x/%x/%x/%x
-#        NAME=%s
-#        PHYS=%s
-#        EV=%lx
-#        KEY=%lx %lx ...
-#        REL=%lx
-#        ABS=%lx %lx ...
-#        MSC=%lx
-#        LED=%lx
-#        SND=%lx
-#        FF=%lx %lx ...
-#
-: ${ACTION?Bad invocation: \$ACTION is not set}
-
-cd /etc/hotplug
-. ./hotplug.functions
-
-# generated by module-init-tools
-MAP_CURRENT=$MODULE_DIR/modules.inputmap
-
-# used for kernel drivers that don't show up in MAP_CURRENT
-# or to overwrite default from MAP_CURRENT
-#
-MAP_HANDMAP=$HOTPLUG_DIR/input.handmap
-
-# Each modules.inputmap format line corresponds to one entry in a
-# MODULE_DEVICE_TABLE(input,...) declaration in a kernel file.
-#
-matchBits=0
-i_bustype=0
-i_vendor=0
-i_product=0
-i_version=0
-i_evBits=0
-
-input_join_words ()
-{
-    local name=$1; shift
-    local tmp=$1; shift
-    while [ "$#" -gt 0 ]; do
-        tmp="$tmp:$1"; shift
-    done
-    eval $name=\$tmp
-}
-
-input_convert_vars ()
-{
-    if [ "$PRODUCT" != "" ]; then
-        set -- `IFS=/; echo $PRODUCT`
-        i_bustype=$((0x$1))
-        i_vendor=$((0x$2))
-        i_product=$((0x$3))
-        i_version=$((0x$4))
-    fi
-
-    if [ "$EV" != "" ]; then
-        i_evBits=$((0x$EV))
-    fi
-
-    input_join_words i_keyBits $KEY
-    # for a in $KEY; do i_keyBits="${i_keyBits:+$i_keyBits:}${a}"; done
-    input_join_words i_relBits $REL
-    input_join_words i_absBits $ABS
-    input_join_words i_mscBits $MSC
-    input_join_words i_ledBits $LED
-    input_join_words i_sndBits $SND
-    input_join_words i_ffBits  $FF
-}
-
-INPUT_DEVICE_ID_MATCH_BUS=1
-INPUT_DEVICE_ID_MATCH_VENDOR=2
-INPUT_DEVICE_ID_MATCH_PRODUCT=4
-INPUT_DEVICE_ID_MATCH_VERSION=8
-INPUT_DEVICE_ID_MATCH_EVBIT=$((0x010))
-INPUT_DEVICE_ID_MATCH_KEYBIT=$((0x020))
-INPUT_DEVICE_ID_MATCH_RELBIT=$((0x040))
-INPUT_DEVICE_ID_MATCH_ABSBIT=$((0x080))
-INPUT_DEVICE_ID_MATCH_MSCBIT=$((0x100))
-INPUT_DEVICE_ID_MATCH_LEDBIT=$((0x200))
-INPUT_DEVICE_ID_MATCH_SNDBIT=$((0x400))
-INPUT_DEVICE_ID_MATCH_FFBIT=$((0x800))
-
-
-input_match_bits ()
-{
-    local mod_bits=$1 dev_bits=$2
-
-    mword=$((0x${mod_bits##*:}))
-    dword=$((0x${dev_bits##*:}))
-
-    while true; do
-        if [ $(( $mword & $dword != $mword )) -eq 1 ]; then
-            return 1
-        fi
-
-        mod_bits=${mod_bits%:*}
-        dev_bits=${dev_bits%:*}
-
-        case "$mod_bits-$dev_bits" in
-            *:*-*:* )
-                : continue
-            ;;
-            *:*-*|*-*:* )
-                return 0
-            ;;
-            * )
-                return 1
-            ;;
-        esac
-    done
-}
-
-#
-# stdin is "modules.inputmap" syntax
-# on return, all matching modules were added to $DRIVERS
-#
-input_map_modules ()
-{
-    local line module
-    local relBits mscBits ledBits sndBits keyBits absBits ffBits
-
-    while read line
-    do
-        # comments are lines that start with "#" ...
-        # be careful, they still get parsed by bash!
-        case "$line" in
-            \#*|"") continue ;;
-        esac
-
-        set $line
-
-        module=$1
-        matchBits=$(($2))
-
-        bustype=$(($3))
-        vendor=$(($4))
-        product=$(($5))
-        vendor=$(($6))
-
-        evBits=$(($7))
-        keyBits=$8
-        relBits=$(($9))
-
-        shift 9
-        absBits=$(($1))
-        cbsBits=$(($2))
-        ledBits=$(($3))
-        sndBits=$(($4))
-        ffBits=$(($5))
-        driverInfo=$(($6))
-
-        : checkmatch $module
-
-        : bustype $bustype $i_bustype
-        if [ $INPUT_DEVICE_ID_MATCH_BUS -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_BUS )) ] &&
-           [ $bustype -ne $i_bustype ]; then
-            continue
-        fi
-
-        : vendor $vendor $i_vendor
-        if [ $INPUT_DEVICE_ID_MATCH_VENDOR -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_VENDOR )) ] &&
-           [ $vendor -ne $i_vendor ]; then
-            continue
-        fi
-
-        : product $product $i_product
-        if [ $INPUT_DEVICE_ID_MATCH_PRODUCT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_PRODUCT )) ] &&
-           [ $product -ne $i_product ]; then
-            continue
-        fi
-
-        # version i_version $i_version < version $version
-        if [ $INPUT_DEVICE_ID_MATCH_VERSION -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_VERSION )) ] &&
-           [ $version -ge $i_version ]; then
-            continue
-        fi
-
-        : evBits $evBits $i_evBits
-        if [ $INPUT_DEVICE_ID_MATCH_EVBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_EVBIT )) ] &&
-           [ $evBits -ne $(( $evBits & $i_evBits)) ]; then
-            continue
-        fi
-        : keyBits $keyBits $i_keyBits
-        if [ $INPUT_DEVICE_ID_MATCH_KEYBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_KEYBIT )) ] &&
-           input_match_bits "$keyBits" "$i_keyBits"; then
-            continue
-        fi
-        : relBits $relBits $i_relBits
-        if [ $INPUT_DEVICE_ID_MATCH_RELBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_RELBIT )) ] &&
-           [ $relBits -ne $(( $relBits & $i_relBits)) ]; then
-            continue
-        fi
-
-        : absBits $absBits $i_absBits
-        if [ $INPUT_DEVICE_ID_MATCH_ABSBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_ABSBIT )) ] &&
-           input_match_bits "$absBits" "$i_absBits"; then
-            continue
-        fi
-
-        : mscBits $mscBits $i_mscBits
-        if [ $INPUT_DEVICE_ID_MATCH_MSCBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_MSCBIT )) ] &&
-           [ $mscBits -ne $(( $mscBits & $i_mscBits)) ]; then
-            continue
-        fi
-
-        : ledBits $ledBits $_ledBits
-        if [ $INPUT_DEVICE_ID_MATCH_LEDBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_LEDBIT )) ] &&
-           input_match_bits "$ledBits" "$i_ledBits"; then
-            continue
-        fi
-
-        : sndBits $sndBits $i_sndBits
-        if [ $INPUT_DEVICE_ID_MATCH_SNDBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_SNDBIT )) ] &&
-           [ $sndBits -ne $(( $sndBits & $i_sndBits)) ]; then
-            continue
-        fi
-
-        : ffBits $ffBits $i_ffBits
-        if [ $INPUT_DEVICE_ID_MATCH_FFBIT -eq $(( $matchBits & $INPUT_DEVICE_ID_MATCH_FFBIT )) ] &&
-           input_match_bits "$ffBits" "$i_ffBits"; then
-            continue
-        fi
-
-        : driverInfo $driverInfo
-        if [ $matchBits -eq 0 -a $driverInfo -eq 0 ]; then
-                continue
-        fi
-
-        # It was a match!
-        case " $DRIVERS " in
-            *" $module "* )
-                : already found
-            ;;
-            * )
-                DRIVERS="$module $DRIVERS"
-            ;;
-        esac
-        : drivers $DRIVERS
-    done
-}
-
-#
-# What to do with this INPUT hotplug event?
-#
-case $ACTION in
-
-    add)
-
-        # If hwup does initialize the device there is nothing more to do
-        if [ -x /sbin/hwup ] && /sbin/hwup  ${1:+$1-}devpath-$DEVPATH -o hotplug; then
-            : nix
-        else
-
-            input_convert_vars
-
-            FOUND="" 
-            LABEL="INPUT product $PRODUCT"
-
-            # cope with special driver module configurations first. So we can
-            # overwrite default settings in MAP_CURRENT
-            if [ -r $MAP_HANDMAP ]; then
-                load_drivers usb $MAP_HANDMAP "$LABEL"
-                FOUND="$FOUND${DRIVERS:+ $DRIVERS}"
-            fi
-
-            if [ -r $MAP_CURRENT -a -z "$FOUND" ]; then
-                load_drivers input $MAP_CURRENT "$LABEL"
-            fi
-
-        fi
-
-        ;;
-
-    remove)
-
-        if [ -x /sbin/hwdown ] && /sbin/hwdown  ${1:+$1-}devpath-$DEVPATH -o hotplug; then
-            : nix
-        fi
-
-        ;;
-
-    *)
-        debug_mesg INPUT $ACTION event not supported
-        exit 1
-        ;;
-
-esac

Modified: trunk/udev/load_floppy_module.sh
===================================================================
--- trunk/udev/load_floppy_module.sh	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/load_floppy_module.sh	2005-12-07 06:41:11 UTC (rev 859)
@@ -17,6 +17,14 @@
 
 PROC=/proc/driver/nvram
 
+# wait for /proc file to appear
+loop=10
+while ! test -e $PROC; do
+    sleep 0.1;
+    test "$loop" -gt 0 || break
+    loop=$(($loop - 1))
+done
+
 if [ ! -r /proc/driver/nvram ]; then
     exit 0;
 fi

Deleted: trunk/udev/load_ide_modules.sh
===================================================================
--- trunk/udev/load_ide_modules.sh	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/load_ide_modules.sh	2005-12-07 06:41:11 UTC (rev 859)
@@ -1,48 +0,0 @@
-#!/bin/sh
-########################################################################
-#
-# Description : load_ide_modules
-#
-# Authors     : Based on Open Suse Udev Rules
-#               kay.sievers at suse.de
-#
-# Adapted to  : Jim Gifford
-# LFS
-#
-# Version     : 00.00
-#
-# Notes       : 
-#
-########################################################################
-
-device=${DEVPATH#/devices/*/ide?/}
-drive=${device#?.}
-bus=${device%.?}
-name=$(printf "hd%x" $(($drive + $bus * 2 + 10)))
-procfile="/proc/ide/$name/media"
-
-loop=50
-while ! test -e $procfile; do
-    sleep 0.1;
-    test "$loop" -gt 0 || exit 1
-    loop=$(($loop - 1))
-done
-
-read media < $procfile
-case "$media" in
-    cdrom)
-	/sbin/modprobe ide-cd
-	;;
-    disk)
-	/sbin/modprobe ide-disk
-	;;
-    floppy)
-	/sbin/modprobe ide-floppy
-	;;
-    tape)
-	/sbin/modprobe ide-tape
-	;;
-    *)
-	/sbin/modprobe ide-generic
-	;;
-esac

Modified: trunk/udev/mount.sh
===================================================================
--- trunk/udev/mount.sh	2005-12-07 03:51:30 UTC (rev 858)
+++ trunk/udev/mount.sh	2005-12-07 06:41:11 UTC (rev 859)
@@ -1,6 +1,22 @@
-#! /bin/bash
+#!/bin/sh
+########################################################################
+#
+# Description : Input devices
+#
+# Authors     : Based on Open Suse Udev Rules
+#               kay.sievers at suse.de
+#
+# Adapted to  : Jim Gifford
+# LFS
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
 
-. /etc/sysconfig/hardware/scripts/functions
+. /etc/sysconfig/rc
+. ${rc_functions}
 . /etc/sysconfig/storage
 
 test "$HOTPLUG_MOUNT_FSTAB" != yes && exit
@@ -19,7 +35,7 @@
 for sl in `udevinfo -q symlink -p $DEVPATH`; do
 	NODES="$NODES /dev/$sl"
 done
-info_mesg "Avilable nodes: $NODES"
+boot_mesg "Avilable nodes: $NODES"
 
 NODE=
 declare -i FSCK=0
@@ -32,8 +48,8 @@
 			esac
 			NODE="$n"
 			FSCK="$fsck"
-			info_mesg "matching line for $DEVNAME:"
-			info_mesg "$dn $mp $fs $opts $dump $fsck $x"
+			boot_mesg "matching line for $DEVNAME:"
+			boot_mesg "$dn $mp $fs $opts $dump $fsck $x"
 			break 2
 		fi
 	done
@@ -42,11 +58,11 @@
 if [ "$HOTPLUG_CHECK_FILESYSTEMS" == yes -a "$FSCK" -gt 0 ] ; then
 	MESSAGE="`fsck -a $DEVNAME`"
 	RET=$?
-	info_mesg "$MESSAGE"
+	boot_mesg "$MESSAGE"
 	case $RET in
 		0|1) : ;;
 		2|3) 
-			info_mesg "Please unplug device $DEVNAME, and plug it again" 
+			boot_mesg "Please unplug device $DEVNAME, and plug it again" 
 			logger -t $0 "fsck for '$DEVNAME' failed. Will not mount it."
 			exit 0
 			;;
@@ -62,5 +78,5 @@
 if [ -n "$NODE" ] ; then
 	MESSAGE="`mount -av "$NODE"`"
 	test $? != 0 && logger -t $0 "Could not mount '$DEVNAME'."
-	info_mesg "$MESSAGE"
+	boot_mesg "$MESSAGE"
 fi




More information about the cross-lfs mailing list