[dahdi-commits] tzafrir: tools/trunk r7752 - /tools/trunk/xpp/xpp_fxloader

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Jan 4 10:38:04 CST 2010


Author: tzafrir
Date: Mon Jan  4 10:38:01 2010
New Revision: 7752

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7752
Log:
xpp_fxloader: adapt to newer kernels

This commit prepares xpp_fxloader to get hotplug envirnment from newer kernel
versions:
* DEVICE will eventually be replaced with DEVNAME. Accept both (and look
  at DEVNAME first).
* If we get DEVICE, we'll probably get an invalid path based at
  /proc/bus/usb . Fix it to use /dev/bus/usb .
* While we're at it, allow using PRODUCT from the envirnment instead of
  from the command-line.

This should allow fixing udev rules but will also work with existing
rules in DAHDI-linux (for systems where they are valid).

Modified:
    tools/trunk/xpp/xpp_fxloader

Modified: tools/trunk/xpp/xpp_fxloader
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/xpp/xpp_fxloader?view=diff&rev=7752&r1=7751&r2=7752
==============================================================================
--- tools/trunk/xpp/xpp_fxloader (original)
+++ tools/trunk/xpp/xpp_fxloader Mon Jan  4 10:38:01 2010
@@ -246,9 +246,17 @@
 # to run manually, pass the parameter 'xppdetect'
 case "$1" in
 udev) 
-	# the following emulate hotplug's environment from udev's environment:
-	DEVICE="$DEVNAME"
-	PRODUCT="$2"
+	# Various kernel versions use different sets of variables.
+	# Here we want to make sure we have 'DEVICE' and 'PRODUCT' set
+	# up. DEVICE is now deprecated in favour of DEVNAME. It will
+	# likely to contain an invalid name if /proc/bus/usb is not
+	# mounted. So it needs further cooking.
+	DEVICE="${DEVNAME:-$DEVICE}"
+	case "$DEVICE" in /proc/*) DEVICE="/dev${DEVICE#/proc}" ;; esac
+	# PRODUCT contains 'vendor_id'/'product_id'/'version' . We
+	# currently pass it as a parameter, but might as well get it
+	# from the envirnment.
+	PRODUCT="${PRODUCT:-$2}"
 	# skip on to the rest of the script. Don't exit.
 	;;
 reset-wait)




More information about the dahdi-commits mailing list