Handset support

This commit is contained in:
Karsten Keil 2003-11-11 10:02:23 +00:00
parent f981c59afa
commit 61dc94dc12
4 changed files with 25 additions and 15 deletions

View File

@ -140,6 +140,7 @@ void applFacilityReq(Appl_t *appl, struct sk_buff *skb)
capi_message2cmsg(&cmsg, skb->data);
switch (cmsg.FacilitySelector) {
case 0x0000: // Handset
case 0x0001: // DTMF
cplci = applAdr2cplci(appl, CAPIMSG_CONTROL(skb->data));
if (cplci && cplci->ncci) {

View File

@ -415,7 +415,7 @@ dtmf_from_up(mISDNif_t *hif, struct sk_buff *skb)
hh = mISDN_HEAD_P(skb);
switch(hh->prim) {
case (PH_CONTROL | REQUEST):
if (skb->len >= sizeof(int)) {
if ((hh->dinfo == 0) && (skb->len >= sizeof(int))) {
data = (int *)skb->data;
if (dtmf->debug & DEBUG_DTMF_CTRL)
printk(KERN_DEBUG "DTMF: PH_CONTROL REQ data %04x\n",
@ -423,14 +423,14 @@ dtmf_from_up(mISDNif_t *hif, struct sk_buff *skb)
if (*data == DTMF_TONE_START) {
test_and_set_bit(FLG_DTMF_ACTIV, &dtmf->Flags);
dtmf_reset(dtmf);
break;
} else if (*data == DTMF_TONE_STOP) {
test_and_clear_bit(FLG_DTMF_ACTIV, &dtmf->Flags);
dtmf_reset(dtmf);
break;
}
break;
} else
printk(KERN_ERR "dtmf_from_up: skb too shoort %d\n",
skb->len);
}
/* Fall trough in case of not handled function */
default:
return(dtmf->inst.down.func(&dtmf->inst.down, skb));
}

View File

@ -188,7 +188,8 @@ static void ncci_disconnect_b3_req(struct FsmInst *fi, int event, void *arg)
}
}
static void ncci_facility_req(struct FsmInst *fi, int event, void *arg)
static void
ncci_facility_req(struct FsmInst *fi, int event, void *arg)
{
Ncci_t *ncci = fi->userdata;
_cmsg *cmsg = arg;
@ -198,7 +199,11 @@ static void ncci_facility_req(struct FsmInst *fi, int event, void *arg)
capi_cmsg_answer(cmsg);
cmsg->Info = CAPI_NOERROR;
if (cmsg->FacilitySelector != 1) { // not DTMF
if (cmsg->FacilitySelector == 0) { // Handset
int err = ncciL4L3(ncci, PH_CONTROL | REQUEST, HW_POTS_ON, 0, NULL, NULL);
if (err)
cmsg->Info = CapiFacilityNotSupported;
} else if (cmsg->FacilitySelector != 1) { // not DTMF
cmsg->Info = CapiIllMessageParmCoding;
} else if (p && p[0]) {
func = CAPIMSG_U16(p, 1);
@ -692,7 +697,7 @@ void ncciSendMessage(Ncci_t *ncci, struct sk_buff *skb)
{
int retval = 0;
// we're not using the Fsm for DATA_B3 for performance reasons
// we're not using the cmesg for DATA_B3 for performance reasons
switch (CAPICMD(CAPIMSG_COMMAND(skb->data), CAPIMSG_SUBCOMMAND(skb->data))) {
case CAPI_DATA_B3_REQ:
if (ncci->ncci_m.state == ST_NCCI_N_ACT) {
@ -799,8 +804,8 @@ int ncci_l3l4(mISDNif_t *hif, struct sk_buff *skb)
return(0);
}
static int ncciL4L3(Ncci_t *ncci, u_int prim, int dtyp, int len, void *arg,
struct sk_buff *skb)
static int
ncciL4L3(Ncci_t *ncci, u_int prim, int dtyp, int len, void *arg, struct sk_buff *skb)
{
capidebug(CAPI_DBG_NCCI_L3, "%s: NCCI %x prim(%x) dtyp(%x) skb(%p)",
__FUNCTION__, ncci->adrNCCI, prim, dtyp, skb);

View File

@ -493,10 +493,11 @@ enable_pots(bchannel_t *bch)
w6692pci *card = bch->inst.data;
if ((card->pots == 0) || (bch->protocol != ISDN_PID_L1_B_64TRANS))
return(1);
return(-ENODEV);
bhw->b_mode |= W_B_MODE_EPCM | W_B_MODE_BSW0;
WriteW6692B(card, bch->channel, W_B_MODE, bhw->b_mode);
WriteW6692B(card, bch->channel, W_B_CMDR, W_B_CMDR_RRST | W_B_CMDR_XRST);
card->pctl |= (bch->channel ? W_PCTL_PCX : 0);
WriteW6692(card, W_PCTL, card->pctl);
return(0);
@ -509,9 +510,10 @@ disable_pots(bchannel_t *bch)
w6692pci *card = bch->inst.data;
if (card->pots == 0)
return(1);
return(-ENODEV);
bhw->b_mode &= ~(W_B_MODE_EPCM | W_B_MODE_BSW0);
WriteW6692B(card, bch->channel, W_B_MODE, bhw->b_mode);
WriteW6692B(card, bch->channel, W_B_CMDR, W_B_CMDR_RRST | W_B_CMDR_RACT | W_B_CMDR_XRST);
return(0);
}
@ -1038,11 +1040,13 @@ w6692_l2l1B(mISDNif_t *hif, struct sk_buff *skb)
}
ret = 0;
} else if (hh->prim == (PH_CONTROL | REQUEST)) {
ret = 0;
if (hh->dinfo == HW_POTS_ON) {
enable_pots(bch);
ret = enable_pots(bch);
} else if (hh->dinfo == HW_POTS_OFF) {
disable_pots(bch);
}
ret = disable_pots(bch);
} else
ret = -EINVAL;
} else {
printk(KERN_WARNING "%s: unknown prim(%x)\n",
__FUNCTION__, hh->prim);