Index: drivers/dahdi/wctdm.c =================================================================== --- drivers/dahdi/wctdm.c (revision 6689) +++ drivers/dahdi/wctdm.c (working copy) @@ -981,11 +981,22 @@ if (debug) #endif printk(KERN_DEBUG "wctdm: Card %d Going off hook\n", card); + + if ( wc->mod[card].fxs.lasttxhook == 0x4 ) { + /* Apply the change if appropriate */ + if (reversepolarity) { + wc->mod[card].fxs.idletxhookstate = 0x5; /* Active */ + } else { + wc->mod[card].fxs.idletxhookstate = 0x1; + } + wc->mod[card].fxs.lasttxhook = wc->mod[card].fxs.idletxhookstate; + wctdm_setreg(wc, card, 64, wc->mod[card].fxs.lasttxhook); + } + dahdi_hooksig(wc->chans[card], DAHDI_RXSIG_OFFHOOK); if (robust) wctdm_init_proslic(wc, card, 1, 0, 1); wc->mod[card].fxs.oldrxhook = 1; - } else if (wc->mod[card].fxs.oldrxhook && !wc->mod[card].fxs.debouncehook) { /* On hook */ #if 1 @@ -1336,7 +1347,7 @@ /*******************************The preceding is the manual gain mismatch calibration****************************/ /**********************************The following is the longitudinal Balance Cal***********************************/ - wctdm_setreg(wc,card,64,1); + wctdm_setreg(wc,card, 64, 1); while((jiffies-origjiffies)<10); // Sleep 100? wctdm_setreg(wc, card, 64, 0); @@ -1773,7 +1784,8 @@ if(debug) printk(KERN_DEBUG "DEBUG: fxstxgain:%s fxsrxgain:%s\n",((wctdm_getreg(wc, card, 9)/8) == 1)?"3.5":(((wctdm_getreg(wc,card,9)/4) == 1)?"-3.5":"0.0"),((wctdm_getreg(wc, card, 9)/2) == 1)?"3.5":((wctdm_getreg(wc,card,9)%2)?"-3.5":"0.0")); - wctdm_setreg(wc, card, 64, 0x01); + wc->mod[card].fxs.lasttxhook = wc->mod[card].fxs.idletxhookstate; + wctdm_setreg(wc, card, 64, wc->mod[card].fxs.lasttxhook); return 0; } @@ -1799,12 +1811,12 @@ else wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 0x2; if (wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x1 || wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x5) { - /* Apply the change if appropriate */ - if (reversepolarity) - wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x6; - else - wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x2; - wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook); + /* Apply the change if appropriate */ + if (reversepolarity) + wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x6; + else + wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x2; + wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook); } break; case DAHDI_SETPOLARITY: