|
From: <mat...@ax...> - 2001-04-20 17:10:24
|
> + if ((conrsp = (sig_conrsp *)rsp->data) == NULL) {
> + D_ERR(__FUNCTION__ ": no response data\n");
> + return;
> + }
> +
> + if ((con = get_lcon(conrsp->src_cid)) == NULL) {
> + D_ERR(__FUNCTION__ ": no connection\n");
> + return;
> + }
Why are you casting the received data as a connection response ?!?
The command reject only contain reason + ID for the rejected packet and
some optional data (reason 1 => 'correct' MTU, reason = 2 => requested CID)
This is what I have in my l2cap.c
====
case SIG_CMDREJECT:
D_STATE(FNC"Command reject - \n");
DSYS("Got command reject\n");
cmdreject = (sig_cmdreject*)rsp->data;
cmdreject->reason = le16_to_cpu(cmdreject->reason);
opt_len = rsp->len - sizeof(sig_cmdreject);
switch (cmdreject->reason) {
case 0:
D_ERR(FNC"Command not understood\n");
break;
case 1:
D_ERR(FNC"Signalling MTU exceeded\n");
break;
case 2:
D_ERR(FNC"Invalid CID in request\n");
break;
default:
D_STATE(FNC"Not recognized cmd reject reason\n");
break;
}
if (opt_len > 0)
print_data(FNC"optional data : ",
cmdreject->data, rsp->len-2);
/* find connection object using id field */
con = get_first_con();
while (con && (con->sig_id_sent != rsp->id))
con = get_next_con(con);
if (con)
{
/* fixme -- set 'real' reason code */
con->c_status = CSTATUS_CMDREJECT;
l2ca_wakeup("l2cap cmd reject", con);
#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS
disable_rtx(con);
#endif
}
else
D_ERR("Could not find l2cap connection for this ID\n");
break;
====
I haven't tested it yet but if it works you could check it in if you want.
Hopefully I will be able to get the rest finished early next week.
brgds
Mattias
|