diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-01-10 11:02:04 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-01-10 11:02:04 +0000 |
commit | 7fc953834fc94c2283ab9f4110048c8754382ef6 (patch) | |
tree | 41eb50a5104d46d4f5538ed454b9559f1995eee6 | |
parent | 0f21592bfc112331526fd39806eb17f759c12eb2 (diff) |
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 from trunk (for systems where they are valid).
Merged revisions 7752 via svnmerge from
http://svn.digium.com/svn/dahdi/tools/trunk
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/branches/2.2@7814 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | xpp/xpp_fxloader | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xpp/xpp_fxloader b/xpp/xpp_fxloader index e3180eb..5af6f7f 100644 --- a/xpp/xpp_fxloader +++ b/xpp/xpp_fxloader @@ -244,9 +244,17 @@ astribank_is_starting -a # 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) |