r1602 - / trunk/udev

jim at linuxfromscratch.org jim at linuxfromscratch.org
Sun May 14 17:54:53 PDT 2006


Author: jim
Date: 2006-05-14 18:54:52 -0600 (Sun, 14 May 2006)
New Revision: 1602

Modified:
   /
   trunk/udev/
   trunk/udev/35-helper.rules
   trunk/udev/cdsymlink_helper.sh
Log:
 r3506 at server (orig r1639):  jim | 2006-05-14 17:41:04 -0700
  r3505 at server:  jim | 2006-05-14 17:40:44 -0700
  Enhancements to the cdrom symlinks add on
 



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - b6734a72-470d-0410-b049-f317dca95413:/:1636
   + b6734a72-470d-0410-b049-f317dca95413:/:1639


Property changes on: trunk/udev
___________________________________________________________________
Name: svk:merge
   - 38c7b366-470d-0410-a457-935707c16d9b:/udev:3485
3949c430-d905-0410-97b6-f115d20341b5:/udev:1348
3b7552df-c20a-0410-b7e1-d7eaf1be8828:/udev:1263
   + 38c7b366-470d-0410-a457-935707c16d9b:/udev:3505
3949c430-d905-0410-97b6-f115d20341b5:/udev:1348
3b7552df-c20a-0410-b7e1-d7eaf1be8828:/udev:1263

Modified: trunk/udev/35-helper.rules
===================================================================
--- trunk/udev/35-helper.rules	2006-05-14 23:30:02 UTC (rev 1601)
+++ trunk/udev/35-helper.rules	2006-05-15 00:54:52 UTC (rev 1602)
@@ -23,17 +23,17 @@
 BUS=="scsi",	KERNEL=="scd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode"
 BUS=="scsi",	KERNEL=="sg[0-9]*", ACTION=="add", DRIVER=="sr", GROUP="cdrom"
 
-BUS=="ide",	ENV{ID_CDROM}=="?*", PROGRAM="cdsymlink_helper.sh %k", SYMLINK+="cdrom%c", GROUP="cdrom"
-BUS=="ide",	ENV{ID_CDROM_CD_R}=="?*", PROGRAM="cdsymlink_helper.sh %k", SYMLINK+="cdr%c"
-BUS=="ide",	ENV{ID_CDROM_CD_RW}=="?*", PROGRAM="cdsymlink_helper.sh %k", SYMLINK+="cdrw%c"
-BUS=="ide",	ENV{ID_CDROM_DVD}=="?*", PROGRAM="cdsymlink_helper.sh %k", SYMLINK+="dvd%c"
-BUS=="ide",	ENV{ID_CDROM_DVD_R}=="?*", PROGRAM="cdsymlink_helper.sh %k", SYMLINK+="dvdrw%c"
+BUS=="ide",	ENV{ID_CDROM}=="?*", PROGRAM="cdsymlink_helper.sh %k ide", SYMLINK+="cdrom%c"
+BUS=="ide",	ENV{ID_CDROM_CD_R}=="?*", PROGRAM="cdsymlink_helper.sh %k ide", SYMLINK+="cdr%c"
+BUS=="ide",	ENV{ID_CDROM_CD_RW}=="?*", PROGRAM="cdsymlink_helper.sh %k ide", SYMLINK+="cdrw%c"
+BUS=="ide",	ENV{ID_CDROM_DVD}=="?*", PROGRAM="cdsymlink_helper.sh %k ide", SYMLINK+="dvd%c"
+BUS=="ide",	ENV{ID_CDROM_DVD_R}=="?*", PROGRAM="cdsymlink_helper.sh %k ide", SYMLINK+="dvdrw%c"
 
-BUS=="scsi",	ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%n", GROUP="cdrom"
-BUS=="scsi",	ENV{ID_CDROM_CD_R}=="?*", SYMLINK+="cdr%n"
-BUS=="scsi",	ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%n"
-BUS=="scsi",	ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%n"
-BUS=="scsi",	ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%n"
+BUS=="scsi",	ENV{ID_CDROM}=="?*", PROGRAM="cdsymlink_helper.sh %k scsi", SYMLINK+="cdrom%c"
+BUS=="scsi",	ENV{ID_CDROM_CD_R}=="?*", PROGRAM="cdsymlink_helper.sh %k scsi", SYMLINK+="cdr%c"
+BUS=="scsi",	ENV{ID_CDROM_CD_RW}=="?*", PROGRAM="cdsymlink_helper.sh %k scsi", SYMLINK+="cdrw%c"
+BUS=="scsi",	ENV{ID_CDROM_DVD}=="?*", PROGRAM="cdsymlink_helper.sh %k scsi", SYMLINK+="dvd%c"
+BUS=="scsi",	ENV{ID_CDROM_DVD_R}=="?*", PROGRAM="cdsymlink_helper.sh %k scsi", SYMLINK+="dvdrw%c"
 
 # adds floppy devices
 KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{cmos} -m %M /dev/%k"t

Modified: trunk/udev/cdsymlink_helper.sh
===================================================================
--- trunk/udev/cdsymlink_helper.sh	2006-05-14 23:30:02 UTC (rev 1601)
+++ trunk/udev/cdsymlink_helper.sh	2006-05-15 00:54:52 UTC (rev 1602)
@@ -15,17 +15,41 @@
 . /etc/sysconfig/udev_helper
 
 KERN_NAME="$1"
+BUS="$2"
+test=0
 
 if [ "$KERN_NAME" = "" ]; then
 	mesg Bad invocation: \$1 is not set
 	exit 1
 fi
 
-FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep 1.`"
-	for file in $FILES; do
-		TEST="`ls /sys/bus/ide/drivers/ide-cdrom/$file | grep -c $KERN_NAME`"
-		if [ "$TEST" = "1" ]; then
-			link="`echo $file | cut -f2 -d.`"
-			echo $link
-		fi
-	done
+if [ "$BUS" = "ide" ]; then
+	FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep '\.' `"
+		for file in $FILES; do
+			TEST="`ls /sys/bus/ide/drivers/ide-cdrom/$file | grep -c $KERN_NAME`"
+			if [ "$TEST" = "1" ]; then
+				link="`echo $file | cut -f2 -d.`"
+				while [ $test -lt 1 ] ; do
+					if [ -e /dev/cdrom$link ]; then
+						link=$[$link+1]
+					else
+						test=1
+						echo $link
+					fi
+				done
+			fi
+		done
+fi
+
+if [ "$BUS" = "scsi" ]; then
+	link=$KERN_NAME
+		while [ $test -lt 1 ] ; do
+			if [ -e /dev/cdrom$link ]; then
+				link=$[$link+1]
+			else
+				test=1
+				echo $link
+			fi
+		done
+fi
+




More information about the cross-lfs mailing list