[svn-commits] tzafrir: branch 1.2 r2113 - in /branches/1.2/xpp: ./
utils/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Feb 7 13:58:47 MST 2007
Author: tzafrir
Date: Wed Feb 7 14:58:46 2007
New Revision: 2113
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2113
Log:
xpp driver rev. 3332:
* 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.
Added:
branches/1.2/xpp/utils/xpp.rules (with props)
branches/1.2/xpp/utils/zaptel-helper (with props)
Removed:
branches/1.2/xpp/zaptel-helper
Modified:
branches/1.2/xpp/ (props changed)
branches/1.2/xpp/Makefile
branches/1.2/xpp/card_fxo.c
branches/1.2/xpp/card_fxs.c
branches/1.2/xpp/card_global.c
branches/1.2/xpp/init_card_3_24 (props changed)
branches/1.2/xpp/init_card_4_24 (contents, props changed)
branches/1.2/xpp/init_card_6_24 (contents, props changed)
branches/1.2/xpp/init_card_7_24 (contents, props changed)
branches/1.2/xpp/utils/Makefile
branches/1.2/xpp/utils/genzaptelconf
branches/1.2/xpp/utils/xpp_fxloader
branches/1.2/xpp/xbus-core.c
branches/1.2/xpp/xdefs.h
branches/1.2/xpp/xpd.h
branches/1.2/xpp/xpp_usb.c
branches/1.2/xpp/xpp_zap.c
Propchange: branches/1.2/xpp/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Wed Feb 7 14:58:46 2007
@@ -1,7 +1,5 @@
283159da-0705-0410-b60c-f2062b4bb6ad:/components/xpp-zaptel/branches/RELEASE-1.2.0/xpp:2948
-283159da-0705-0410-b60c-f2062b4bb6ad:/components/xpp-zaptel/trunk/xpp:2830
-
+283159da-0705-0410-b60c-f2062b4bb6ad:/components/xpp-zaptel/trunk/xpp:3332
f558416c-6c06-0410-9f27-dde2687782d0:/branches/1.4/xpp:1623
f558416c-6c06-0410-9f27-dde2687782d0:/team/tzafrir/xpp_1.2/xpp:1554
-
f558416c-6c06-0410-9f27-dde2687782d0:/trunk/xpp:1453
Propchange: branches/1.2/xpp/
------------------------------------------------------------------------------
--- svn:executable (original)
+++ svn:executable Wed Feb 7 14:58:46 2007
@@ -1,1 +1,1 @@
-calibrate_slics
+utils/zaptel-helper
Propchange: branches/1.2/xpp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Feb 7 14:58:46 2007
@@ -5,3 +5,4 @@
*.mod.c
.tmp_versions
.*.swp
+xpp_version.h
Modified: branches/1.2/xpp/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/Makefile?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/Makefile (original)
+++ branches/1.2/xpp/Makefile Wed Feb 7 14:58:46 2007
@@ -3,18 +3,20 @@
-DDEBUG \
-DPOLL_DIGITAL_INPUTS \
-DWITH_ECHO_SUPPRESSION \
- -DPROTOCOL_DEBUG \
- -DZAPTEL_EC_TYPEDEF \
+ -DPROTOCOL_DEBUG
-# Useful for Astribank-BRI debugging, and maybe more later on.
-# Requires debugfs support in the kernel.
-# -DXPP_DEBUGFS
+ifneq (,$(filter y m,$(CONFIG_DEBUG_FS)))
+EXTRA_CFLAGS += -DXPP_DEBUGFS
+endif
+ifneq (,$(shell grep -w echo_can_state_t $(ZAPTEL_DIR)/zaptel.h))
+EXTRA_CFLAGS += -DZAPTEL_EC_TYPEDEF
+endif
-DRIVER_DIR = $(SUBDIRS)
+ZAPTEL_DIR = $(SUBDIRS)
obj-m += xpp.o xpd_fxs.o xpd_fxo.o
-HAS_BRISTUFF := $(shell cpp $(CPPFLAGS) -dM $(DRIVER_DIR)/zconfig.h | sed -n 's/^.*CONFIG_ZAPATA_BRI_DCHANS/y/p')
+HAS_BRISTUFF := $(shell cpp $(CPPFLAGS) -dM $(ZAPTEL_DIR)/zconfig.h | sed -n 's/^.*CONFIG_ZAPATA_BRI_DCHANS/y/p')
# Build only supported modules
ifneq (,$(filter y m,$(CONFIG_USB)))
@@ -31,3 +33,20 @@
ctags:
ctags *.[ch]
+
+# Handle versioning
+XPP_VERSION_STR ?= $(shell if [ -r $(obj)/.version ]; then echo "\"`cat $(obj)/.version`\""; else echo '"Unknown"'; fi)
+clean-files := xpp_version.h
+
+$(obj)/card_fxs.o $(obj)/card_fxo.o $(obj)/card_bri.o $(obj)/xpp_usb.o $(obj)/xpp.o: $(obj)/xpp_version.h
+
+$(obj)/xpp_version.h: FORCE
+ $(Q)echo "Compile for $(XPP_VERSION_STR)"
+ $(Q)echo '#define XPP_VERSION $(XPP_VERSION_STR)' > $@.tmp
+ $(Q)if cmp -s $@.tmp $@ ; then echo; else \
+ mv $@.tmp $@ ; \
+ fi
+ $(Q)rm -f $@.tmp
+
+.PHONY: FORCE
+FORCE:
Modified: branches/1.2/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/card_fxo.c?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/card_fxo.c (original)
+++ branches/1.2/xpp/card_fxo.c Wed Feb 7 14:58:46 2007
@@ -33,9 +33,9 @@
static const char rcsid[] = "$Id$";
-DEF_PARM(int, print_dbg, 0, "Print DBG statements");
-DEF_PARM(uint, poll_battery_interval, 100, "Poll battery interval in milliseconds (0 - disable)");
-DEF_PARM(bool, report_battery, 0, "Report battery status to zaptel");
+DEF_PARM(int, print_dbg, 0, 0600, "Print DBG statements");
+DEF_PARM(uint, poll_battery_interval, 100, 0600, "Poll battery interval in milliseconds (0 - disable)");
+DEF_PARM(int, ring_debounce, 50, 0600, "Number of ticks to debounce a false RING indication");
/* Signaling is opposite (fxs signalling for fxo card) */
#if 1
@@ -79,33 +79,38 @@
#define PROC_REGISTER_FNAME "slics"
#define PROC_FXO_INFO_FNAME "fxo_info"
+#define DAA_CURRENT_REGISTER 0x1C
#define DAA_RING_REGISTER 0x05
struct FXO_priv_data {
- struct proc_dir_entry *regfile;
- struct proc_dir_entry *fxo_info;
- uint poll_counter;
- xpp_line_t battery;
- ushort battery_debounce[CHANNELS_PERXPD];
- xpp_line_t ledstate[NUM_LEDS]; /* 0 - OFF, 1 - ON */
- xpp_line_t ledcontrol[NUM_LEDS]; /* 0 - OFF, 1 - ON */
- int blinking[NUM_LEDS][CHANNELS_PERXPD];
+ struct proc_dir_entry *regfile;
+ struct proc_dir_entry *fxo_info;
+ uint poll_counter;
+ xpp_line_t battery;
+ ushort battery_debounce[CHANNELS_PERXPD];
+ xpp_line_t polarity;
+ ushort polarity_counter[CHANNELS_PERXPD];
+ uint offhook_timestamp[CHANNELS_PERXPD];
+ ushort current_counter[CHANNELS_PERXPD];
+ xpp_line_t ledstate[NUM_LEDS]; /* 0 - OFF, 1 - ON */
+ xpp_line_t ledcontrol[NUM_LEDS]; /* 0 - OFF, 1 - ON */
+ int led_counter[NUM_LEDS][CHANNELS_PERXPD];
+ atomic_t ring_debounce[CHANNELS_PERXPD];
};
+/*
+ * LED counter values:
+ * n>1 : BLINK every n'th tick
+ */
+#define LED_COUNTER(priv,pos,color) ((priv)->led_counter[color][pos])
+#define IS_BLINKING(priv,pos,color) (LED_COUNTER(priv,pos,color) > 0)
+#define MARK_BLINK(priv,pos,color,t) ((priv)->led_counter[color][pos] = (t))
+#define MARK_OFF(priv,pos,color) do { BIT_CLR((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0)
+#define MARK_ON(priv,pos,color) do { BIT_SET((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0)
+
+#define LED_BLINK_RING (1000/8) /* in ticks */
+
/*---------------- FXO: Static functions ----------------------------------*/
-
-#define IS_BLINKING(priv,pos,color) ((priv)->blinking[color][pos] != 0)
-#define MARK_BLINK(priv,pos,color,val) ((priv)->blinking[color][pos] = (val))
-
-void MARK_LED(xpd_t *xpd, lineno_t pos, byte color, bool on)
-{
- struct FXO_priv_data *priv = xpd->priv;
-
- if(on)
- BIT_SET(priv->ledcontrol[color], pos);
- else
- BIT_CLR(priv->ledcontrol[color], pos);
-}
/*
* LED control is done via DAA register 0x20
@@ -153,8 +158,12 @@
if(IS_SET(xpd->digital_outputs, i) || IS_SET(xpd->digital_inputs, i))
continue;
if(xpd->blink_mode || IS_BLINKING(priv,i,color)) {
+ int mod_value = LED_COUNTER(priv, i, color);
+
+ if(!mod_value)
+ mod_value = DEFAULT_LED_PERIOD; /* safety value */
// led state is toggled
- if((timer_count % LED_BLINK_PERIOD) == 0) {
+ if((timer_count % mod_value) == 0) {
DBG("%s/%s/%d: ledstate=%s\n", xpd->xbus->busname, xpd->xpdname, i,
(IS_SET(priv->ledstate[color], i))?"ON":"OFF");
if(!IS_SET(priv->ledstate[color], i)) {
@@ -178,10 +187,11 @@
priv = xpd->priv;
BUG_ON(!priv);
+ atomic_set(&priv->ring_debounce[pos], 0); /* Stop debouncing */
if(on && !xpd->ringing[pos]) {
DBG("%s/%s/%d: START\n", xpd->xbus->busname, xpd->xpdname, pos);
xpd->ringing[pos] = 1;
- MARK_BLINK(priv, pos, LED_GREEN, LED_BLINK);
+ MARK_BLINK(priv, pos, LED_GREEN, LED_BLINK_RING);
if(update_zap)
update_zap_ring(xpd, pos, on);
} else if(!on && xpd->ringing[pos]) {
@@ -214,18 +224,19 @@
mark_ring(xpd, pos, 0, 0); // No more rings
value = (to_offhook) ? 0x09 : 0x08; /* Bit 3 is for CID */
DBG("%s/%s/%d: SETHOOK: value=0x%02X %s\n", xbus->busname, xpd->xpdname, pos, value, (to_offhook)?"OFFHOOK":"ONHOOK");
- MARK_LED(xpd, pos, LED_GREEN, (to_offhook)?LED_ON:LED_OFF);
+ if(to_offhook)
+ MARK_ON(priv, pos, LED_GREEN);
+ else
+ MARK_OFF(priv, pos, LED_GREEN);
ret = DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, DAA_RING_REGISTER, value);
if(to_offhook) {
BIT_SET(xpd->offhook, pos);
+ priv->offhook_timestamp[pos] = priv->poll_counter;
} else {
BIT_CLR(xpd->offhook, pos);
BIT_CLR(xpd->cid_on, pos);
- xpd->delay_until_dialtone[pos] = 0;
}
spin_unlock_irqrestore(&xpd->lock, flags);
- if(to_offhook)
- wake_up_interruptible(&xpd->txstateq[pos]);
return ret;
}
@@ -299,10 +310,20 @@
goto err;
// Hanghup all lines
for_each_line(xpd, i) {
- init_waitqueue_head(&xpd->txstateq[i]);
do_sethook(xpd, i, 0);
}
DBG("done: %s/%s\n", xbus->busname, xpd->xpdname);
+ for_each_line(xpd, i) {
+ do_led(xpd, i, LED_GREEN, 0);
+ }
+ for_each_line(xpd, i) {
+ do_led(xpd, i, LED_GREEN, 1);
+ msleep(50);
+ }
+ for_each_line(xpd, i) {
+ do_led(xpd, i, LED_GREEN, 0);
+ msleep(50);
+ }
return 0;
err:
clean_proc(xbus, xpd);
@@ -343,10 +364,9 @@
cur_chan->pvt = xpd;
cur_chan->sigcap = FXO_DEFAULT_SIGCAP;
}
- MARK_LED(xpd, ALL_LINES, LED_GREEN, LED_OFF);
- for_each_line(xpd, i) {
- MARK_LED(xpd, i, LED_GREEN, LED_ON);
- msleep(50);
+ for_each_line(xpd, i) {
+ MARK_ON(priv, i, LED_GREEN);
+ msleep(4);
}
return 0;
}
@@ -364,8 +384,10 @@
BUG_ON(!priv);
DBG("%s/%s (%d)\n", xbus->busname, xpd->xpdname, on);
for_each_line(xpd, i) {
- MARK_LED(xpd, i, LED_GREEN, LED_OFF);
- msleep(50);
+ MARK_OFF(priv, i, LED_GREEN);
+ msleep(2);
+ // MARK_OFF(priv, i, LED_RED);
+ msleep(2);
}
return 0;
}
@@ -404,6 +426,35 @@
}
}
+static void poll_current(xbus_t *xbus, xpd_t *xpd)
+{
+ int i;
+
+ for_each_line(xpd, i) {
+ if (IS_SET(xpd->offhook, i))
+ DAA_DIRECT_REQUEST(xbus, xpd, i, DAA_READ, DAA_CURRENT_REGISTER, 0);
+ }
+}
+
+static void handle_fxo_ring(xpd_t *xpd)
+{
+ struct FXO_priv_data *priv;
+ int i;
+
+ priv = xpd->priv;
+ for_each_line(xpd, i) {
+ if(atomic_read(&priv->ring_debounce[i]) > 0) {
+ /* Maybe start ring */
+ if(atomic_dec_and_test(&priv->ring_debounce[i]))
+ mark_ring(xpd, i, 1, 1);
+ } else if (atomic_read(&priv->ring_debounce[i]) < 0) {
+ /* Maybe stop ring */
+ if(atomic_inc_and_test(&priv->ring_debounce[i]))
+ mark_ring(xpd, i, 0, 1);
+ }
+ }
+}
+
static int FXO_card_tick(xbus_t *xbus, xpd_t *xpd)
{
struct FXO_priv_data *priv;
@@ -413,8 +464,10 @@
BUG_ON(!priv);
if(poll_battery_interval != 0 && (priv->poll_counter % poll_battery_interval) == 0) {
poll_battery(xbus, xpd);
+ poll_current(xbus, xpd);
}
handle_fxo_leds(xpd);
+ handle_fxo_ring(xpd);
priv->poll_counter++;
return 0;
}
@@ -497,22 +550,14 @@
static /* 0x0F */ HOSTCMD(FXO, XPD_STATE, bool on)
{
- int ret = 0;
- int i;
+ int ret = 0;
+ struct FXO_priv_data *priv;
BUG_ON(!xbus);
BUG_ON(!xpd);
+ priv = xpd->priv;
+ BUG_ON(!priv);
DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on) ? "on" : "off");
- if(on) {
- for_each_line(xpd, i) {
- MARK_LED(xpd, i, LED_GREEN, LED_ON);
- msleep(20);
- }
- for_each_line(xpd, i) {
- MARK_LED(xpd, i, LED_GREEN, LED_OFF);
- msleep(20);
- }
- }
return ret;
}
@@ -549,6 +594,8 @@
DBG("%s/%s: (PSTN) sig_toggles=0x%04X sig_status=0x%04X\n", xpd->xbus->busname, xpd->xpdname, sig_toggles, sig_status);
spin_lock_irqsave(&xpd->lock, flags);
for_each_line(xpd, i) {
+ int debounce;
+
if(IS_SET(sig_toggles, i)) {
if(!IS_SET(priv->battery, i)) {
DBG("%s/%s/%d: SIG_CHANGED while battery is off.\n",
@@ -556,11 +603,98 @@
// FIXME: allow dialing without battery polling...
// continue;
}
- mark_ring(xpd, i, IS_SET(sig_status, i), 1);
+ /* First report false ring alarms */
+ debounce = atomic_read(&priv->ring_debounce[i]);
+ if(debounce)
+ NOTICE("%s/%s/%d: debounced %d ticks\n", xbus->busname, xpd->xpdname, i, debounce);
+ /*
+ * Now set a new ring alarm.
+ * It will be checked in handle_fxo_ring()
+ */
+ debounce = (IS_SET(sig_status, i)) ? ring_debounce : -ring_debounce;
+ atomic_set(&priv->ring_debounce[i], debounce);
}
}
spin_unlock_irqrestore(&xpd->lock, flags);
return 0;
+}
+
+static void update_battery_status(xpd_t *xpd, byte data_low, lineno_t chipsel)
+{
+ struct FXO_priv_data *priv;
+ byte bat = abs((signed char)data_low);
+ byte pol = IS_SET(data_low, 7);
+
+ priv = xpd->priv;
+ BUG_ON(!priv);
+ if(bat < BAT_THRESHOLD) {
+ /*
+ * Check for battery voltage fluctuations
+ */
+ if(IS_SET(priv->battery, chipsel) && priv->battery_debounce[chipsel]++ > BAT_DEBOUNCE) {
+ DBG("%s/%s/%d: BATTERY OFF voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
+ BIT_CLR(priv->battery, chipsel);
+ update_line_status(xpd, chipsel, 0);
+ }
+ } else {
+ priv->battery_debounce[chipsel] = 0;
+ if(!IS_SET(priv->battery, chipsel)) {
+ DBG("%s/%s/%d: BATTERY ON voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
+ BIT_SET(priv->battery, chipsel);
+ }
+ }
+ /*
+ * Handle reverse polarity
+ */
+ if (IS_SET(xpd->offhook, chipsel)) { /* Learn the current polarity */
+ if (priv->poll_counter - priv->offhook_timestamp[chipsel] < 3) {
+ priv->polarity_counter[chipsel] = 0;
+ if (pol)
+ BIT_SET(priv->polarity, chipsel);
+ else
+ BIT_CLR(priv->polarity, chipsel);
+ }
+ else if (IS_SET(priv->polarity, chipsel) != pol) { /* Polarity has reversed */
+ priv->polarity_counter[chipsel]++;
+ if (priv->polarity_counter[chipsel] >= 2) {
+ if (pol)
+ BIT_SET(priv->polarity, chipsel);
+ else
+ BIT_CLR(priv->polarity, chipsel);
+ priv->polarity_counter[chipsel] = 0;
+ /* Inform Zaptel */
+ zt_qevent_lock(&xpd->chans[chipsel], ZT_EVENT_POLARITY);
+#if 0
+ /*
+ * These two lines hangup the channel (by sending a message to
+ * the firmware), and inform Zaptel that the line has been hung-up.
+ * They are not needed if Asterisk does the hangup after receiving
+ * a notification from Zaptel (which is sent by the above zt_qevent_lock().
+ * Asterisk does that if it has "hanguponpolarityswitch=1" in zapata.conf.
+ */
+ do_sethook(xpd, chipsel, 0);
+ update_line_status(xpd, chipsel, 0);
+#endif
+ }
+ }
+ }
+}
+
+static void update_power_denial(xpd_t *xpd, byte data_low, lineno_t chipsel)
+{
+ struct FXO_priv_data *priv;
+
+ priv = xpd->priv;
+ BUG_ON(!priv);
+ if (IS_SET(xpd->offhook, chipsel) && data_low < 3) {
+ priv->current_counter[chipsel]++;
+ if (priv->current_counter[chipsel] >= 10) {
+ priv->current_counter[chipsel] = 0;
+ do_sethook(xpd, chipsel, 0);
+ update_line_status(xpd, chipsel, 0);
+ }
+ } else
+ priv->current_counter[chipsel] = 0;
}
HANDLER_DEF(FXO, DAA_REPLY)
@@ -579,29 +713,13 @@
priv = xpd->priv;
BUG_ON(!priv);
chipsel = REG_FIELD(info, chipsel);
-
- /*
- * Update battery status
- */
- if(REG_FIELD(info, regnum) == DAA_VBAT_REGISTER) {
- byte bat = abs((signed char)REG_FIELD(info, data_low));
-
- if(bat < BAT_THRESHOLD) {
- /*
- * Check for battery voltage fluctuations
- */
- if(IS_SET(priv->battery, chipsel) && priv->battery_debounce[chipsel]++ > BAT_DEBOUNCE) {
- DBG("%s/%s/%d: BATTERY OFF voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
- BIT_CLR(priv->battery, chipsel);
- update_line_status(xpd, chipsel, 0);
- }
- } else {
- priv->battery_debounce[chipsel] = 0;
- if(!IS_SET(priv->battery, chipsel)) {
- DBG("%s/%s/%d: BATTERY ON voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
- BIT_SET(priv->battery, chipsel);
- }
- }
+ switch(REG_FIELD(info, regnum)) {
+ case DAA_VBAT_REGISTER:
+ update_battery_status(xpd, REG_FIELD(info, data_low), chipsel);
+ break;
+ case DAA_CURRENT_REGISTER:
+ update_power_denial(xpd, REG_FIELD(info, data_low), chipsel);
+ break;
}
#if 0
DBG("DAA_REPLY: xpd #%d %s reg_num=0x%X, dataL=0x%X dataH=0x%X\n",
@@ -879,6 +997,11 @@
int __init card_fxo_startup(void)
{
+ if(ring_debounce <= 0) {
+ ERR("%s: ring_debounce=%d. Must be positive number of ticks\n",
+ THIS_MODULE->name, ring_debounce);
+ return -EINVAL;
+ }
INFO("%s revision %s\n", THIS_MODULE->name, XPP_VERSION);
xproto_register(&PROTO_TABLE(FXO));
return 0;
Modified: branches/1.2/xpp/card_fxs.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/card_fxs.c?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/card_fxs.c (original)
+++ branches/1.2/xpp/card_fxs.c Wed Feb 7 14:58:46 2007
@@ -33,8 +33,8 @@
static const char rcsid[] = "$Id$";
-DEF_PARM(int, print_dbg, 0, "Print DBG statements"); /* must be before zap_debug.h */
-DEF_PARM(bool, poll_digital_inputs, 1, "Poll Digital Inputs"); /* must be before zap_debug.h */
+DEF_PARM(int, print_dbg, 0, 0600, "Print DBG statements"); /* must be before zap_debug.h */
+DEF_PARM_BOOL(poll_digital_inputs, 1, 0600, "Poll Digital Inputs"); /* must be before zap_debug.h */
/* Signaling is opposite (fxo signalling for fxs card) */
#if 1
@@ -92,8 +92,20 @@
xpp_line_t ledcontrol[NUM_LEDS]; /* 0 - OFF, 1 - ON */
xpp_line_t found_fsk_pattern;
xpp_line_t msg_waiting;
- int blinking[NUM_LEDS][CHANNELS_PERXPD];
+ int led_counter[NUM_LEDS][CHANNELS_PERXPD];
};
+
+/*
+ * LED counter values:
+ * n>1 : BLINK every n'th tick
+ */
+#define LED_COUNTER(priv,pos,color) ((priv)->led_counter[color][pos])
+#define IS_BLINKING(priv,pos,color) (LED_COUNTER(priv,pos,color) > 0)
+#define MARK_BLINK(priv,pos,color,t) ((priv)->led_counter[color][pos] = (t))
+#define MARK_OFF(priv,pos,color) do { BIT_CLR((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0)
+#define MARK_ON(priv,pos,color) do { BIT_SET((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0)
+
+#define LED_BLINK_RING (1000/8) /* in ticks */
/*---------------- FXS: Static functions ----------------------------------*/
static int do_chan_power(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on)
@@ -105,10 +117,6 @@
DBG("%s/%s/%d: %s\n", xbus->busname, xpd->xpdname, chan, (on) ? "up" : "down");
return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x42, value);
}
-
-#define IS_BLINKING(priv,pos,color) ((priv)->blinking[color][pos] != 0)
-#define MARK_BLINK(priv,pos,color,val) ((priv)->blinking[color][pos] = (val))
-#define MARK_LED(priv,pos,color,val) ((val)?BIT_SET((priv)->ledcontrol[color],(pos)):BIT_CLR((priv)->ledcontrol[color],(pos)))
/*
* LED and RELAY control is done via SLIC register 0x06:
@@ -191,8 +199,12 @@
if(IS_SET(xpd->digital_outputs, i) || IS_SET(xpd->digital_inputs, i))
continue;
if(xpd->blink_mode || IS_BLINKING(priv, i, color)) { // Blinking
+ int mod_value = LED_COUNTER(priv, i, color);
+
+ if(!mod_value)
+ mod_value = DEFAULT_LED_PERIOD; /* safety value */
// led state is toggled
- if((timer_count % LED_BLINK_PERIOD) == 0) {
+ if((timer_count % mod_value) == 0) {
DBG("%s/%s/%d ledstate=%s\n", xpd->xbus->busname, xpd->xpdname, i,
(IS_SET(priv->ledstate[color], i))?"ON":"OFF");
if(!IS_SET(priv->ledstate[color], i)) {
@@ -273,6 +285,7 @@
{
struct FXS_priv_data *priv;
int ret = 0;
+ int i;
BUG_ON(!xpd);
priv = xpd->priv;
@@ -308,6 +321,18 @@
if(ret < 0)
goto err;
DBG("%s/%s: done\n", xbus->busname, xpd->xpdname);
+ for_each_line(xpd, i) {
+ do_led(xpd, i, LED_GREEN, 0);
+ do_led(xpd, i, LED_RED, 0);
+ }
+ for_each_line(xpd, i) {
+ do_led(xpd, i, LED_GREEN, 1);
+ msleep(50);
+ }
+ for_each_line(xpd, i) {
+ do_led(xpd, i, LED_GREEN, 0);
+ msleep(50);
+ }
return 0;
err:
clean_proc(xbus, xpd);
@@ -331,8 +356,6 @@
xbus_t *xbus;
struct FXS_priv_data *priv;
int i;
- unsigned long flags;
- const enum fxs_leds color = (on) ? LED_GREEN : LED_RED;
BUG_ON(!xpd);
xbus = xpd->xbus;
@@ -357,13 +380,8 @@
cur_chan->sigcap = FXS_DEFAULT_SIGCAP;
}
for_each_line(xpd, i) {
- spin_lock_irqsave(&xpd->lock, flags);
- do_led(xpd, i, color, LED_OFF);
- spin_unlock_irqrestore(&xpd->lock, flags);
- }
- for_each_line(xpd, i) {
- MARK_LED(priv, i, color, LED_ON);
- msleep(50);
+ MARK_ON(priv, i, LED_GREEN);
+ msleep(4);
}
return 0;
}
@@ -373,7 +391,6 @@
xbus_t *xbus;
struct FXS_priv_data *priv;
int i;
- const enum fxs_leds color = (on) ? LED_GREEN : LED_RED;
BUG_ON(!xpd);
xbus = xpd->xbus;
@@ -382,8 +399,10 @@
BUG_ON(!priv);
DBG("%s/%s (%d)\n", xbus->busname, xpd->xpdname, on);
for_each_line(xpd, i) {
- MARK_LED(priv, i, color, LED_OFF);
- msleep(50);
+ MARK_OFF(priv, i, LED_GREEN);
+ msleep(2);
+ MARK_OFF(priv, i, LED_RED);
+ msleep(2);
}
return 0;
}
@@ -717,9 +736,9 @@
for_each_line(xpd, i)
xpd->lasttxhook[i] = value;
if(on) {
- MARK_LED(priv, ALL_CHANS, LED_GREEN, LED_ON);
+ MARK_ON(priv, ALL_CHANS, LED_GREEN);
} else {
- MARK_LED(priv, ALL_CHANS, LED_GREEN, LED_OFF);
+ MARK_OFF(priv, ALL_CHANS, LED_GREEN);
}
spin_unlock_irqrestore(&xpd->lock, flags);
return ret;
@@ -740,10 +759,10 @@
ret = SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value);
xpd->lasttxhook[chan] = value;
if(on) {
- MARK_BLINK(priv,chan,LED_GREEN,LED_BLINK);
+ MARK_BLINK(priv, chan, LED_GREEN, LED_BLINK_RING);
} else {
if(IS_BLINKING(priv, chan, LED_GREEN))
- MARK_BLINK(priv,chan,LED_GREEN,0);
+ MARK_BLINK(priv, chan, LED_GREEN, 0);
}
return ret;
}
@@ -779,19 +798,6 @@
priv = xpd->priv;
DBG("%s/%s: (PHONE) sig_toggles=0x%04X sig_status=0x%04X\n", xbus->busname, xpd->xpdname, sig_toggles, sig_status);
#if 0
- /*
- * Not needed anymore. update_line_status() returns immediately
- * if !SPAN_REGISTERED(). Now we maintain good status even if
- * we are not registered.
- *
- * FIXME: Need to notify zaptel later (when registering).
- */
- if(!SPAN_REGISTERED(xpd)) {
- NOTICE("%s: %s/%s is not registered. Skipping.\n", __FUNCTION__, xbus->busname, xpd->xpdname);
- return -ENODEV;
- }
-#endif
-#if 0
Is this needed?
for_each_line(xpd, i) {
if(IS_SET(sig_toggles, i))
@@ -804,14 +810,14 @@
continue;
if(IS_SET(sig_toggles, i)) {
xpd->ringing[i] = 0; // No more ringing...
- MARK_BLINK(priv,i,LED_GREEN,0);
+ MARK_BLINK(priv, i, LED_GREEN, 0);
if(IS_SET(sig_status, i)) {
DBG("%s/%s/%d: OFFHOOK\n", xbus->busname, xpd->xpdname, i);
- MARK_LED(priv,i,LED_GREEN,LED_ON);
+ MARK_ON(priv, i, LED_GREEN);
update_line_status(xpd, i, 1);
} else {
DBG("%s/%s/%d: ONHOOK\n", xbus->busname, xpd->xpdname, i);
- MARK_LED(priv,i,LED_GREEN,LED_OFF);
+ MARK_OFF(priv, i, LED_GREEN);
update_line_status(xpd, i, 0);
start_stop_vm_led(xbus, xpd, i);
}
@@ -966,10 +972,10 @@
if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i))
len += sprintf(page + len, "%d ", IS_SET(priv->ledcontrol[led], i));
}
- len += sprintf(page + len, "\n\t%-17s: ", "blinking");
+ len += sprintf(page + len, "\n\t%-17s: ", "led_counter");
for_each_line(xpd, i) {
if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i))
- len += sprintf(page + len, "%d ", IS_BLINKING(priv,i,led));
+ len += sprintf(page + len, "%d ", LED_COUNTER(priv,i,led));
}
len += sprintf(page + len, "\n");
}
Modified: branches/1.2/xpp/card_global.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/card_global.c?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/card_global.c (original)
+++ branches/1.2/xpp/card_global.c Wed Feb 7 14:58:46 2007
@@ -30,7 +30,7 @@
static const char rcsid[] = "$Id$";
-DEF_PARM(charp,initdir, "/usr/share/zaptel", "The directory of card initialization scripts");
+DEF_PARM(charp,initdir, "/usr/share/zaptel", 0600, "The directory of card initialization scripts");
extern int print_dbg;
static bool pcm_valid(xpd_t *xpd, xpacket_t *pack);
@@ -226,27 +226,32 @@
HANDLER_DEF(GLOBAL, ERROR_CODE)
{
- byte errorcode = RPACKET_FIELD(pack, GLOBAL, ERROR_CODE, errorcode);
- reg_cmd_t *bad_cmd;
- char xpdname[XPD_NAMELEN];
+ byte errorcode = RPACKET_FIELD(pack, GLOBAL, ERROR_CODE, errorcode);
+ reg_cmd_t *bad_cmd;
+ char tmp_xpdname[XPD_NAMELEN];
+ static long rate_limit;
BUG_ON(!xbus);
+ if((rate_limit++ % 5003) > 200)
+ return 0;
if(!xpd) {
int xpd_num = XPD_NUM(pack->addr);
- snprintf(xpdname, XPD_NAMELEN, "#%d", xpd_num);
+ snprintf(tmp_xpdname, XPD_NAMELEN, "#%d", xpd_num);
} else {
- snprintf(xpdname, XPD_NAMELEN, "%s", xpd->xpdname);
- }
- if(!printk_ratelimit())
- return 0;
- NOTICE("%s/%s: %s CODE = 0x%X\n", xbus->busname, xpdname, cmd->name, errorcode);
+ snprintf(tmp_xpdname, XPD_NAMELEN, "%s", xpd->xpdname);
+ }
+ NOTICE("%s/%s: FIRMWARE: %s CODE = 0x%X (rate_limit=%ld)\n",
+ xbus->busname, tmp_xpdname, cmd->name, errorcode, rate_limit);
switch(errorcode) {
case 1:
bad_cmd = &RPACKET_FIELD(pack, GLOBAL, ERROR_CODE, info.bad_spi_cmd);
- dump_packet("BAD_SPI_CMD", pack, 1);
+ dump_packet("FIRMWARE: BAD_SPI_CMD", pack, 1);
+ break;
+ case 0xAB:
+ dump_packet("FIRMWARE: BAD_PACKET_LEN", pack, 1);
break;
default:
- NOTICE("%s/%s: %s UNKNOWN CODE = 0x%X\n", xbus->busname, xpdname, cmd->name, errorcode);
+ NOTICE("%s/%s: FIRMWARE: %s UNKNOWN CODE = 0x%X\n", xbus->busname, tmp_xpdname, cmd->name, errorcode);
dump_packet("PACKET", pack, 1);
}
/*
Propchange: branches/1.2/xpp/init_card_3_24
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Feb 7 14:58:46 2007
@@ -1,1 +1,1 @@
-Author Id Date Revision
+Author Id Date Revision==== ORIGINAL VERSION Property svn:keywords of init_card_3_24 117087866049494
Modified: branches/1.2/xpp/init_card_4_24
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/init_card_4_24?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/init_card_4_24 (original)
+++ branches/1.2/xpp/init_card_4_24 Wed Feb 7 14:58:46 2007
@@ -160,6 +160,12 @@
31 WD 1A C0
" | sed -e 's/[;#].*$//' -e '/^[ ]*$/d'
+# Turning off red LEDs
+# Warning: do not send WD 31 20 A0 !
+for i in `seq 0 7`; do
+ echo "$i WD 20 A0";
+done;
+
set_daa_country_params "$opermode"
$LOGGER -p kern.info "$XPD_BUS/$XPD_NAME: Ending '$0'"
Propchange: branches/1.2/xpp/init_card_4_24
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Feb 7 14:58:46 2007
@@ -1,1 +1,1 @@
-Author Id Date Revision
+Author Id Date Revision==== ORIGINAL VERSION Property svn:keywords of init_card_4_24 117087870089084
Modified: branches/1.2/xpp/init_card_6_24
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/init_card_6_24?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/init_card_6_24 (original)
+++ branches/1.2/xpp/init_card_6_24 Wed Feb 7 14:58:46 2007
@@ -52,14 +52,31 @@
#
package main;
+use File::Basename;
+
+my $program = basename("$0");
+my $init_dir = dirname("$0");
+my $unit_id;
+
sub logit {
- print STDERR "@_\n";
+ print STDERR "$unit_id: @_\n";
+}
+
+# Arrange for error logging
+if (-t STDERR) {
+ $unit_id = 'Interactive';
+ logit "Interactive startup\n";
+} else {
+ $unit_id = "$ENV{XPD_BUS}/$ENV{XPD_NAME}";
+ open (STDERR, "| /usr/bin/logger -t $program -p kern.info") || die;
+ logit "Non Interactive startup\n";
}
package BRI;
sub gen {
my $fmt = shift;
+ $| = 1;
printf "$fmt\n", @_;
}
@@ -274,44 +291,27 @@
package main;
-
-use File::Basename;
use Getopt::Std;
-
-my $program = basename("$0");
-my $init_dir = dirname("$0");
-
-# Arrange for error logging
-if (-t STDERR) {
- logit "Interactive\n";
-} else {
- open (STDERR, "| logger -s -t $program -p kern.info") || die;
- logit "Non Interactive\n";
-}
my %opts;
getopts('o:', \%opts);
$ENV{XPP_BASE} = '/proc/xpp';
my $output;
-my $unit_id;
if ($opts{o}) {
$output = $opts{o};
- $unit_id = 'Interactive';
} else {
$ENV{XPD_BUS} || die "Missing XPD_BUS environment variable\n";
$ENV{XPD_NAME} || die "Missing XPD_NAME environment variable\n";
$ENV{XPD_TYPE} || die "Missing XPD_TYPE environment variable\n";
$ENV{XPD_REVISION} || die "Missing XPD_REVISION environment variable\n";
$output = "$ENV{XPP_BASE}/$ENV{XPD_BUS}/$ENV{XPD_NAME}/slics";
- $unit_id = "$ENV{XPD_BUS}/$ENV{XPD_NAME}";
}
open(REG, ">$output") || die "Failed to open '$output': $!\n";
select REG;
-
-#logit "$unit_id: Starting '$0'";
+logit "Starting '$0'";
#------------------------------------------- Instance detection
@@ -361,7 +361,7 @@
# zap_xhfc_su.c:175
sub main() {
- #logit "main()";
+ #logit "main(): XPD_TYPE=$ENV{XPD_TYPE}";
$ENV{XPD_TYPE} || die "Missing XPD_TYPE environment variable\n";
my $type = $port_type{$ENV{XPD_TYPE}};
@@ -372,9 +372,9 @@
#
# Otherwise we mess with registers while the FPGA firmware tries to
# send us packets.
-
+ BRI::gen "0 Wm";
+
# Common initialization
-
if($ENV{XPD_SUBUNIT} eq '0') {
# Turn off multi-byte packet reception before initialization started
system("/bin/echo \"0A 00 0F 00 C0 00 00 00 00 00\" >/proc/xpp/$ENV{XPD_BUS}/command");
@@ -408,7 +408,8 @@
main;
-#logit "$unit_id: Ending '$0'";
+logit "Ending '$0'";
close REG;
+close STDERR;
exit 0;
Propchange: branches/1.2/xpp/init_card_6_24
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Feb 7 14:58:46 2007
@@ -1,1 +1,1 @@
-Author Id Date Revision
+Author Id Date Revision==== ORIGINAL VERSION Property svn:keywords of init_card_6_24 117087874895772
Modified: branches/1.2/xpp/init_card_7_24
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/init_card_7_24?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/init_card_7_24 (original)
+++ branches/1.2/xpp/init_card_7_24 Wed Feb 7 14:58:46 2007
@@ -52,14 +52,31 @@
#
package main;
+use File::Basename;
+
+my $program = basename("$0");
+my $init_dir = dirname("$0");
+my $unit_id;
+
sub logit {
- print STDERR "@_\n";
+ print STDERR "$unit_id: @_\n";
+}
+
+# Arrange for error logging
+if (-t STDERR) {
+ $unit_id = 'Interactive';
+ logit "Interactive startup\n";
+} else {
+ $unit_id = "$ENV{XPD_BUS}/$ENV{XPD_NAME}";
+ open (STDERR, "| /usr/bin/logger -t $program -p kern.info") || die;
+ logit "Non Interactive startup\n";
}
package BRI;
sub gen {
my $fmt = shift;
+ $| = 1;
printf "$fmt\n", @_;
}
@@ -274,44 +291,27 @@
package main;
-
-use File::Basename;
use Getopt::Std;
-
-my $program = basename("$0");
-my $init_dir = dirname("$0");
-
-# Arrange for error logging
-if (-t STDERR) {
- logit "Interactive\n";
-} else {
- open (STDERR, "| logger -s -t $program -p kern.info") || die;
- logit "Non Interactive\n";
-}
my %opts;
getopts('o:', \%opts);
$ENV{XPP_BASE} = '/proc/xpp';
my $output;
-my $unit_id;
if ($opts{o}) {
$output = $opts{o};
- $unit_id = 'Interactive';
} else {
$ENV{XPD_BUS} || die "Missing XPD_BUS environment variable\n";
$ENV{XPD_NAME} || die "Missing XPD_NAME environment variable\n";
$ENV{XPD_TYPE} || die "Missing XPD_TYPE environment variable\n";
$ENV{XPD_REVISION} || die "Missing XPD_REVISION environment variable\n";
$output = "$ENV{XPP_BASE}/$ENV{XPD_BUS}/$ENV{XPD_NAME}/slics";
- $unit_id = "$ENV{XPD_BUS}/$ENV{XPD_NAME}";
}
open(REG, ">$output") || die "Failed to open '$output': $!\n";
select REG;
-
-#logit "$unit_id: Starting '$0'";
+logit "Starting '$0'";
#------------------------------------------- Instance detection
@@ -361,7 +361,7 @@
# zap_xhfc_su.c:175
sub main() {
- #logit "main()";
+ #logit "main(): XPD_TYPE=$ENV{XPD_TYPE}";
$ENV{XPD_TYPE} || die "Missing XPD_TYPE environment variable\n";
my $type = $port_type{$ENV{XPD_TYPE}};
@@ -408,7 +408,8 @@
main;
-#logit "$unit_id: Ending '$0'";
+logit "Ending '$0'";
close REG;
+close STDERR;
exit 0;
Propchange: branches/1.2/xpp/init_card_7_24
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Feb 7 14:58:46 2007
@@ -1,1 +1,1 @@
-Author Id Date Revision
+Author Id Date Revision==== ORIGINAL VERSION Property svn:keywords of init_card_7_24 11708787698622
Modified: branches/1.2/xpp/utils/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/utils/Makefile?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/utils/Makefile (original)
+++ branches/1.2/xpp/utils/Makefile Wed Feb 7 14:58:46 2007
@@ -20,9 +20,9 @@
# FIXME: Are those values really sane?
HOSTCC ?= $(CC)
CONFIG_USB ?= y
-DRIVER_DIR ?= ../..
+ZAPTEL_DIR ?= ../..
-WCTDM=$(DRIVER_DIR)/wctdm.c
+WCTDM=$(ZAPTEL_DIR)/wctdm.c
CFLAGS = -g -Wall $(EXTRA_CFLAGS)
Modified: branches/1.2/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/utils/genzaptelconf?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/utils/genzaptelconf (original)
+++ branches/1.2/xpp/utils/genzaptelconf Wed Feb 7 14:58:46 2007
@@ -50,10 +50,6 @@
#group_manual=yes
group_phones=5 # group for phones
group_lines=0 # group for lines
-# set 'immediate=yes' for Asteribank input channels and 'immediate=no'
-# for others. Note that if an Astribank is not detected, the script
-# will set this to "no", so you can safely leave it as "yes".
-set_immediate=yes
# Set fxs_immediate to 'yes' to make all FXS lines answer immediately.
fxs_immediate=no
@@ -230,15 +226,6 @@
done
}
-
-check_for_astribank(){
- if ! grep -q XPP_IN/ /proc/zaptel/* 2>/dev/null
- then
- # we only get here is if we find no Astribank input channels
- # in /proc/zaptel . Hence we can safely disable their special settings:
- set_immediate=no
- fi
-}
usage() {
program=`basename $0`
@@ -395,14 +382,11 @@
fi
fi
- if [ "$set_immediate" = 'yes' ]
- then
- if [ "$astbank_type" = 'input' ] || \
- ( [ "$fxs_immediate" = 'yes' ] && [ "$sig" = "fxo" ] )
- then
- echo 'immediate=yes' >> $zapata_file
- reset_values="$reset_values immediate"
- fi
+ if [ "$astbank_type" = 'input' ] || \
+ ( [ "$fxs_immediate" = 'yes' ] && [ "$sig" = "fxo" ] )
+ then
+ echo 'immediate=yes' >> $zapata_file
+ reset_values="$reset_values immediate"
fi
echo "channel => $chan" >> $zapata_file
reset_zapata_entry $zapata_file $reset_values
@@ -1028,14 +1012,10 @@
genconf list
else
zap_reg_xpp
- check_for_astribank
wait_for_zapctl
say "Generating '${ZAPCONF_FILE} and ${ZAPATA_FILE}'"
genconf files
- if [ "$set_immediate" = 'yes' ] && [ -x /etc/init.d/zaptel ]
- then /etc/init.d/zaptel start
- else run_ztcfg
- fi
+ run_ztcfg
fi
if [ "$tmp_dir" != '' ]
Added: branches/1.2/xpp/utils/xpp.rules
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/utils/xpp.rules?view=auto&rev=2113
==============================================================================
--- branches/1.2/xpp/utils/xpp.rules (added)
+++ branches/1.2/xpp/utils/xpp.rules Wed Feb 7 14:58:46 2007
@@ -1,0 +1,8 @@
+BUS!="usb", ACTION!="add", GOTO="xpp_usb_add_end"
+
+# Load firmware into the Xorcom Astribank device:
+SYSFS{idVendor}=="e4e4", SYSFS{idProduct}=="11[345][01]", \
+ RUN+="/etc/hotplug/usb/xpp_fxloader udev $sysfs{idVendor}/$sysfs{idProduct}/$sysfs{bcdDevice}"
+
+LABEL="xpp_usb_add_end"
+
Propchange: branches/1.2/xpp/utils/xpp.rules
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.2/xpp/utils/xpp.rules
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.2/xpp/utils/xpp.rules
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: branches/1.2/xpp/utils/xpp_fxloader
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/utils/xpp_fxloader?view=diff&rev=2113&r1=2112&r2=2113
==============================================================================
--- branches/1.2/xpp/utils/xpp_fxloader (original)
+++ branches/1.2/xpp/utils/xpp_fxloader Wed Feb 7 14:58:46 2007
@@ -195,7 +195,7 @@
## 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`
Added: branches/1.2/xpp/utils/zaptel-helper
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/utils/zaptel-helper?view=auto&rev=2113
==============================================================================
--- branches/1.2/xpp/utils/zaptel-helper (added)
+++ branches/1.2/xpp/utils/zaptel-helper Wed Feb 7 14:58:46 2007
@@ -1,0 +1,401 @@
+#!/bin/sh
+
+# zaptel-helper: helper script/functions for Zaptel
+
+# Wrriten by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+# Copyright (C) 2006-2007, Xorcom
+#
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Should be possible to run with -e set. This is also recommended.
+
+# Constants:
+# maximal time (in seconds) to wait for /dev/zap/dtl to appear after
+# loading zaptel
+DEVZAP_TIMEOUT=${DEVZAP_TIMEOUT:-20}
+
+# Zaptel modules we'll try when detecting zaptel hardware:
+ALL_MODULES="${ALL_MODULES:-zaphfc qozap ztgsm wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wanpipe wcusb xpp_usb}"
+
+# Where do we write the list of modules we detected (if at all):
+MODLIST_FILE_DEBIAN=${MODLIST_FILE_DEBIAN:-/etc/modules}
+MODLIST_FILE_REDHAT=${MODLIST_FILE_REDHAT:-/etc/sysconfig/zaptel}
+
+# The location of of the fxotune binary
+FXOTUNE="${FXOTUNE:-/usr/sbin/fxotune}"
+FXOTUNE_CONF="${FXOTUNE_CONF:-/etc/fxotune.conf}"
+
+# this is the context FXO zaptel channels are in.
+# See run_fxotune.
+FXO_CONTEXT=${FXO_CONTEXT:-from-pstn}
+
+ZTCFG="${ZTCFG:-/sbin/ztcfg}"
+
+# TODO: this may not be appropriate for a general-purpose script.
+# However you should not use a direct 'echo' to write output to the user
[... 916 lines stripped ...]
More information about the svn-commits
mailing list