xpp: xpp_fxloader: regressions from r10348
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>
Sun, 4 Dec 2011 15:33:21 +0000 (15:33 +0000)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Sun, 4 Dec 2011 15:33:21 +0000 (15:33 +0000)
* Avoid a duplicated run of udev on some systems.
* Fix usage of astribank_tool's output.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10366 17933a7a-c749-41c5-a318-cba88f637d49

xpp/xpp_fxloader

index 49a8cd4..e0a7731 100644 (file)
@@ -278,11 +278,12 @@ load_fw_device() {
                echo_file="$FIRMWARE_DIR/OCT6104E-256D.ima"
                law=''
                law_str='uLaw'
-               card_type=`run_astribank_tool -D "$dev" -Q 2>&1 | grep 'CARD 4' | sed -e 's/.*type=//' -e 's/\..*//'`
-               caps_num=`run_astribank_tool -D "$dev" -Q 2>&1 | grep 'ECHO ports' | sed -e 's/.*: *//'`
-               if [ $card_type -eq 5 ]; then
+               abtool_output=`$ASTRIBANK_TOOL -D "$dev" -Q 2>&1`
+               ec_card_type=`echo "$abtool_output" | grep 'CARD 4' | sed -e 's/.*type=//' -e 's/\..*//'`
+               caps_num=`echo "$abtool_output" | grep 'ECHO ports' | sed -e 's/.*: *//'`
+               if [ "$ec_card_type" = '5' ]; then
                        debug "ECHO burning into $dev: $echo_file"
-                       card_type=`run_astribank_tool -D "$dev" -Q 2>&1 | grep 'CARD 0' | sed -e 's/.*type=//' -e 's/\..*//'`
+                       card_type=`echo "$abtool_output" | grep 'CARD 0' | sed -e 's/.*type=//' -e 's/\..*//'`
                        case "$card_type" in
                        3)      law="-A";;
                        4)
@@ -541,6 +542,9 @@ udev_delayed_load() {
                usb_firmware_device "$PRODUCT" "$DEVICE"
                ;;
        e4e4/11[3456]1/*)
+               # There are potentially two separate udev events, for
+               # each of the two endpoints. Ignore the first interface:
+               case "$DEVPATH" in *.0) exit 0;; esac
                sleep_if_race
                fpga_firmware_device "$PRODUCT" "$DEVICE" &
                wait    # parallel firmware loading