Author: pebender
Date: Mon Jan 12 17:27:56 2009
New Revision: 4232

Added:
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_persistent
       - copied, changed from r4219,  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_uid
Removed:
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_uid
Modified:
    trunk/gar-minimyth/html/minimyth/document-changelog.txt
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/03-minimyth-persistent.rules

Log:
- Added an instance number to persistent device names to remove any
   chance of duplicate names.
- Renamed mm_uid to mm_persistent.



Modified: trunk/gar-minimyth/html/minimyth/document-changelog.txt
==============================================================================
--- trunk/gar-minimyth/html/minimyth/document-changelog.txt     (original)
+++ trunk/gar-minimyth/html/minimyth/document-changelog.txt     Mon Jan 12  
17:27:56 2009
@@ -46,6 +46,9 @@
        MythTV programs (mythbackend, mythfrontend and mythwelcome) run as  
user
        'minimyth'.
      - Added support for loading coretemp kernel driver on more hardware.
+    - Added an instance number to persistent device names to remove any
+      chance of duplicate names.
+    - Renamed mm_uid to mm_persistent.

  Modified udev
      - Renamed 06-minimyth-mythtv.rules to 07-minimyth-mythtv.rules.
@@ -68,6 +71,8 @@
         
<http://lists.freedesktop.org/archives/xorg/2008-October/039591.html>.
      - Fixed a bug that would cause MM_X_MODELINE_0, MM_X_MODELINE_1 and
        MM_X_MODELINE_2 to fail with perl init scripts.
+    - Added an instance number to persistent device names to remove any
+      chance of duplicate names.

  Updated packages
      Updated disk/hdparm.

Copied:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_persistent
  
(from r4219,  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_uid)
==============================================================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_uid    
 
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/mm_persistent
       
Mon Jan 12 17:27:56 2009
@@ -1,14 +1,14 @@
  #!/bin/sh
   
################################################################################
-# mm_uid
+# mm_persistent
  #
-# This script provides a unique identifier based on hardware information.
+# This script provides a persistent device name based on hardware  
information.
  #
  # The output has the formats:
-#      
<kernel>-pci:<class>:<class_prog>:<vendor>:<device>:<subsystem_vendor>:<subsystem_device>:<bus_id>
-#     <kernel>-phys:<phys>
-#     <kernel>-usb:<idVendor>:<idProduct>:<serial>:<bInterfaceNumber>
-#     <kernel>-wminput:<phys>
+#      
persistent/<kernel>-pci:<class>:<class_prog>:<vendor>:<device>:<subsystem_vendor>:<subsystem_device>:<bus_id>:<instance>
+#     persistent/<kernel>-phys:<phys>:<instance>
+#      
persistent/<kernel>-usb:<idVendor>:<idProduct>:<serial>:<bInterfaceNumber>:<instance>
+#     persistent/<kernel>-wminput:<phys>:<instance>
   
################################################################################

  script='BEGIN
@@ -16,11 +16,11 @@
              FS="\n"
              RS=""
              kernel=""
-            mm_uid=""
+            mm_persistent=""
              phys=""
              bInterfaceNumber=""
          }
-        mm_uid !~ /^$/ { next }
+        mm_persistent !~ /^$/ { next }
          $1 !~ /^ *looking at / { next }
          {
              x = 1
@@ -65,7 +65,7 @@
                      x++
                  }
                  if ( phys ) {
-                    mm_uid=kernel "-phys:" phys
+                    mm_persistent=kernel "-phys:" phys
                  }
              }
              if ( subsystem == "input" ) {
@@ -91,7 +91,7 @@
                      }
                  }
                  if ( ( driver == "" ) && ( name == "Nintendo Wiimote" ) &&  
( phys ) ) {
-                    mm_uid=kernel "-wminput:" phys
+                    mm_persistent=kernel "-wminput:" phys
                  }
              }
              if ( subsystem == "pci" ) {
@@ -139,7 +139,7 @@
                      }
                  }
                  if ( class && class_prog && vendor && device &&  
subsystem_vendor && subsystem_device && bus_id ) {
-                    mm_uid=kernel "-pci:" class ":" class_prog ":"  
vendor ":" device ":" subsystem_vendor ":" subsystem_device ":" bus_id
+                    mm_persistent=kernel "-pci:" class ":" class_prog ":"  
vendor ":" device ":" subsystem_vendor ":" subsystem_device ":" bus_id
                  }
              }
              if ( subsystem == "serio" ) {
@@ -147,7 +147,7 @@
                      x++
                  }
                  if ( phys ) {
-                    mm_uid=kernel "-phys:" phys
+                    mm_persistent=kernel "-phys:" phys
                  }
              }
              if ( subsystem == "usb" ) {
@@ -185,14 +185,31 @@
                      }
                  }
                  if ( idVendor && idProduct ) {
-                    mm_uid=kernel "-usb:" idVendor ":" idProduct ":"  
serial ":" bInterfaceNumber
+                    mm_persistent=kernel "-usb:" idVendor ":"  
idProduct ":" serial ":" bInterfaceNumber
                  }
              }
-            if ( mm_uid ) {
-                print mm_uid
+            if ( mm_persistent ) {
+                print mm_persistent
              }
          }'

-/sbin/udevadm info --attribute-walk --path ${DEVPATH} |  
/usr/bin/awk "${script}"
+mm_persistent=`/sbin/udevadm info --attribute-walk --path ${DEVPATH} |  
/usr/bin/awk "${script}"`
+if /usr/bin/test -n "${mm_persistent}" ; then
+    mm_persistent="persistent/${mm_persistent}"
+    # Add an instance number. Ideally, the instance number will always be  
0.
+    # However, some device vendors fail to fill in all the fields (e.g.  
serial
+    # number, and interface number) resulting in non-unique names. Adding  
an
+    # instance number ensures that the name will be unique.
+    instance=0
+    while /bin/true ; do
+        if /usr/bin/test ! -e "/dev/${mm_persistent}:${instance}" ; then
+            break
+        fi
+        instance=$((${instance} + 1))
+    done
+    mm_persistent="${mm_persistent}:${instance}"
+fi
+
+/bin/echo "${mm_persistent}"

  exit 0

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/03-minimyth-persistent.rules
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/03-minimyth-persistent.rules
        
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/03-minimyth-persistent.rules
        
Mon Jan 12 17:27:56 2009
@@ -2,11 +2,11 @@
  #
   
#-------------------------------------------------------------------------------
  ACTION!="add|change", GOTO="end"
-KERNEL=="event[0-9]*",  SUBSYSTEM=="input", PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
-KERNEL=="hiddev[0-9]*", SUBSYSTEM=="usb",   PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
-KERNEL=="js[0-9]*",     SUBSYSTEM=="input", PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
-KERNEL=="lcd[0-9]*",    SUBSYSTEM=="lcd",   PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
-KERNEL=="lirc[0-9]*",   SUBSYSTEM=="lirc",  PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
-KERNEL=="mouse[0-9]*",  SUBSYSTEM=="input", PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
-KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty",   PROGRAM="mm_uid",  
RESULT=="?*", SYMLINK+="persistent/$result", GOTO="end"
+KERNEL=="event[0-9]*",  SUBSYSTEM=="input", PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
+KERNEL=="hiddev[0-9]*", SUBSYSTEM=="usb",   PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
+KERNEL=="js[0-9]*",     SUBSYSTEM=="input", PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
+KERNEL=="lcd[0-9]*",    SUBSYSTEM=="lcd",   PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
+KERNEL=="lirc[0-9]*",   SUBSYSTEM=="lirc",  PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
+KERNEL=="mouse[0-9]*",  SUBSYSTEM=="input", PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
+KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty",   PROGRAM="mm_persistent",  
RESULT=="?*", SYMLINK+="$result", GOTO="end"
  LABEL="end"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"minimyth-commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/minimyth-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to