blob: 6c07e94320e0c811f399f4f4fd587a5e68eec92b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#! /bin/sh
#
# $Id$
#
# This script is run from the xpp kernel module upon detection
# of a new XPD.
#
# Expects the following environment variables to be set:
# XPD_BUS - bus name
# XPD_NAME - xpd name
# XPD_TYPE - xpd type number (from protocol reply):
# 3 - FXS
# 4 - FXO
# XPD_REVISION - xpd revision number
set -e
LOGGER="logger -i -t `basename $0`"
opermode='FCC'
INIT_DIR=`dirname $0`
XPP_BASE=/proc/xpp
if [ -r /etc/default/zaptel ]
then . /etc/default/zaptel
fi
export XPP_BASE
SLICS="$XPP_BASE/$XPD_BUS/$XPD_NAME/slics"
FILE="$INIT_DIR/init_data_${XPD_TYPE}_${XPD_REVISION}.cmd"
set_daa_country_params() {
# based on fxo_modes from wctdm.c . TODO: more decent calculation?
reg16=00; reg26=00; reg30=00; reg31=A3; ring_osc=; ring_x=;
mode="$1"
# TODO: a saner fall-back in case of an unknown mode
if [ "$mode" = '' ]; then mode='FCC'; fi
if [ -r $INIT_DIR/init_fxo_modes ]; then
. $INIT_DIR/init_fxo_modes
fi
cat <<EOF >$SLICS
FF FF 00 00 WD 10 $reg16
FF FF 00 00 WD 1A $reg26
FF FF 00 00 WD 1E $reg30
FF FF 00 00 WD 1F $reg31
EOF
# for the FXS:
#if [ "$ring_osc" != '' ]; then
# /bin/echo "31 WI __ $ring_osc" >$SLICS
#fi
#if [ "$ring_x" != '' ]; then
# /bin/echo "31 WI __ $ring_x" >$SLICS
#fi
}
if [ ! -f "$SLICS" ]; then
$LOGGER "missing register file '$SLICS'"
exit 1
fi
if [ ! -f "$FILE" ]; then
$LOGGER "missing register initialization file '$FILE'"
exit 1
fi
case "$XPD_TYPE" in
3|4)
if [ "$XPD_TYPE" = 3 ]; then "$INIT_DIR/calibrate_slics"; fi
cat "$FILE" > "$SLICS"
if [ "$XPD_TYPE" = 4 ]; then set_daa_country_params "$opermode"; fi
;;
*)
$LOGGER "Unknown type '$XPD_TYPE'"
exit 2
esac
$LOGGER "Wrote '$FILE' into '$SLICS'"
exit 0
|