From 856ec38e3accde2e39e1db7a0530bf04b5ec4f39 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 16 Apr 2009 18:16:29 +0000 Subject: xpp fxs: Ignore registers of disabled SLICs From xpp rev. 6979 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6377 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/card_fxs.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/dahdi/xpp/card_fxs.c b/drivers/dahdi/xpp/card_fxs.c index b79dbe7..3673d8b 100644 --- a/drivers/dahdi/xpp/card_fxs.c +++ b/drivers/dahdi/xpp/card_fxs.c @@ -100,6 +100,7 @@ enum fxs_state { #define REG_BATTERY_BATSL BIT(1) /* Battery Feed Select */ #define REG_LOOPCLOSURE 0x44 /* 68 - Loop Closure/Ring Trip Detect Status */ +#define REG_LOOPCLOSURE_ZERO 0xF8 /* Loop Closure zero bits. */ #define REG_LOOPCLOSURE_LCR BIT(0) /* Loop Closure Detect Indicator. */ /*---------------- FXS Protocol Commands ----------------------------------*/ @@ -1307,11 +1308,17 @@ static int FXS_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info) xpp_line_t mask = BIT(info->portnum); xpp_line_t offhook; - offhook = (val & REG_LOOPCLOSURE_LCR) ? mask : 0; - LINE_DBG(SIGNAL, xpd, info->portnum, - "REG_LOOPCLOSURE: dataL=0x%X (offhook=0x%X mask=0x%X\n", - val, offhook, mask); - process_hookstate(xpd, offhook, mask); + /* + * Validate reply. Non-existing/disabled ports + * will reply with 0xFF. Ignore these. + */ + if((val & REG_LOOPCLOSURE_ZERO) == 0) { + offhook = (val & REG_LOOPCLOSURE_LCR) ? mask : 0; + LINE_DBG(SIGNAL, xpd, info->portnum, + "REG_LOOPCLOSURE: dataL=0x%X (offhook=0x%X mask=0x%X\n", + val, offhook, mask); + process_hookstate(xpd, offhook, mask); + } } else { #if 0 XPD_NOTICE(xpd, "Spurious register reply(ignored): %s reg_num=0x%X, dataL=0x%X dataH=0x%X\n", -- cgit v1.2.3