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); capi_message2cmsg(&cmsg, skb->data);
switch (cmsg.FacilitySelector) { switch (cmsg.FacilitySelector) {
case 0x0000: // Handset
case 0x0001: // DTMF case 0x0001: // DTMF
cplci = applAdr2cplci(appl, CAPIMSG_CONTROL(skb->data)); cplci = applAdr2cplci(appl, CAPIMSG_CONTROL(skb->data));
if (cplci && cplci->ncci) { 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); hh = mISDN_HEAD_P(skb);
switch(hh->prim) { switch(hh->prim) {
case (PH_CONTROL | REQUEST): case (PH_CONTROL | REQUEST):
if (skb->len >= sizeof(int)) { if ((hh->dinfo == 0) && (skb->len >= sizeof(int))) {
data = (int *)skb->data; data = (int *)skb->data;
if (dtmf->debug & DEBUG_DTMF_CTRL) if (dtmf->debug & DEBUG_DTMF_CTRL)
printk(KERN_DEBUG "DTMF: PH_CONTROL REQ data %04x\n", 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) { if (*data == DTMF_TONE_START) {
test_and_set_bit(FLG_DTMF_ACTIV, &dtmf->Flags); test_and_set_bit(FLG_DTMF_ACTIV, &dtmf->Flags);
dtmf_reset(dtmf); dtmf_reset(dtmf);
break;
} else if (*data == DTMF_TONE_STOP) { } else if (*data == DTMF_TONE_STOP) {
test_and_clear_bit(FLG_DTMF_ACTIV, &dtmf->Flags); test_and_clear_bit(FLG_DTMF_ACTIV, &dtmf->Flags);
dtmf_reset(dtmf); dtmf_reset(dtmf);
break;
} }
break; }
} else /* Fall trough in case of not handled function */
printk(KERN_ERR "dtmf_from_up: skb too shoort %d\n",
skb->len);
default: default:
return(dtmf->inst.down.func(&dtmf->inst.down, skb)); 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; Ncci_t *ncci = fi->userdata;
_cmsg *cmsg = arg; _cmsg *cmsg = arg;
@ -198,7 +199,11 @@ static void ncci_facility_req(struct FsmInst *fi, int event, void *arg)
capi_cmsg_answer(cmsg); capi_cmsg_answer(cmsg);
cmsg->Info = CAPI_NOERROR; 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; cmsg->Info = CapiIllMessageParmCoding;
} else if (p && p[0]) { } else if (p && p[0]) {
func = CAPIMSG_U16(p, 1); func = CAPIMSG_U16(p, 1);
@ -692,7 +697,7 @@ void ncciSendMessage(Ncci_t *ncci, struct sk_buff *skb)
{ {
int retval = 0; 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))) { switch (CAPICMD(CAPIMSG_COMMAND(skb->data), CAPIMSG_SUBCOMMAND(skb->data))) {
case CAPI_DATA_B3_REQ: case CAPI_DATA_B3_REQ:
if (ncci->ncci_m.state == ST_NCCI_N_ACT) { 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); return(0);
} }
static int ncciL4L3(Ncci_t *ncci, u_int prim, int dtyp, int len, void *arg, static int
struct sk_buff *skb) 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)", capidebug(CAPI_DBG_NCCI_L3, "%s: NCCI %x prim(%x) dtyp(%x) skb(%p)",
__FUNCTION__, ncci->adrNCCI, prim, dtyp, skb); __FUNCTION__, ncci->adrNCCI, prim, dtyp, skb);

View File

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