diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-01-04 16:38:01 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-01-04 16:38:01 +0000 |
commit | 008083c0d726543d98822910b5dd6f1383209294 (patch) | |
tree | 350612ac2524ce098b2614cb1a47c3613156be65 /xpp/xpp_fxloader | |
parent | 07ab06bbd0a89888a7ed793f6cfa6164c47f9615 (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 (for systems where they are valid).
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7752 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/xpp_fxloader')
-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 b572f36..d268f8f 100644 --- a/xpp/xpp_fxloader +++ b/xpp/xpp_fxloader @@ -246,9 +246,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) |