From 91e09cf673edfca563f9b56926047fcdae2528aa Mon Sep 17 00:00:00 2001 From: tzafrir Date: Thu, 7 Jun 2007 23:06:45 +0000 Subject: Some XPP bugfixes: * Fix FXO power denial detection (changeset:4054) * Incorrect data type could cause FXO module to go off-hook (changeset:4048) * xpp_fxloader: fix the error message when you want to disable automatic firmware loading... (changeset:4060) Merged from: branches/1.2 r2589 git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2592 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- xpp/card_fxo.c | 10 +++++++--- xpp/utils/xpp_fxloader | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xpp/card_fxo.c b/xpp/card_fxo.c index ad8e438..4c2ac87 100644 --- a/xpp/card_fxo.c +++ b/xpp/card_fxo.c @@ -82,6 +82,9 @@ static int handle_register_command(xpd_t *xpd, char *cmdline); #define DAA_CURRENT_REGISTER 0x1C #define DAA_RING_REGISTER 0x05 +#define POWER_DENIAL_CURRENT 3 +#define POWER_DENIAL_TIME 1000 /* ticks */ + struct FXO_priv_data { struct proc_dir_entry *regfile; struct proc_dir_entry *fxo_info; @@ -210,7 +213,7 @@ static int do_sethook(xpd_t *xpd, int pos, bool to_offhook) xbus_t *xbus; struct FXO_priv_data *priv; int ret = 0; - bool value; + byte value; BUG_ON(!xpd); BUG_ON(xpd->direction == TO_PHONE); // We can SETHOOK state only on PSTN @@ -708,9 +711,10 @@ static void update_power_denial(xpd_t *xpd, byte data_low, lineno_t chipsel) priv = xpd->priv; BUG_ON(!priv); - if (IS_SET(xpd->offhook, chipsel) && data_low < 3) { + if (IS_SET(xpd->offhook, chipsel) && data_low < POWER_DENIAL_CURRENT) { + /* Current dropped */ priv->current_counter[chipsel]++; - if (priv->current_counter[chipsel] >= 10) { + if (priv->current_counter[chipsel] * poll_battery_interval >= POWER_DENIAL_TIME) { DBG("%s/%s/%d: Power Denial Hangup\n", xpd->xbus->busname, xpd->xpdname, chipsel); priv->current_counter[chipsel] = 0; do_sethook(xpd, chipsel, 0); diff --git a/xpp/utils/xpp_fxloader b/xpp/utils/xpp_fxloader index eb46ccc..5584b5f 100644 --- a/xpp/utils/xpp_fxloader +++ b/xpp/utils/xpp_fxloader @@ -215,7 +215,7 @@ esac ## # allow disabling automatic hotplugging: -if [ "$XPP_HOTPLUG_DISABLED" != '' ]; then return 0; fi +if [ "$XPP_HOTPLUG_DISABLED" != '' ]; then exit 0; fi if [ "$ACTION" = "add" ] && [ -w "$DEVICE" ] then -- cgit v1.2.3