summaryrefslogtreecommitdiff
path: root/xpp/utils/xpp_fxloader
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-09 19:12:55 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-09 19:12:55 +0000
commitcc599ab08d6f58a2d5e57db4150e2f9efe1112b8 (patch)
tree3f6df61996f5a6df4f05cd447c2b120ae8b4669e /xpp/utils/xpp_fxloader
parenteeaa77f409b4e0e158e62cb852e462ccef317f3f (diff)
Merged revisions 2123-2124 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.4 ........ r2123 | tzafrir | 2007-02-08 02:05:17 +0200 (Thu, 08 Feb 2007) | 27 lines Branch 1.4 is back in sync (currently: xorcom rev. 3332): * Performance improvements for multi-XPD (span) devices. * Astribank BRI driver (in next commit). * Changes under /proc: - XBUS and XPD numbers have two digits. - Every script wildcard should be replaced from XBUS-? to XBUS-[0-9]* - Added /proc/xpp/XBUS-*/XPD-*/blink: echo 1 to start and 0 to stop. * Several countries (South Africa, UAE, anybody else) require a shorter ring delay. Adjust FXO reg 0x17 (23)'s bits 0:2 to 011. * Use tasklets to move most of the interrupt PCM copying out of the interrupt. * Debugfs-based code to dump data to userspace (used to debug BRI D channel). * Pretend every 2.6.9 actually has later RHEL's typedefs. * fpga_load supports /dev/bus/usb . * Fixed physical order sorting in genzaptelconf. * Reverse polarity and power denial detection. * A short led flash at registration time. * Add a real version of the xpp modules to them (independent of the Zaptel version). * Update our line status even when not registered. * Fixed a false SIG_CHANGED when inserting or removing cable to FXO. * Fixed compilation fixes for 2.6.20 (Bug #8982) * A cleaner fix for the bool changes of 2.6.19 . * Automatically detect echo_can_state_t at debug time. * Automaitcally set XPP_DEBUGFS (depending on debugfs) at compile time. * Bug-fixes to zaptel-helper. Moved to xpp/utils . * Xbus protocol version: 2.4 (Zaptel 1.2.12/1.4.0 had 2.3). XPS Init scripts renamed accordingly. ........ r2124 | tzafrir | 2007-02-08 02:30:56 +0200 (Thu, 08 Feb 2007) | 1 line Now 'chans' is used after all. ........ git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2144 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/xpp_fxloader')
-rw-r--r--xpp/utils/xpp_fxloader53
1 files changed, 29 insertions, 24 deletions
diff --git a/xpp/utils/xpp_fxloader b/xpp/utils/xpp_fxloader
index b14f746..918a712 100644
--- a/xpp/utils/xpp_fxloader
+++ b/xpp/utils/xpp_fxloader
@@ -1,8 +1,8 @@
#!/bin/sh
-# xpp_fxload: load XPP firmware
+# xpp_fxloader: load Xorcom Astribank (XPP) firmware
#
-# This script can be run manually or from hotplug.
+# This script can be run manually or from hotplug/udev.
#
# Firmware files should be located in $FIRMWARE_DIR which defaults:
# 1. /usr/share/zaptel
@@ -12,28 +12,21 @@
# Manual Run
# ##########
#
-# path/to/xpp_fxloader xppdetect
+# path/to/xpp_fxloader load
#
# Make sure the firmware files are in $FIRMWARE_DIR
#
+# UDEV Installation
+# #################
#
-# Hotplg Run
-# ##########
+# Copy xpp.rules to /etc/udev/udev.d and xpp_fxloader to /etc/hotplug/usb/ .
#
-# 1. Copy this file and the file xpp_fxloader.usermap to /etc/hotplug/usb/
-# 2. tail -f /var/log/messages...
+# Hotplug Installation
+# ####################
#
-#
-# Suggested udev configuration: I used the following file as
-# /etc/udev/rules.d/z60_zaptel.rules :
+# Copy this file and the file xpp_fxloader.usermap to /etc/hotplug/usb/ .
#
-# BUS!="usb", ACTION!="add", GOTO="zaptel_usb_add_end"
#
-# SYSFS{idVendor}=="e4e4", SYSFS{idProduct}=="11[345][01]", \
-# RUN+="/etc/hotplug/usb/xpp_fxloader udev $sysfs{idVendor}/$sysfs{idProduct}/$sysfs{bcdDevice}"
-#
-# LABEL="zaptel_usb_add_end"
-#
# Written by Tzafrir Cohen <tzafrir.cohen@xorcom.com>
# Copyright (C) 2006, Xorcom
#
@@ -64,16 +57,28 @@ else
LOGGER="logger -i -t '$me'"
fi
-if [ -r "$DEFAULTS" ]; then
- . "$DEFAULTS"
-fi
+USBFS_PREFIX=/proc/bus/usb
+DEVUSB_PREFIX=/dev/bus/usb
+USB_PREFIX=
FIRMWARE_DIR="${FIRMWARE_DIR:-/usr/share/zaptel}"
FIRM_FXS=$FIRMWARE_DIR/FPGA_FXS.hex
REENUM_SLEEP_TIME=3 # only used on manual runs
-FPGA_LOAD="/usr/sbin/fpga_load"
+FPGA_LOAD=${FPGA_LOAD:-/usr/sbin/fpga_load}
+
+if [ -r "$DEFAULTS" ]; then
+ . "$DEFAULTS"
+fi
+
+if [ "$USB_PREFIX" = '' ]; then
+ if [ -d "$DEVUSB_PREFIX" ]; then
+ USB_PREFIX=$DEVUSB_PREFIX
+ elif [ -r "$USBFS_PREFIX/devices" ]; then
+ USB_PREFIX=$USBFS_PREFIX
+ fi
+fi
# With Kernels older that 2.6.10 it seems to be possible
# to trigger a race condition by running fxload or fpga_load
@@ -90,7 +95,7 @@ find_dev() {
v_id=$1
p_id=$2
- lsusb | tr -d : | awk "/ ID $v_id$p_id/{printf \"/proc/bus/usb/%s/%s \",\$2,\$4}"
+ lsusb | tr -d : | awk "/ ID $v_id$p_id/{printf \"$USB_PREFIX/%s/%s \",\$2,\$4}"
}
do_fxload() {
@@ -128,7 +133,7 @@ load_fpga() {
devices=`find_dev $v_id $p_id`
for dev in $devices
do
- card_ver=`$FPGA_LOAD -d -D $dev`
+ card_ver=`$FPGA_LOAD -g -D $dev | sed -n 's/^.*Release: *//'`
firm_ver=`hexfile_version $FIRMWARE_DIR/$fw`
$LOGGER "FPGA Firmware $FIRMWARE_DIR/$fw into $dev"
@@ -151,7 +156,7 @@ load_fpga() {
case "$1" in
udev)
# the following emulate hotplug's environment from udev's environment:
- DEVICE=`echo $DEVNAME | sed -e 's|^/dev/|/proc/|'`
+ DEVICE="$DEVNAME"
PRODUCT="$2"
# skip on to the rest of the script. Don't exit.
;;
@@ -190,7 +195,7 @@ esac
## Hotplug run
##
-if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
+if [ "$ACTION" = "add" ] && [ -w "$DEVICE" ]
then
$LOGGER "Trying to find what to do for product $PRODUCT, device $DEVICE"
prod_id=`echo "$PRODUCT" | cut -d/ -f2`