You can subscribe to this list here.
2001 |
Jan
|
Feb
(44) |
Mar
(202) |
Apr
(134) |
May
(89) |
Jun
(94) |
Jul
(58) |
Aug
(58) |
Sep
(56) |
Oct
(75) |
Nov
(26) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(24) |
Feb
(30) |
Mar
(15) |
Apr
(49) |
May
(12) |
Jun
(6) |
Jul
(11) |
Aug
(20) |
Sep
(19) |
Oct
(3) |
Nov
(13) |
Dec
(1) |
2003 |
Jan
(7) |
Feb
(4) |
Mar
(7) |
Apr
(5) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(51) |
Dec
(1) |
2004 |
Jan
(11) |
Feb
(5) |
Mar
|
Apr
(5) |
May
(2) |
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Mattias A. <mat...@us...> - 2001-03-30 12:31:38
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_user.h 1.1 Added The accompanying log: Initial version, holds stuff related to communicating with usermode stack |
From: Mattias A. <mat...@us...> - 2001-03-30 12:18:56
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bt_errno.h 1.1 Added The accompanying log: Initial version, unified way of communicating errors up to usermode |
From: Mattias A. <mat...@us...> - 2001-03-30 12:09:32
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- sdp.c 1.70 1.71=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: use define instead of numbers The diff of the modified file(s): --- sdp.c 2001/03/27 19:31:11 1.70 +++ sdp.c 2001/03/30 12:09:30 1.71 @@ -587,7 +587,7 @@ /* check if we have sent a pos response yet */ if (!l2ca_remote_conf_done(l2cap)) { /* still haven't sent a pos configure response*/ - if (l2ca_config_rsp(l2cap, 0, NULL, 1)) { + if (l2ca_config_rsp(l2cap, 0, NULL, CONF_SUCCESS)) { D_ERR(__FUNCTION__ " Conf rsp failed\n"); } } else=20 |
From: Mattias A. <mat...@us...> - 2001-03-30 12:08:46
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- tcs.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: use define instead of numbers The diff of the modified file(s): --- tcs.c 2001/02/15 16:27:34 1.14 +++ tcs.c 2001/03/30 12:08:45 1.15 @@ -302,7 +302,8 @@ if (!l2ca_remote_conf_done(l2cap)){ /* still haven't sent a pos configure response*/ =20=09=09 - if (l2ca_config_rsp(l2cap, l2cap->remote_mtu, NULL, 1)){ + if (l2ca_config_rsp(l2cap, l2cap->remote_mtu,=20 + NULL, CONF_SUCCESS)){ D_ERR("tcs_config_ind : Conf rsp failed\n"); }=20=20=20=20 =20=09=09 |
From: Mattias A. <mat...@us...> - 2001-03-30 12:04:45
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added test_process_cmd (unfinished) minor changes The diff of the modified file(s): --- test.c 2001/02/15 16:27:34 1.12 +++ test.c 2001/03/30 12:04:43 1.13 @@ -196,8 +196,10 @@ D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20 return; } +#ifdef BT_USERSTACK printk("'Authorization' pending for 5 secs...\n"); sleep(5); +#endif printk("Shutting off authorization pending.\n"); emulate_pending =3D 0; printk("Sending connect rsp with result =3D success back\n"); @@ -301,7 +303,7 @@ if (!l2ca_remote_conf_done(l2cap)){ /* still haven't sent a pos configure response*/ =20 - if (l2ca_config_rsp(l2cap, 0, NULL, 1 /* ok */)){ + if (l2ca_config_rsp(l2cap, 0, NULL, CONF_SUCCESS)){ D_ERR("test_config_ind : Configuration response failed\n"); }=20=20=20=20 } else=20 @@ -402,5 +404,18 @@ =20 return l2cap_send_data(tx_buf, con); } + +void test_process_cmd(unsigned char *cmd, s32 size) +{ + printk("test_process_cmd\n"); + print_data("cmd ", cmd, size); +=20=20 + /* fixme -- things to do */ + + /* init test layer */ + +=20=20 +} + =20 /****************** END OF FILE sdp.c ************************************= ***/ |
From: Mattias A. <mat...@us...> - 2001-03-30 12:04:11
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.95 1.96=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * fixed blocking connect / disconnect * lots of minor changes & cleanup The diff of the modified file(s): --- rfcomm.c 2001/03/12 15:54:35 1.95 +++ rfcomm.c 2001/03/30 12:03:25 1.96 @@ -132,7 +132,6 @@ #define NBROFCREDITS 6 =20 #define DEF_RFCOMM_MTU 127 -//#define DEF_RFCOMM_MTU 330 =20 /* The values in the control field when sending ordinary rfcomm packets */ #define SABM 0x2f @@ -545,11 +544,16 @@ /* One RFCOMM connection for each bt_tty 0 to 6 */ =20 #ifdef __KERNEL__ + +static struct timer_list rfcomm_timer; +#define RFCOMM_CON_TIMEOUT (5*HZ) + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) static struct wait_queue *rfcomm_disconnect_wq =3D NULL; #else static wait_queue_head_t rfcomm_disconnect_wq; #endif /* LINUX_VERSION_CODE */ + #endif /* __KERNEL__ */ =20 void send_send_data(unsigned long ptr); @@ -715,8 +719,6 @@ =20=09 if (!(rfcomm->l2cap)) { =20 - printk("we don't have l2cap ch yet for this rfcomm ch\n"); - rfcomm->dlci[0].state =3D CONNECTING;=20=20=20=20 =20 /* we don't have a l2cap connection yet */ @@ -779,12 +781,19 @@ =20=09=09 send_disc(rfcomm, tmp); =20 - /* fixme -- do this block from bluetooth.c x*/ - #ifdef __KERNEL__ + start_wq_timer(&rfcomm_timer, RFCOMM_CON_TIMEOUT, + &rfcomm_disconnect_wq); + + /* FIXME -- check that we haven't already received=20 + disconnect 'acknowledge' */ interruptible_sleep_on(&rfcomm_disconnect_wq); + + /* Now rfcomm is disconnected, disconnect l2cap */ + l2ca_disconnect_req(rfcomm->l2cap); - bt_unregister_rfcomm(line); + + /* Now l2cap ch for RFCOMM is disconnected */ #endif } else @@ -822,8 +831,6 @@ void rfcomm_connect_pnd(l2cap_con *l2cap, s32 status) { printk("rfcomm_connect_pnd : reason %d\n", status);=09 - //PRINTPSM(l2cap); - } =20 void=20 @@ -892,12 +899,14 @@ Check whether the received params are acceptable,=20 accept all for now */ + D_CTRL("rfcomm_config_ind : remote cid %d\n", l2cap->remote_cid); /* check if we have sent a pos response yet */ if (!l2ca_remote_conf_done(l2cap)){ /* still haven't sent a pos configure response*/ =20=09=09 - if (l2ca_config_rsp(l2cap, l2cap->remote_mtu,NULL,1)) { + if (l2ca_config_rsp(l2cap, l2cap->remote_mtu,=20 + NULL, CONF_SUCCESS)) { D_ERR(FNC"l2ca_config_rsp failed\n"); } } else=20 @@ -970,7 +979,7 @@ } =20 /* The lower protocol layer, L2CAP, indicates that the lower layer=20 - connection is disconnected. */ + connection is about to disconnect */ =20 void=20 rfcomm_disconnect_ind(l2cap_con *l2cap) @@ -982,23 +991,21 @@ =20 rfcomm =3D ((rfcomm_con*) l2cap->upper_con); =20 + + /* FIXME -- disconnect all rfcomm cons on this l2cap con=20 + if any */ + if (l2ca_disconnect_rsp(l2cap)) { D_ERR(FNC"l2ca_disconnect_rsp failed\n"); return; } =20 #ifdef __KERNEL__ - - bt_unregister_rfcomm(rfcomm->line); - /* notify upper tty that this rfcomm connection is down */ bt_hangupline(rfcomm->line); #else bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line, 0)); #endif -=09 - rfcomm_reset_con(rfcomm->line); -=09 #undef FNC } =20 @@ -1013,7 +1020,16 @@ =20 rfcomm =3D (rfcomm_con*) l2cap->upper_con; =20 + /* fixme -- should we indicate to bt interface when rfcomm is=20 + down or when l2cap for rfcomm is down ? */ bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line, 0)); +#ifdef __KERNEL__ + bt_unregister_rfcomm(rfcomm->line); + + /* wake up bt line */ + bt_disconnect_cfm(CREATE_RFCOMM_ID(rfcomm->line, 0),=20 + l2cap->c_result); +#endif =20=09 rfcomm_reset_con(rfcomm->line); =20=09 @@ -1155,14 +1171,17 @@ } else if (rfcomm->dlci[tmp_dlci].state =3D=3D DISCONNECTING) { if (tmp_dlci =3D=3D 0) { #ifdef __KERNEL__=20=20 + release_wq_timer(&rfcomm_timer); + /* this will take down l2cap aswell */ wake_up_interruptible(&rfcomm_disconnect_wq); + #else + /* usermode stack */ l2ca_disconnect_req(rfcomm->l2cap); #endif =20=20=20=20=20=20=20=20=20 } else { s32 tmp; -=09=09=09=09 rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED; tmp =3D get_connected_dlci(rfcomm); rfcomm->dlci[tmp].state =3D DISCONNECTING; @@ -1175,6 +1194,7 @@ }=20=20=20=20 break; =20=20=20=20=20 + /* Disconnect mode, 'NAK on SABM/DISC' */ case DM: D_CTRL(FNC"DM packet received\n"); rfcomm =3D ((rfcomm_con*) l2cap->upper_con); @@ -1195,12 +1215,14 @@ rfcomm->dlci[0].state =3D DISCONNECTED; /* FIXME: Tell the tty that the link is down */ + printk("RFCOMM control ch disconnected\n"); send_ua(rfcomm, tmp_dlci); - bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line, 0)); } else { rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED; send_ua(rfcomm, tmp_dlci); - bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line, tmp_dlci)); + D_CTRL("dlci %d was disconnected\n", tmp_dlci); + bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line,=20 + tmp_dlci)); } D_CTRL(FNC"DISC, sending back UA\n"); =20=20=20=20=20 @@ -1236,7 +1258,8 @@ } =20 if (GET_PF(short_pkt->h.control)) { - printk(FNC" %d more credits on dlci:%d...\n", *uih_data_start, tmp_dlci= ); + printk(FNC" %d more credits on dlci:%d...\n",=20 + *uih_data_start, tmp_dlci); if (crc_check(data, SHORT_CRC_CHECK,=20 uih_data_start[1])) { break; @@ -1390,7 +1413,6 @@ } =20 /* Parses a multiplexer control channel packet */ - void=20 process_mcc(u8* data, u32 len, rfcomm_con *rfcomm, s32 longpkt) { |
From: Mattias A. <mat...@us...> - 2001-03-30 12:01:34
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap_con.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * updated according to changes in l2cap_con struct * added l2ca_wait / l2ca_wakeup used to block on a connection * always set con =3D NULL after deleting it The diff of the modified file(s): --- l2cap_con.c 2001/02/28 13:31:00 1.4 +++ l2cap_con.c 2001/03/30 12:01:33 1.5 @@ -161,7 +161,6 @@ con->hci_hdl =3D hci_hdl; con->local_cid =3D lcid; con->remote_cid =3D rcid;=09 - con->ping_sent =3D 0; =20 con->next =3D con; con->prev =3D con; @@ -174,6 +173,7 @@ void=20 reset_con(l2cap_con* con) { + con->psm =3D 0; /* invalid */ con->local_cid =3D 0; con->remote_cid =3D 0; con->local_mtu =3D MTU_DEFAULT; @@ -184,9 +184,21 @@ con->conf_rsp_ready =3D TRUE; /* haven't started anything yet */ con->initiator =3D FALSE; /* Other side initiated (default) */=20 con->magic =3D L2CAP_CON_MAGIC; - con->ping_sent=3D0; - con->inforeq_sent=3D0; con->upper_con =3D NULL; + con->c_status =3D 0; + con->c_flags =3D 0; + + con->timer.rtx_action =3D RTX_ACTION_DISCONNECT; + con->timer.ertx_action =3D ERTX_ACTION_DISCONNECT; + con->timer.rtx_inuse =3D 0; + con->timer.ertx_inuse =3D 0; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) + con->wq =3D NULL; +#else + init_waitqueue_head(&con->wq); +#endif + } =20 l2cap_con* get_first_con(void) @@ -202,7 +214,6 @@ return con->next; } =20 - /* Searches list for remote bd addr and returns connection if found and if the connection is in state STATE */ =20 @@ -212,7 +223,7 @@ =20=20=20 D_CON("get_con : look for connections in state %s (%d)\n",=20 state_name[STATE], STATE); - PRINTPKT("get_con : bd ", bd, 6); + PRINTPKT("get_con : look for bd : ", bd, 6); =20=20=20 while (i<con_list.count) {=20 if (memcmp(bd, con_list.cur->remote_bd, 6) =3D=3D 0) { @@ -220,7 +231,7 @@ if (STATE =3D=3D ANY_STATE) { /* simply look for all connections with BD address bd*/ - PRINTPKT("get_con : con_list bd ",=20 + PRINTPKT("get_con : found bd ",=20 con_list.cur->remote_bd, 6); =20 if (PARANOIA_CHECKCON(con_list.cur)) { @@ -442,6 +453,7 @@ con_list.cur =3D 0; con_list.last =3D 0; kfree(con); + con =3D NULL; D_CON("Now connection list is empty !\n"); return 0; } @@ -459,6 +471,7 @@ con_list.count--; =20=20=20 kfree(con);=20 + con =3D NULL; =20=20=20 return 0;=20=20 } @@ -478,6 +491,51 @@ } D_CON("count_con : %d l2cap_con's found with hci_hdl:%d\n",sum,hci_hdl); return sum; +} + +/* only supports one call at a time */ +void +l2ca_wait(const char *str, l2cap_con *con) +{ + if (!(con->c_flags & FLAG_WAKEMEUP)) + { + if (con->c_flags & FLAG_DONTSLEEP) + { + printk("l2ca_wait : don't sleep flag set\n"); + return; + } +=09=20=20 + con->c_flags |=3D FLAG_WAKEMEUP; + printk("%s, sleep on wq 0x%x\n", str, (int)&con->wq); + interruptible_sleep_on(&con->wq); + printk("%s, woke up !\n", str); + } + else + { + printk("%s, wq already in use\n", str); + } +} + +void=20 +l2ca_wakeup(const char *str, l2cap_con *con) +{ + if (con->c_flags & FLAG_WAKEMEUP) + { + if (con->c_flags & FLAG_DONTSLEEP) + { + printk("l2ca_wakeup : don't sleep flag set\n"); + con->c_flags &=3D ~FLAG_DONTSLEEP; + return; + } +=09=20=20 + con->c_flags &=3D ~FLAG_WAKEMEUP; + printk("%s, wake up wq 0x%x\n", str,(int)&con->wq); + wake_up_interruptible(&con->wq); + } + else + { + printk("%s, wake up flag not set\n", str); + } } =20 #if L2CAP_SELFTEST |
From: Mattias A. <mat...@us...> - 2001-03-30 11:59:23
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.94 1.95=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added usage of l2ca_wait / l2ca_wakeup which blocks on a=20 connection until a response is received or the connection times out. * removed do_cmd_backup, use blocking calls in calling function instead * fixed l2cap_config_rsp with options / pending response /=20 not accepted config options * fixed bug when sending back responses and con->hci_hdl not yet set * added flags in l2cap_con struct to handle blocking calls and signalling/ result codes to upper layers.=20 * now handles conf resp flag (fragmented options) * fixed RTX/ERTX timer handling * removed l2cap_disconnect_wq * added l2ca_timeoutind * lots of minor changes and cleanup The diff of the modified file(s): --- l2cap.c 2001/03/27 19:32:28 1.94 +++ l2cap.c 2001/03/30 11:59:20 1.95 @@ -57,6 +57,7 @@ #include <linux/bluetooth/l2cap_internal.h> #include <linux/bluetooth/l2cap_con.h> #include <linux/bluetooth/l2cap_sec.h> +#include <linux/bluetooth/bt_errno.h> #else /* user mode */ #include <stdlib.h> #include <string.h> @@ -72,6 +73,7 @@ #include "include/test.h" #include "include/btmem.h" #include "include/local.h" +#include "include/bt_errno.h" #endif =20 /****************** DEBUG CONSTANT AND MACRO SECTION *********************= ***/ @@ -208,28 +210,21 @@ =20 static s32 parse_options(l2cap_con* con, u8 *data, u32 len); static void print_flow(flow *f); -static s32 l2cap_echo_rsp(s32 hci_hdl, s32 id, u8 *opt_data, s32 opt_len); static s32 l2cap_cmdrej(s32 hci_hdl, u8 reason, u8 *opt_data, s32 opt_len); =20 void insert_upper(protocol_layer *upper_layer); protocol_layer* get_upper(u32 psm); void remove_all_upper(void); =20 -#ifdef __KERNEL__ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -static struct wait_queue *l2cap_disconnect_wq =3D NULL; -#else -static wait_queue_head_t l2cap_disconnect_wq; -#endif /* LINUX_VERSION_CODE */ -#endif /* __KERNEL__ */ - #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS -#define MAX_NO_RTX 0 -#define RTX_TIMEOUT 5 /* sec */ + +/* fixme -- calculate this using flush timeout */ +#define MAX_NO_RTX 3 +#define RTX_TIMEOUT 2 /* sec */ #define ERTX_TIMEOUT 60 /* sec */ =20 #ifdef __KERNEL__ -void start_rtx(l2cap_con *con, unsigned short timeout); +void start_rtx(l2cap_con *con, unsigned short timeout, unsigned short acti= on); void disable_rtx(l2cap_con *con); void start_ertx(l2cap_con *con, unsigned short timeout); void disable_ertx(l2cap_con *con); @@ -240,15 +235,11 @@ =20 l2cap_con *timeout_con =3D NULL; s32 timer_cancelled =3D 0; -void start_rtx(l2cap_con *con, s32 timeout); +void start_rtx(l2cap_con *con, s32 timeout, u16 action); void disable_rtx(l2cap_con *con); void l2cap_rtx_timeout(void); #endif =20 -/* used to resend lost l2cap commands */ -void do_cmd_backup(l2cap_con *con, u8 type, u16 in_mtu,=20 - flow *outflow, u16 flush_timeout, u16 link_to, - u16 info_type); #endif =20 /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ @@ -308,13 +299,6 @@ DSYS("Local bd [%s]\n", bd_name); } =20 - /* Initialize the l2cap_disconnect_wq */ -#ifdef __KERNEL__ -#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0) - init_waitqueue_head(&l2cap_disconnect_wq); -#endif /* LINUX_VERSION_CODE */ -#endif /* __KERNEL__ */ - #ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER /* Initialize security */ l2cap_sec_man_init(); @@ -358,15 +342,23 @@ s32=20 l2cap_shutdown(void) { + //l2cap_con *con =3D get_first_con(); +=20=20 DSYS("Shutting down L2CAP\n"); if (!l2cap->initiated) { D_ERR("L2CAP not initiated\n"); return -1; } -=09 - /* FIXME - Disconnect all open connections */ =20 +#if 0 + /* Notify upper users, don't have time for real disconnect... */ + while (con!=3D NULL) { + l2ca_disconnect_ind(con); + con =3D get_next_con(con); + } +#endif + /* necessary ? */ free_list(); remove_all_upper(); =20 @@ -474,6 +466,7 @@ tmp_layer =3D l2cap->upper_layers; l2cap->upper_layers =3D tmp_layer->next_layer; kfree(tmp_layer); + tmp_layer =3D NULL; } } =20 @@ -655,7 +648,6 @@ if (pos < len){ cmd =3D (struct sig_cmd *)(data + pos); cmd->len =3D le16_to_cpu(cmd->len); - printk("pos %d, len %d\n", pos, len); DSYS("another command in same packet...(%d bytes)\n", cmd->len); } @@ -767,13 +759,17 @@ req->len-4); } =20 + /* Are we expecting more config requests ? */ + con->remote_flags =3D confreq->flags; + if (result !=3D CONF_SUCCESS) { /* we didn't like the options... */ DSYS("parse_options failed, send neg rsp\n"); =20 /* send back negative response */ - if (l2ca_config_rsp(con, result, STAT_NOINFO, 0) < 0) { - D_ERR("Couldnt send conf rsp\n"); + if (l2ca_config_rsp(con, result, STAT_NOINFO,=20 + CONF_FAILURE) < 0) { + D_ERR("Couldn't send conf rsp\n"); } return; } @@ -805,12 +801,17 @@ return; } =20=09=09=09 + /* Are we expecting more config requests ? */ + con->remote_flags =3D confreq->flags; + if (result !=3D RES_SUCCESS) { =20=09=09=09=09 /* we didn't like the options... */ =20=09=09=09=09 /* send back negative response */ - if (l2ca_config_rsp(con, result, STAT_NOINFO, 0) < 0) { + if (l2ca_config_rsp(con, result,=20 + STAT_NOINFO,=20 + CONF_FAILURE) < 0) { D_ERR("Couldnt send conf rsp\n"); } return; @@ -869,7 +870,7 @@ =20=20=20=20=20=20=20=20 case SIG_ECHOREQ: { sig_echo_pkt* echo; - D_STATE(FNC"echo request\n"); + D_STATE(FNC"Echo request\n"); =20=09=09 echo =3D (sig_echo_pkt *)(req->data);=09=09 =20 @@ -881,7 +882,7 @@ case SIG_INFOREQ: { /* Implementation specific */ sig_info_req *info; - D_STATE(FNC"info request\n"); + D_STATE(FNC"Info request\n"); =20=09=09 info =3D (sig_info_req*)(req->data); info->type =3D le16_to_cpu(info->type); @@ -896,7 +897,7 @@ =20 default: D_ERR("Unknown info request : type 0x%x\n", info->type); - l2cap_cmdrej(con->hci_hdl, CMDREJ_NOTUNDERSTOOD, + l2cap_cmdrej(hci_handle, CMDREJ_NOTUNDERSTOOD, NULL, 0); break;=09=09 } @@ -910,7 +911,7 @@ default: /* Not a valid command */ DSYS(FNC"Invalid command (code 0x%x)s\n", req->code); - l2cap_cmdrej(con->hci_hdl, CMDREJ_NOTUNDERSTOOD, NULL, 0); + l2cap_cmdrej(hci_handle, CMDREJ_NOTUNDERSTOOD, NULL, 0); break; } #undef FNC @@ -939,7 +940,7 @@ switch (rsp->code) { case SIG_CMDREJECT: D_STATE(FNC"Command reject - \n"); -=20=20=20=20=20=20=20=20=20 + DSYS("Got command reject\n"); cmdreject =3D (sig_cmdreject*)rsp->data; cmdreject->reason =3D le16_to_cpu(cmdreject->reason); opt_len =3D rsp->len - sizeof(sig_cmdreject); @@ -964,6 +965,15 @@ if (opt_len > 0) print_data(FNC"optional data : ",=20 cmdreject->data, rsp->len-2); + + /* fixme -- set 'real' reason code */ + con->c_status =3D CSTATUS_CMDREJECT; +=09=09 + l2ca_wakeup("l2cap cmd reject", con); + +#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS=09=09 + disable_rtx(con); +#endif break; =20=20=20=20=20=20=20=20 case SIG_CONRSP: @@ -989,41 +999,40 @@ return; } =20=20=20=20=20=20=20=20=20=20 -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - disable_rtx(con); -#endif + con->c_status =3D conrsp->result;=09=09 =20 switch (conrsp->result) { case RES_SUCCESS: + l2ca_wakeup("l2cap_connect_rsp", con); ENTERSTATE(con, CONFIG); PRINTSTATE(con); l2ca_connect_cfm(con, conrsp->result); break; =20=20=20=20=20=20=20=20=20=20=20=20 case RES_PENDING: + + /* wake up when real con resp comes */ l2ca_connect_pnd(con, conrsp->status); #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS /* Disable RTX timer and start ERTX */ - //start_ertx(); + disable_rtx(con); + start_ertx(con, ERTX_TIMEOUT); #endif - D_STATE(FNC"connection pending (fixme)\n"); + D_STATE(FNC"connection pending\n"); break; =20 case RES_PSMNEG: - /* FIXME */ DSYS(FNC"connection refused, psm 0x%x not supp\n",=20 con->psm); failure =3D 1; break; =20 case RES_SECNEG: - /* FIXME */ DSYS(FNC"connection refused, security block\n"); failure =3D 1; break; =20=20=20=20=20=20=20=20=20=20=20=20 case RES_NOSRC: - /* FIXME */ DSYS(FNC"connection refused, no resources\n"); failure =3D 1; break; @@ -1034,18 +1043,16 @@ } =20=20=20=20=20=20=20=20=20=20 if (failure) { - /* Connection refused=20 - FIXME - - Disable RTX/ERTX timers - (New state : CLOSED) - */ + #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS disable_rtx(con); - //disable_ertx(con); + disable_ertx(con); #endif =20 l2ca_connect_cfm(con, MSGCODE(MSG_LAYER_L2CAP, conrsp->result)); =20=09=09=09 + l2ca_wakeup("Got connect rsp neg", con); +=09=09=09 ENTERSTATE(con, CLOSED); delete_con(con); } @@ -1079,19 +1086,15 @@ =20 switch (confrsp->result) { case CONF_SUCCESS: + #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS disable_rtx(con); #endif - - /* FIXME - should check that we have received=20 - l2cap_config_req & replied pos. If we are server=20 - we can now proceed to OPEN (will do for now) */ -=20=20=20=20=20=20=20=20=20=20=20 con->conf_req_ready =3D TRUE; =20 if (!con->conf_rsp_ready) { /* Upper layers still haven't replied pos */ - DSYS("Still haven't replied pos on other sides conf req\n"); + D_STATE("Still haven't replied pos on other sides conf req\n"); return ; } else {=09=09=09=09 ENTERSTATE(con, OPEN); @@ -1103,19 +1106,25 @@ /* notify upper layers that we successfully opened a connection ! */ l2ca_config_cfm(con, confrsp->result); - } - return; + } return; =20=09=09=09 case CONF_FAILURE: + + /* store remote side configuration */ + parse_options(con, confrsp->options, opt_len); + D_STATE(FNC"config failure, unacceptable params\n"); + l2ca_config_cfm(con, confrsp->result); break; =20=20=20=20=20=20=20=20=20=20=20=20 case CONF_REJ: D_STATE(FNC"connection refused, no reason\n"); + l2ca_config_cfm(con, confrsp->result); break; =20=20=20=20=20=20=20=20=20=20=20=20 case CONF_UNKNOWN: D_STATE(FNC"connection refused, unknown options\n"); + l2ca_config_cfm(con, confrsp->result); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 default: @@ -1133,17 +1142,11 @@ D_ERR(FNC"SIG_CONFRSP invalid state\n"); PRINTSTATE(con); =20 - /* FIXME - should stay in CONFIG state and renegotiate=20 - according to spec */ - printk("FIXME -- CONFIG failed, remain in CONFIG and renegotiate\n"); /* print failed options */ if (opt_len > 0) print_data("Options not accepted\n", confrsp->options,=20 rsp->len - sizeof(sig_confrsp)); =20 - /* For now we simply disconnect if params failed */ - l2ca_config_cfm(con, confrsp->result); - l2ca_disconnect_req(con); break; =20=20=20=20=20=20=20=20=20 case SIG_DISCRSP: @@ -1165,15 +1168,17 @@ =20=09=20=20=20=20=20=20=20=09=20=20=20=20=20=20=20 /* match id with request */ if (!id_matched(con, rsp->id)) { - D_ERR(FNC"ID doesn't match ! [%d:%d]\n", con->sig_id_sent, rsp->id);=09= =09=09 + D_ERR(FNC"ID doesn't match ! [%d:%d]\n",=20 + con->sig_id_sent, rsp->id); return; } =20 #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS disable_rtx(con); #endif=09 - l2ca_disconnect_cfm(con); + con->c_result =3D RES_SUCCESS; + l2ca_wakeup("l2cap_disconnect_rsp", con); break; =20=20=20=20=20=20=20=20 case SIG_ECHORSP: { @@ -1193,31 +1198,47 @@ PRINTPKT(FNC"optional data ",=20 echo->data, rsp->len-sizeof(sig_echo_pkt)); =20 - l2ca_ping_rsp(echo->data,=20=20 - rsp->len-sizeof(sig_echo_pkt), - tempcon->remote_bd); +#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS + disable_rtx(tempcon); +#endif + /* now wake up l2ca_ping */ =20 - /* for now we disconnect every time a successful=20 - ping was made if no others are using this handle */ + tempcon->c_status =3D CSTATUS_SUCCESS; + tempcon->c_result =3D RES_SUCCESS; + l2ca_wakeup("echo resp received", tempcon); =20=09=09 - if (count_con(hci_handle) =3D=3D 1) { - printk("DO NOT disconnect after doing ping...\n"); - //lp_disconnect(hci_handle); - } break; }=20=20=20=20 =20=20=20=20=20=20=20=20 - case SIG_INFORSP: + case SIG_INFORSP: { + l2cap_con *tempcon; + + if ((tempcon =3D get_con_hcihdl(hci_handle))=3D=3DNULL) { + D_STATE("Echo rsp : could not find connection\n"); + return; + } + info =3D (sig_info_rsp *)(rsp->data); info->type =3D le16_to_cpu(info->type); info->result =3D le16_to_cpu(info->result); +=09=09 D_STATE(FNC"Got info response : result %d\n", info->result); + +#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS + disable_rtx(tempcon); +#endif + /* now wake up l2ca_ping */ +=09=09 + tempcon->c_status =3D RES_SUCCESS; + l2ca_wakeup("info resp received", tempcon); +=09=09 break; + } =20=20=20=20=20=20=20=20 default: /* Not a valid command */ DSYS(FNC"Invalid command 0x%x\n", rsp->code); - l2cap_cmdrej(con->hci_hdl, CMDREJ_NOTUNDERSTOOD, NULL, 0); + l2cap_cmdrej(hci_handle, CMDREJ_NOTUNDERSTOOD, NULL, 0); break; } =20=09 @@ -1305,17 +1326,16 @@ Confirms the request to establish a baseband connection */ =20 -/* FIXME - add passing authentication challenge if auth is required=20 - to establish the physical link */ -=20=20 void=20 lp_connect_cfm(u8 *bd_addr, u32 status, u16 con_hdl) { l2cap_con *con; D_STATE("lp_connect_cfm: %s (hci_handle : %d)\n",=20 get_err_msg(status), con_hdl); + print_data("lp_connect_cfm BD", bd_addr, 6); =20 - /* FIXME -- use bt session list to notify upper layers that con failed !!= ! */ + /* FIXME -- use bt session list to notify upper layers that=20 + con failed !!! */ =20 /* search for the corresponding l2cap connection */ if ((con =3D get_con(bd_addr, CLOSED)) =3D=3D NULL) { @@ -1323,75 +1343,57 @@ return; } =20=09 + con->c_status =3D status; +=09 if (status =3D=3D 0) { /* pos cfm */ con->hci_hdl =3D con_hdl; con->link_up =3D TRUE; =20 + /* see if there is someone to wakeup */ + l2ca_wakeup("lp_connect_cfm", con); +=09=09 + if (con->c_flags & FLAG_RETURNNOW) + { + printk("Return NOW\n"); + /* clear flag & set status */ + con->c_flags &=3D ~FLAG_RETURNNOW; + return; + } #ifdef __CRIS__ bt_connections++; #endif =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 - /* Check if a ping is to be sent */ - if (con->ping_sent) { - D_STATE("baseband up, now send ping\n"); - l2cap_echo_req(con, NULL, 0); - con->ping_sent=3D0; /* only send one / request */ - return; /* don't try to connect l2cap... */ - } - - /* Check if a info req is to be sent */ - if (con->inforeq_sent) { - D_STATE("baseband up, now send info req\n"); - printk("info type %d\n", con->last_cmd.inforeq_type); - l2cap_info_req(con, con->last_cmd.inforeq_type); - con->inforeq_sent=3D0; /* only send one / request */ - return; /* don't try to connect l2cap... */ - } -=09=09 if (!(con->initiator)) {=09=09 - D_STATE("we are server\n"); + D_STATE("We are server\n"); /* now wait for a connection request */ } else { - D_STATE("we are client\n"); + D_STATE("We are client\n"); PRINTPKT("lp_connect_cfm : HCI connected to ",=20 bd_addr,6); =20=20=20=20=20=20=20 ENTERSTATE(con, W4_L2CAP_CONNECT_RSP); PRINTSTATE(con); =20=09=09=09 -#ifdef BTD_USERSTACK - /* wait for 3coms HW while they are doing=20 - write_link_policy ?!? */ - printk("sleeping 3 sec... (3com fix)\n");=09 - sleep(3); -#endif - -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - do_cmd_backup(con, SIG_CONREQ, 0, NULL, 0, 0, 0); -#endif - /* baseband is up, now initiate l2cap */ - l2cap_connect_req(con, con->psm); + l2ca_wakeup("lp_connect_cfm", con); } } else { /* neg cfm */ D_STATE("lp_connect_cfm : (neg) %s\n",get_err_msg(status)); con->link_up =3D FALSE; =20=09=09 - /* don't notify upper layers if cfm originated from a ping */ - if (con->ping_sent=3D=3D1) { - /* Remove connection object */ - delete_con(con); + l2ca_wakeup("lp_connect_cfm (neg)", con); +=09=09 + if (con->c_flags & FLAG_RETURNNOW) + { + con->c_flags &=3D ~FLAG_RETURNNOW; return; } =20 /* only notify upper layers if we are initiator */ if (con->initiator) - l2ca_connect_cfm(con, MSGCODE(MSG_LAYER_HCI, status)); - - DSYS("ACL link failed for some reason, remove con object\n"); - /* Always remove connection object */ - delete_con(con); + l2ca_connect_cfm(con, MSGCODE(MSG_LAYER_HCI,=20 + status)); } } =20=20 @@ -1422,7 +1424,7 @@ #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS /* cancel any outstanding timers */ disable_rtx(con); - //disable_ertx(con); + disable_ertx(con); #endif =20 /* if not connected yet simply remove it */ @@ -1560,20 +1562,46 @@ con->link_up =3D 1; ENTERSTATE(con, W4_L2CAP_CONNECT_RSP); PRINTSTATE(con); -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - do_cmd_backup(con, SIG_CONREQ, 0, NULL, 0, 0, 0); -#endif + l2cap_connect_req(con, psm); =20 return 0; } else { D_STATE("l2ca_connect_req : create new baseband link\n"); - /* create baseband connection, l2cap_connect_req is called=20 - from lp_connect_cfm */ - return lp_connect_req(con->remote_bd);=20=20 + lp_connect_req(con->remote_bd);=20=20 + + /* wait here until we received a lp_connect_cfm */ + l2ca_wait("l2ca_connect_req : wait baseband", con); +=09=09 + if (con->c_status !=3D RES_SUCCESS) { + D_ERR("l2cap_connect_req failed !\n"); + delete_con(con); + return -1; } } =20 + /* Now send connect req */ + con->c_status =3D CSTATUS_RTX_TIMEOUT; + + /* Leave loop when either status failed or success */ + while (con->c_status =3D=3D CSTATUS_RTX_TIMEOUT) + { + /* baseband is up, now initiate send connect req */ + l2cap_connect_req(con, con->psm); + + /* wait until we received a response or after timeout */ + +#ifdef BTD_USERSTACK + printk("Sleeping 2 sec\n");=09 + sleep(2); +#else + l2ca_wait("l2cap_connect_req : wait rsp", con); +#endif + } + + return con->c_result; +} + /* params determines how we would like to receive data */ s32=20 l2ca_config_req(l2cap_con *con, u16 in_mtu, flow *outflow,=20 @@ -1592,10 +1620,6 @@ if (con->current_state =3D=3D CONFIG) {=20=20 /* local mtu is set in l2cap_config_req */ =20 -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - do_cmd_backup(con, SIG_CONFREQ, in_mtu, outflow,=20 - flush_timeout, link_to, 0); -#endif=09=09 return l2cap_config_req(con, in_mtu, outflow,=20 flush_timeout, link_to);=20=20 =20 @@ -1616,10 +1640,7 @@ =20 con->conf_req_ready =3D FALSE; con->conf_rsp_ready =3D FALSE; -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS=09=09 - do_cmd_backup(con, SIG_CONFREQ, in_mtu, outflow,=20 - flush_timeout, link_to, 0); -#endif + return l2cap_config_req(con, in_mtu, outflow,=20 flush_timeout, link_to);=20=20 return -1; @@ -1644,9 +1665,6 @@ =20 if (con->current_state =3D=3D OPEN || con->current_state =3D=3D CONFIG) { =20 -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - do_cmd_backup(con, SIG_DISCREQ, 0, NULL,0, 0, 0); -#endif result =3D l2cap_disconnect_req(con); =20 ENTERSTATE(con, W4_L2CAP_DISCONNECT_RSP); @@ -1655,10 +1673,11 @@ D_ERR("l2ca_disconnect_req : Invalid state !\n"); return -1;=20=20=20=20 } -#ifdef __KERNEL__ - interruptible_sleep_on(&l2cap_disconnect_wq); -#endif - return result; +=09 + /* wait here until we get a confirm */ + l2ca_wait("l2ca_disconnect_req", con); + + return con->c_result; } =20 =20 @@ -1691,7 +1710,7 @@ PRINTSTATE(con); }=20 else if (response =3D=3D RES_PENDING) { - /* remain in */ + /* remain in same state */ } else if (response >=3D RES_PSMNEG) { /* 'l2ca_connect_rsp_neg()' */ @@ -1704,13 +1723,11 @@ return result; } =20 - -/* fixme -- use inparams... */ s32=20 -l2ca_config_rsp(l2cap_con* con, u32 out_mtu, flow *in_flow, s32 ok) +l2ca_config_rsp(l2cap_con* con, u32 out_mtu, flow *in_flow, s32 result) { #define FNC "l2ca_config_rsp : " - s32 result; + s32 ret_val =3D -1; =20 if (PARANOIA_CHECKCON(con)) { D_ERR("%s l.%d NULL/magic failed\n", __FILE__, __LINE__); @@ -1726,14 +1743,14 @@ return -1; } =20 - if (ok) { + if (result =3D=3D CONF_SUCCESS) { /* upper layers responded OK */ con->conf_rsp_ready =3D TRUE; =20 - result =3D l2cap_config_rsp(con, out_mtu, in_flow); + ret_val =3D l2cap_config_rsp(con, out_mtu, in_flow, result); =20 /* check if we have sent a configure request yet */ - if (con->conf_req_ready) { + if (con->conf_req_ready && !con->remote_flags) { /* all done, proceed to OPEN */ ENTERSTATE(con, OPEN); PRINTSTATE(con); @@ -1745,19 +1762,14 @@ l2ca_config_cfm(con, RES_SUCCESS); =20 } else { - DSYS(FNC"Not yet a pos rsp on config_req\n"); + D_STATE(FNC"Conf not done or flags set\n"); } } else { - /* FIXME - send l2cap_config_rsp_neg */ - D_STATE(FNC"params not accepted by us (FIXME !!) !\n"); -=09=09 - /* add result parameter in l2cap_config_rsp (for neg rsp) */ -=09=09 - l2cap_config_rsp(con, out_mtu, in_flow); - //l2ca_config_cfm(con, result); - return -1; + D_STATE("We don't accepted remote options\n"); + ret_val =3D l2cap_config_rsp(con, out_mtu, in_flow, result); } - return result; + + return ret_val; #undef FNC } =20 @@ -1809,10 +1821,114 @@ /* (E5) Timer events */ /********************/ =20 -/* FIXME !*/ -/* RTX */ -/* ERTX */ +#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS + +void l2ca_timeoutind(l2cap_con *con) +{ + printk("l2ca_timeoutind\n"); + con->c_status =3D CSTATUS_RTX_TIMEOUT;=09 + l2ca_wakeup("l2ca_timeoutind ", con); +} + +#ifdef __KERNEL__ +void +l2cap_rtx_timeout(unsigned long ptr) +{ + l2cap_con *con =3D (l2cap_con*)ptr; +#else /* usermode timer */ +void +l2cap_rtx_timeout(void) +{ + l2cap_con *con =3D timeout_con; + + if (timer_cancelled) { + D_TIM("RTX timer already cancelled\n"); + return; + } +#endif + /* do some paranoia checks */ + + if (PARANOIA_CHECKCON(con)) { + D_ERR("%s l.%d NULL/magic failed\n", __FILE__, __LINE__); + return; + } + + D_TIM("l2cap_rtx_timeout (current no rtx : %d)\n",=20 + con->timer.rtx_no); +=20=20=20=20=20=20 + con->timer.rtx_inuse =3D 0; +=20=20 + if (con->timer.rtx_no =3D=3D MAX_NO_RTX) + { + con->c_status =3D CSTATUS_MAX_NO_RTX; +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + D_TIM("Connection unresponsive\n"); +=09=09 + show_con("Connection unresponsive\n", con); +=09=09 + con->c_result =3D MSGCODE(MSG_LAYER_L2CAP,=20 + L2CAP_CON_UNRESPONSIVE); +=09=09 + l2ca_wakeup("rtx_timeout", con); + + /* reset rtx counter */ + con->timer.rtx_no =3D 0; + + if (con->timer.rtx_action =3D=3D RTX_ACTION_START_ERTX) { + /* start ertx timer */ + D_TIM("Starting ERTX\n"); + start_ertx(con, ERTX_TIMEOUT); + } + else if (con->timer.rtx_action =3D=3D RTX_ACTION_TERMINATE){ + D_TIM("Removing connection\n"); + l2ca_disconnect_ind(con); + ENTERSTATE(con, CLOSED); + delete_con(con); + } + } + else + {=20=20 + con->timer.rtx_no++; + l2ca_timeoutind(con);=09 + } +=09 +=09 +#ifndef __KERNEL__ + timeout_con =3D NULL; +#endif +} =20 +void +l2cap_ertx_timeout(unsigned long ptr) +{ + l2cap_con *con; + D_TIM("l2cap_ertx_timeout\n"); + con =3D (l2cap_con*)ptr; + + /* do paranoia check */ + if (PARANOIA_CHECKCON(con)) { + D_ERR("%s l.%d NULL/magic failed\n", __FILE__, __LINE__); + return; + } + + if (con->timer.ertx_action =3D=3D ERTX_ACTION_TERMINATE) { + D_TIM("Removing connection\n"); + l2ca_disconnect_ind(con); + ENTERSTATE(con, CLOSED); + delete_con(con); + } else if (con->timer.ertx_action =3D=3D ERTX_ACTION_DISCONNECT) { +=09=09 + D_TIM("Disconnect connection\n"); + /* set dont sleep flag so that we wont do sleep=20 + when not running in usermode context */ + con->c_flags |=3D FLAG_DONTSLEEP; + ENTERSTATE(con, CONFIG); /* CERT HACK ! */ + l2ca_disconnect_req(con); + } +} + +#endif /* CONFIG_BLUETOOTH_L2CAP_USE_TIMERS */ + /*******************************************************************/ /*-------------------------- ACTIONS ------------------------------*/ /*******************************************************************/ @@ -1890,7 +2006,7 @@ =20=09 #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS /* start retransmission timer */ - start_rtx(con, RTX_TIMEOUT); + start_rtx(con, RTX_TIMEOUT, RTX_ACTION_START_ERTX); #endif return hci_send_data(tx); } @@ -1951,14 +2067,13 @@ req =3D (sig_confreq*)(l2cap_buf->frame + L2CAP_HDRSIZE + SIGCMD_HDRSIZE); =20=09 if (opt_len > 0) { - printk("sending options...\n"); /* if the negotiated mtu differs from the current, send it */ =20=20=20=20=20=20=20=20=20=20=20 opt =3D (struct l2cap_option*)(l2cap_buf->frame+L2CAP_HDRSIZE +=20 SIGCMD_HDRSIZE + CONF_REQSIZE); =20=20 if (in_mtu !=3D 0) { - printk("sending in_mtu %d\n", in_mtu); + printk("Sending in_mtu %d\n", in_mtu); opt->type =3D OPT_MTU; opt->len =3D 2; *(opt->option_data) =3D (u8)(in_mtu & 0x00ff); @@ -1969,7 +2084,7 @@ } =20=09=09 if (flush_timeout !=3D 0) { - printk("sending flush_timeout %d\n", flush_timeout); + printk("Sending flush_timeout %d\n", flush_timeout); opt->type =3D OPT_FLUSH; opt->len =3D 2; *(opt->option_data) =3D (u8)(flush_timeout & 0x00ff); @@ -1980,7 +2095,7 @@ } =20=09=09 if (outflow !=3D NULL){=20 - printk("sending conf req outflow %d\n", flush_timeout); + printk("Sending conf req outflow\n"); print_flow(outflow); opt->type =3D OPT_QOS; opt->len =3D sizeof(flow); @@ -2011,7 +2126,7 @@ print_data("l2cap options : ", (char*)opt , opt_len); #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS /* start retransmission timer */ - start_rtx(con, RTX_TIMEOUT); + start_rtx(con, RTX_TIMEOUT, RTX_ACTION_START_ERTX); #endif return hci_send_data(tx); } @@ -2055,13 +2170,13 @@ =20 #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS /* start retransmission timer */ - start_rtx(con, RTX_TIMEOUT); + start_rtx(con, RTX_TIMEOUT, RTX_ACTION_TERMINATE); #endif return hci_send_data(tx); } =20 s32=20 -l2cap_echo_req(l2cap_con *con, u8 *opt_data, s32 opt_len) +l2cap_echo_req(l2cap_con *con, u8 *opt_data, u16 opt_len) { bt_tx_buf *tx;=20 l2cap_tx_buf *l2cap_buf; /* Entire l2cap frame + lower layer hdrs */ @@ -2098,16 +2213,18 @@ /* pb_flag is set from hci_send_data */ tx->hci_hdl =3D hci_hdl; tx->bc_flag =3D NO_BROADCAST; - tx->cur_len =3D L2CAP_HDRSIZE + payload_len; /* Increased when lower - layers add header data */ + + /* Increased when lower layers add header data */ + tx->cur_len =3D L2CAP_HDRSIZE + payload_len; + #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - start_rtx(con, RTX_TIMEOUT); + start_rtx(con, RTX_TIMEOUT, RTX_ACTION_DISCONNECT); #endif return hci_send_data(tx); } =20 s32=20 -l2cap_echo_rsp(s32 hci_hdl, s32 id, u8 *opt_data, s32 opt_len) +l2cap_echo_rsp(s32 hci_hdl, s32 id, u8 *opt_data, u16 opt_len) { bt_tx_buf *tx;=20 l2cap_tx_buf *l2cap_buf; /* Entire l2cap frame + lower layer hdrs */ @@ -2186,7 +2303,7 @@ tx->cur_len =3D L2CAP_HDRSIZE + payload_len; /* Increased when lower layers add header data */ #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS - start_rtx(con, RTX_TIMEOUT); + start_rtx(con, RTX_TIMEOUT, RTX_ACTION_TERMINATE); #endif return hci_send_data(tx); } @@ -2320,7 +2437,6 @@ if ((rsp->result =3D cpu_to_le16(response)) =3D=3D RES_PENDING) rsp->status =3D cpu_to_le16(status); else { - printk("Result not pending, force status =3D no further info\n"); rsp->status =3D cpu_to_le16(STAT_NOINFO); } =20=09 @@ -2338,27 +2454,40 @@ return hci_send_data(tx);=20=20 } =20=20 + s32=20 -l2cap_config_rsp(l2cap_con* con, u32 out_mtu, flow *in_flow) +l2cap_config_rsp(l2cap_con* con, u32 out_mtu, flow *in_flow, s32 result) { bt_tx_buf *tx;=20 l2cap_tx_buf *l2cap_buf; /* Entire l2cap frame + lower layer hdrs */ sig_cmd *cmd; sig_confrsp *rsp; u16 payload_len; + int opt_len =3D 0; + struct l2cap_option *opt; =20 D_XMIT("l2cap_config_rsp : rcid : %d, out_mtu: %d \n",=20 con->remote_cid, out_mtu); -#if 0 + + /* If negative, the accepted options are sent back */ if (result !=3D RES_SUCCESS) { - /* FIXME -- send back negative response */ - DSYS("FIXME !!!!!!!!!!!!!!!!!!!!!!!! neg config rsp\n"); + + DSYS("Neg config rsp !\n"); + + if (out_mtu !=3D 0) { + con->remote_mtu =3D out_mtu; + opt_len+=3D4; } -#endif + if (in_flow !=3D NULL){ + /* The accepted settings for incoming traffic */ + opt_len +=3Dsizeof(flow); + } + } =20 - payload_len =3D SIGCMD_HDRSIZE + CONF_RSPSIZE; + payload_len =3D SIGCMD_HDRSIZE + CONF_RSPSIZE + opt_len; =20=20=20 - tx =3D subscribe_bt_buf(sizeof(l2cap_tx_buf) + L2CAP_HDRSIZE+payload_len); + tx =3D subscribe_bt_buf(sizeof(l2cap_tx_buf) +=20 + L2CAP_HDRSIZE+payload_len); if (!tx) { D_ERR("l2cap_config_rsp : didn't get a valid tx buf\n"); return -1; @@ -2367,29 +2496,57 @@ l2cap_buf =3D (l2cap_tx_buf *)(tx->data); =20 cmd =3D (sig_cmd*)(l2cap_buf->frame + L2CAP_HDRSIZE); - rsp =3D (sig_confrsp*)(l2cap_buf->frame + L2CAP_HDRSIZE + SIGCMD_HDRSIZE); + rsp =3D (sig_confrsp*)(l2cap_buf->frame + L2CAP_HDRSIZE +=20 + SIGCMD_HDRSIZE); =20=20=20 /* Now fill in header fields */=20=20 rsp->src_cid =3D cpu_to_le16(con->remote_cid); + rsp->flags =3D con->remote_flags; + rsp->result =3D cpu_to_le16((u16)result); =20 - /* FIXME - WHERE ARE THIS DETERMINED ??? */ - rsp->flags =3D 0; /* No more config responses to follow */ + /* Include unaccepted options if any */ + if (opt_len) + { + opt =3D (struct l2cap_option*)(rsp + CONF_RSPSIZE); =20 - rsp->result =3D cpu_to_le16(CONF_SUCCESS); + if (out_mtu !=3D 0) { + printk("Sending out_mtu %d\n", out_mtu); + opt->type =3D OPT_MTU; + opt->len =3D 2; + *(opt->option_data) =3D (u8)(out_mtu & 0x00ff); + *(opt->option_data+1) =3D (u8)(out_mtu>>8) & 0x00ff; =20=20=20 + /* forward pointer for other options */ + opt =3D (struct l2cap_option*)((char *)opt + 4); + } +=09=09 + if (in_flow !=3D NULL){=20 + printk("Sending conf req in_flow\n"); + print_flow(in_flow); + opt->type =3D OPT_QOS; + opt->len =3D sizeof(flow); + memcpy((char*)opt+2, in_flow, sizeof(flow)); + } + print_data("options : ", (u8*)rsp, opt_len + CONF_RSPSIZE); + } +=09 cmd->code =3D SIG_CONFRSP; - cmd->id =3D con->sig_id_rcv; /* Send back same id as received on request = */ - cmd->len =3D cpu_to_le16(CONF_RSPSIZE); + cmd->id =3D con->sig_id_rcv; /* Send back same id as received on=20 + request */ =20 + cmd->len =3D cpu_to_le16(CONF_RSPSIZE + opt_len); =20 SET_L2CAP_HDR(l2cap_buf->frame, payload_len, CIDSIG); =20 /* pb_flag is set from hci_send_data */ tx->hci_hdl =3D con->hci_hdl; tx->bc_flag =3D NO_BROADCAST; - tx->cur_len =3D L2CAP_HDRSIZE + payload_len; /* Increased when lower - layers add header data */ - PRINTPKT("config rsp : ", l2cap_buf, L2CAP_HDRSIZE + payload_len); +=09 + /* Increased when lower layers add header data */ + tx->cur_len =3D L2CAP_HDRSIZE + payload_len; + + PRINTPKT("config rsp : ", (u8*)l2cap_buf,=20 + L2CAP_HDRSIZE + payload_len); return hci_send_data(tx); } =20 @@ -2516,6 +2673,8 @@ return; } =20=09 + con->c_result =3D L2CAP_CON_PENDING; +=09 get_upper(con->psm)->con_pnd(con, status);=20 } =20 @@ -2580,33 +2739,33 @@ DSYS("l2cap channel (%d,%d) [%s] disconnected\n",=20 con->local_cid, con->remote_cid, psm2str(con->psm)); =20 + /* remove l2cap connection */ + delete_con(con); + +#ifdef __KERNEL__ + l2ca_wakeup("l2ca_disconnect_cfm", con); +#endif + /* fixme -- if we want to keep baseband connection we must=20 leave the l2cap connection which holds the hci handle=20 simply just clear l2cap params but keep hci handle ! */ =20=09 - /* remove l2cap connection */ - delete_con(con); - if (count_con(tmp_hdl) =3D=3D 0) { DSYS("l2ca_disconnect_cfm : (C) no more l2cap connections\n"); DSYS("Shutdown baseband\n"); lp_disconnect(tmp_hdl); } -#ifdef __KERNEL__ - wake_up_interruptible(&l2cap_disconnect_wq); -#endif } =20 -s32 l2ca_ping(BD_ADDR bd) +s32 l2ca_ping(BD_ADDR bd, u8 *opt_data, u16 len) { l2cap_con *con; s32 i ; u8 rev_bd[6]; =20 D_XMIT("Sending ping\n"); - PRINTPKT("Ping destination : bd ", bd, 6) ; + print_data("Ping destination : bd ", bd, 6) ; =20 - /* up3 --remove */ /* bd is big endian, reverse byte order to little endian */ for (i =3D 0; i < 6; i++) { rev_bd[5-i] =3D bd[i]; @@ -2614,7 +2773,7 @@ =20=09 con =3D get_con(rev_bd, ANY_STATE); =20 - if (!con) { + if (con =3D=3D NULL) { D_STATE("l2ca_ping : create new baseband link\n"); con =3D create_con(0/* not yet set */,=20 get_cid(), 0/* not yet set */); @@ -2625,38 +2784,56 @@ =20 memcpy(con->remote_bd, rev_bd, 6); con->link_up =3D 0; - con->ping_sent =3D 1; con->initiator =3D 1; insert_con(con); - /* l2cap_echo_req is called in lp_connect_cfm */ - return lp_connect_req(con->remote_bd); - } else { - /* use existing handle */ - D_STATE("l2ca_ping : using existing handle\n"); - con->ping_sent=3D1; -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS=09=09 - do_cmd_backup(con, SIG_ECHOREQ, 0, NULL, 0, 0, 0); -#endif - l2cap_echo_req(con, NULL, 0); - return 0 ; + + /* c_flags used to not try to connect l2cap when=20 + lp_connect_cfm arrives */ + con->c_flags |=3D FLAG_RETURNNOW; + + lp_connect_req(con->remote_bd); + + /* wait here until we received a lp_connect_cfm */ + l2ca_wait("l2ca_ping : wait baseband", con); +=09=09 + + if (con->c_status =3D=3D RES_SUCCESS) { + /* check status */ + printk("Now we got baseband, send echo req !\n"); + } + else { + printk("Ping failed !\n"); + delete_con(con); + return -1; } } =20 -void l2ca_ping_rsp(u8 *data, u32 len, BD_ADDR remote_bd) + /* Now send echo req */=09 + + con->c_status =3D CSTATUS_RTX_TIMEOUT; + + /* leave loop when either status failed or success */ + while (con->c_status =3D=3D CSTATUS_RTX_TIMEOUT) { -#ifdef BTD_USERSTACK - printf("Ping : got response from %02x:%02x:%02x:%02x:%02x:%02x\n\n",=20 - remote_bd[5], remote_bd[4],=20 - remote_bd[3], remote_bd[2],=20 - remote_bd[1], remote_bd[0]); - if (len > 0) - print_data("ping data : ", data, len); -#else - /* Fixme - indicate to usermode requester */ - D_STATE("ping : got response\n\n"); -#endif + printk("Sending echo req...\n"); + l2cap_echo_req(con, opt_data, len);=09 + /* wait until we received a response or after timeout */ +=09=09 + printk("Waiting for response or timeout\n"); + + l2ca_wait("l2ca_ping wait echo resp", con); + + printk("Woke up after sending echo req\n"); } =20 + if (con->c_status =3D=3D CSTATUS_MAX_NO_RTX) + { + /* max number reached, try to disconnect */ + l2ca_disconnect_req(con); + } + + return con->c_result; +} =20 s32 l2ca_getinfo(BD_ADDR bd, u16 infotype) { @@ -2673,7 +2850,7 @@ =20=09 con =3D get_con(rev_bd, ANY_STATE); =20 - if (!con) { + if (con =3D=3D NULL) { D_STATE("l2ca_getinfo : create new baseband link\n"); con =3D create_con(0/* not yet set */,=20 get_cid(), 0/* not yet set */); @@ -2684,165 +2861,97 @@ =20 memcpy(con->remote_bd, rev_bd, 6); con->link_up =3D 0; - con->inforeq_sent =3D 1; + con->initiator =3D 1; insert_con(con); -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS=09=09 - do_cmd_backup(con, SIG_INFOREQ, 0, NULL, 0, 0, infotype); -#endif - /* l2cap_echo_req is called in lp_connect_cfm */ - return lp_connect_req(con->remote_bd); - } else { - /* use existing handle */ - D_STATE("l2ca_getinfo : using existing handle\n"); - con->inforeq_sent =3D 1; -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS=09=09 - do_cmd_backup(con, SIG_INFOREQ, 0, NULL, 0, 0, infotype); -#endif - l2cap_info_req(con, infotype); - return 0 ; - } -} =20 -/*******************************************************************/ -/* (A5) setting timers */ -/***********************/ + /* c_flags used to not try to connect l2cap when=20 + lp_connect_cfm arrives */ + con->c_flags |=3D FLAG_RETURNNOW; =20 -/* used to resend lost l2cap commands */ + lp_connect_req(con->remote_bd); =20 -/* FIXME -- group different l2cap command options=20 - conreq/confreq/inforeq */ + /* wait here until we received a lp_connect_cfm */ + l2ca_wait("l2ca_getinfo : wait baseband", con); =20 -void do_cmd_backup(l2cap_con *con, u8 type, u16 in_mtu,=20 - flow *outflow, u16 flush_timeout, u16 link_to, - u16 inforeq_type) -{ - D_TIM("do_cmd_backup !\n"); - con->last_cmd.type =3D type; /* type of request */=20 - con->last_cmd.nbr_resends =3D 0; - con->last_cmd.in_mtu =3D in_mtu; - con->last_cmd.flush_timeout =3D flush_timeout; - con->last_cmd.link_to =3D link_to; - con->last_cmd.outflow =3D outflow; - con->last_cmd.inforeq_type =3D inforeq_type; + if (con->c_status =3D=3D RES_SUCCESS) { + /* check status */ + printk("Now we got baseband, send info req !\n"); } + else { + printk("GetInfo failed ! [cstatus %d]\n",=20 + con->c_status); + delete_con(con); + return -1; + } + } =20 =20 -#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS -#ifdef __KERNEL__ -void -l2cap_rtx_timeout(unsigned long ptr) -{ - l2cap_con *con =3D (l2cap_con*)ptr; -#else /* usermode timer */ -void -l2cap_rtx_timeout(void) -{ - l2cap_con *con =3D timeout_con; + /* Now send info req */=09 =20 - // return; + con->c_status =3D CSTATUS_RTX_TIMEOUT; =20 - if (timer_cancelled) { - D_TIM("RTX timer already cancelled\n"); - return; - } -#endif + /* leave loop when either status failed or success */ + while (con->c_status =3D=3D CSTATUS_RTX_TIMEOUT) + { + printk("Sending info req...\n"); + l2cap_info_req(con, infotype);=09 + /* wait until we received a response or after timeout */ =20 - /* do some paranoia checks */ + printk("Waiting for response or timeout\n"); =20 - if (PARANOIA_CHECKCON(con)) { - D_ERR("%s l.%d NULL/magic failed\n", __FILE__, __LINE__); - return; + l2ca_wait("l2ca_ping wait echo resp", con); + + printk("Woke up after sending info req\n"); } =20 - con->last_cmd.nbr_resends++; + return con->c_result; +} =20 - D_TIM("l2cap_rtx_timeout (no rtx : %d)\n", con->last_cmd.nbr_resends); +/*******************************************************************/ +/* (A5) setting timers */ +/***********************/ =20 - printk("type %d, in_mtu %d, flush_timeout %d , link_to %d\n",=20 - con->last_cmd.type, con->last_cmd.in_mtu,=20 - con->last_cmd.flush_timeout, - con->last_cmd.link_to); - print_flow(con->last_cmd.outflow); +/* used to resend lost l2cap commands */ =20 - /* FIXME -- send l2ca_timeoutind() */ +#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS =20 - if (MAX_NO_RTX =3D=3D 0) { - /* no retransmissions, shutdown connection */ - printk("NO retransmissions, lets shutdown connection...\n"); - l2ca_disconnect_req(con); - return; - } else if (con->last_cmd.nbr_resends =3D=3D MAX_NO_RTX) { - /* notify upper layers that link is going down */ +#ifdef __KERNEL__ =20 - /* FIXME l2ca_disconnect_ind */ - D_TIM("Connection unresponsive, free CID\n"); +/* Action is used when the sending function doesn't want + to handle the action it self */ +void +start_rtx(l2cap_con *con, unsigned short timeout, u16 action) +{ + /* multiply by 2 each rtx */ + timeout *=3D (2<<(con->timer.rtx_no)); =20 - show_con("Connection unresponsive, free CID\n", con); + /* FIXME -- use flush timeout to calculate number of + retransmissions */ =20 - /* the link is unresponsive, remove connection */ - ENTERSTATE(con, CLOSED); + D_TIM("Starting RTX timer (%d sec)\n", timeout); =20 - /* remove connection */ - delete_con(con); + /* fixme -- add timer list for multiple calls */ + if (con->timer.rtx_inuse) + { + D_ERR("start_rtx : timer already used\n"); return; } =20 - /* now resend command */ - switch(con->last_cmd.type) { - case SIG_CONREQ: - D_TIM("resending connection request\n"); - l2cap_connect_req(con, con->psm); - break; - - case SIG_CONFREQ: - D_TIM("resending configure request\n"); - l2cap_config_req(con,=20 - con->last_cmd.in_mtu,=20 - con->last_cmd.outflow, - con->last_cmd.flush_timeout,=20 - con->last_cmd.link_to);=09=20=20 - break; - - case SIG_DISCREQ: - D_TIM("resending disconnection request\n"); - l2cap_disconnect_req(con); - break; - - case SIG_ECHOREQ: - D_TIM("resending echo request NOT\n"); - /* FIXME */ - //l2cap_disconnect_req(con); - break; - - case SIG_INFOREQ: - /* FIXME */ - D_TIM("resending echo request NOT\n"); - break; - - default: - D_WARN("l2cap_rtx_timeout : unknown !\n"); - break; - }=20 -#ifndef __KERNEL__ - timeout_con =3D NULL; -#endif + init_timer(&con->timer.rtx); + con->timer.rtx.function =3D l2cap_rtx_timeout; + con->timer.rtx.data =3D (unsigned long)con; + con->timer.rtx.expires =3D jiffies + timeout*HZ; + con->timer.rtx_inuse =3D 1; + con->timer.rtx_action =3D action; + add_timer(&con->timer.rtx);=20=20 } =20 -#ifdef __KERNEL__ -void -start_rtx(l2cap_con *con, unsigned short timeout) -{ - D_TIM("Starting RTX timer (%d sec)\n", timeout); =20 - init_timer(&con->rtx_timer); - con->rtx_timer.function =3D l2cap_rtx_timeout; - con->rtx_timer.data =3D (unsigned long)con; - con->rtx_timer.expires =3D jiffies + timeout*HZ; - add_timer(&con->rtx_timer);=20=20 -} -#else +#else /* USERSTACK */ =20 +/* FIXME -- Currently usermode stack and signal() doesn't work=20 + since we are using threads */ void=20 start_rtx(l2cap_con *con, s32 timeout) { @@ -2855,7 +2964,7 @@ D_TIM("Starting RTX timer (%d sec)\n", timeout); =20 if (timeout_con) - D_TIM("Timer already in use !!!\n"); + D_ERR("Timer already in use !!!\n"); =20 timeout_con =3D con; =20 @@ -2869,49 +2978,60 @@ } #endif /* __KERNEL__ */ =20 + void disable_rtx(l2cap_con *con) { D_TIM("Disabling RTX timer\n"); #ifdef __KERNEL__ - del_timer(&con->rtx_timer); + if (con->timer.rtx_inuse) { + del_timer(&con->timer.rtx); + con->timer.rtx_inuse =3D 0; + } + else + D_TIM("RTX never started\n"); #else timer_cancelled =3D 1; timeout_con =3D NULL; #endif } =20 + void -l2cap_ertx_timeout(unsigned long ptr) +start_ertx(l2cap_con *con, unsigned short timeout) { - l2cap_con *con; - D_TIM("l2cap_ertx_timeout\n"); - con =3D (l2cap_con*)ptr; + D_TIM("Starting ERTX timer (%d sec)\n", timeout); =20 - /* do paranoia check */ - if (PARANOIA_CHECKCON(con)) { - D_ERR("%s l.%d NULL/magic failed\n", __FILE__, __LINE__); + if (con->timer.ertx_inuse) + { + D_TIM("start_ertx : timer already used\n"); return; } - - /* send a new request or terminate ? */ - - /* if sending new request start RTX again */ - - /* terminate for now */ -} =20 -void -start_ertx(l2cap_con *con, unsigned short timeout) -{ - D_TIM("Starting ERTX timer (%d sec)\n", timeout); + init_timer(&con->timer.ertx); + con->timer.ertx.function =3D l2cap_ertx_timeout; + con->timer.ertx.data =3D (unsigned long)con; + con->timer.ertx.expires =3D jiffies + timeout*HZ; + con->timer.ertx_inuse =3D 1; + add_timer(&con->timer.ertx); } =20 void disable_ertx(l2cap_con *con) { D_TIM("Disabling ERTX timer\n"); +#ifdef __KERNEL__ + if (con->timer.rtx_inuse){ + del_timer(&con->timer.ertx); + con->timer.rtx_inuse =3D 0; } + else + D_TIM("ERTX never started\n"); +#else + /* FIXME */ + printk("disable_ertx FIXME\n"); +#endif +} #endif /* CONFIG_BLUETOOTH_L2CAP_USE_TIMERS */ =20 /***************************************************************/ @@ -2944,7 +3064,7 @@ D_RCV("parse_options : Storing remote options on rCID %d\n",=20 con->remote_cid); =20 - print_data("parse_options : ", data, len); + PRINTPKT("parse_options : ", data, len); =20 while (pos < len) { opt =3D (l2cap_option*)(data + pos); @@ -2979,8 +3099,6 @@ D_RCV("parse_options : flush timeout %d ms\n",=20 con->flush_timeout); =20 - DSYS("parse_options : flush timeout %d ms\n",=20 - con->flush_timeout); found_option =3D 1; break; =20=20=20=20=20=20=20 @@ -2991,7 +3109,6 @@ /* FIXME -- return error code if not accepted */ =20 D_RCV("parse_options : qos\n"); - DSYS("parse_options : qos\n"); print_flow(&con->remote_qos); found_option =3D 1; break; @@ -3070,10 +3187,8 @@ void=20 print_flow(flow *f) { - printk("-------------------------------------------------------\n"); - if (f =3D=3D NULL) { - printk("NULL !\n"); + printk(" flow: NULL\n"); return; } else { printk("flow:\n"); @@ -3083,8 +3198,6 @@ (int)f->bucket_size, (int)f->peak, (int)f->latency,=20 (int)f->delay); } -=09 - printk("-------------------------------------------------------\n"); } =20 /* Returns a free cid in range 0x0040 - 0xffff */ |
From: Mattias A. <mat...@us...> - 2001-03-30 11:32:27
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- Config.in 1.9 1.10=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added CONFIG_BLUETOOTH_FORCE_MSSWITCH which forces m/s switch as server The diff of the modified file(s): --- Config.in 2001/03/30 06:17:19 1.9 +++ Config.in 2001/03/30 11:31:55 1.10 @@ -15,6 +15,7 @@ bool ' Allow connectionless L2CAP' CONFIG_BLUETOOTH_L2CAP_CONNECTIONLESS bool ' Enable TCI' CONFIG_BLUETOOTH_USE_TCI bool ' Enable M/S Switch' CONFIG_BLUETOOTH_ENABLE_MSSWITCH + bool ' Force M/S Switch as server' CONFIG_BLUETOOTH_FORCE_MSSWITCH =20 choice ' Bluetooth hardware type' \ "None CONFIG_BLUETOOTH_NOINIT \ |
From: Mattias A. <mat...@us...> - 2001-03-30 11:30:46
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.134 1.135=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added functionality to handle master slave switch * moved ACL link code into section only for ACL data (SCO links were handled in an erronoeous way) * removed role_discovery call in lp_connect_cfm, role is shown when=20 an m/s switch is performed anyway * added hci_force_msswitch which forces m/s switch as server * lots of minor changes The diff of the modified file(s): --- hci.c 2001/03/26 14:58:26 1.134 +++ hci.c 2001/03/30 11:30:44 1.135 @@ -53,11 +53,14 @@ #include <linux/bluetooth/btdebug.h> #include <linux/bluetooth/bluetooth.h> #include <linux/bluetooth/l2cap.h> +#include <linux/bluetooth/l2cap_con.h> #include <linux/bluetooth/tcs.h> #include <linux/bluetooth/btmem.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/bluetooth/sec_client.h> +#include <asm/io.h> + #else /* user mode */ #include <stdlib.h> #include <string.h> @@ -67,6 +70,7 @@ #include "include/hci_internal.h" #include "include/btdebug.h" #include "include/l2cap.h" +#include "include/l2cap_con.h" #include "include/btmem.h" #include "include/tcs.h" #include "include/sec_client.h" @@ -121,7 +125,6 @@ =20 #define HCI_SYNC_FIX =20 - #ifdef HCI_EMULATION #define ACL_NUM 10 #define ACL_LEN 800=20 @@ -214,7 +217,6 @@ =20 /* Informational Parameters (HCI_IP) */ =20 - /* Other functions */ static s32 hci_read_buffer_size(s32 block);=20 static void set_hci_con(u8 *bd, s32 con_hdl); @@ -252,7 +254,6 @@ #endif =20 static void send_acl_data_task(void); - /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 /* Struct used for sending command packets */ @@ -269,7 +270,9 @@ #ifdef USE_NCPTIMER static struct timer_list hci_ncp_timer; #endif + static struct timer_list hci_cmd_timer; + #ifdef USE_INQTIMER static struct timer_list hci_inq_timer; #endif @@ -322,6 +325,10 @@ =20 static s32 test_hci_hdl; =20 +/* temp solution to handle m/s switch */ +static s32 force_msswitch; +static s32 i_am_initiator =3D 0; + /****************** FUNCTION DEFINITION SECTION **************************= ***/ =20 /* @@ -460,11 +467,8 @@ } } =20 - host_nbrcompleted_packets(hci_hdl, 1); =20 - - /* When we change state we reset data_index, because we are using separate buffers for the HCI header and the HCI data */ @@ -572,6 +576,7 @@ /* We've just been notified that the hardware has free buffers. If we have any outstanding packets, send_acl_data_task will try to send as many packets as possible. */ + #ifdef __KERNEL__ if (buf_count()) {=09=20=20=20=20=20 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) @@ -660,24 +665,32 @@ =20 if (link_type =3D=3D ACL_LINK) { lp_connect_cfm(buf + 3, (u32) buf[0], hci_hdl); - } else { - tcs_add_sco_link(buf[0], hci_hdl); - } =20 #ifndef HCI_EMULATION if (buf[0]) { /* remove hci handle if connection failed */ - DSYS(__FUNCTION__", CONNECTION_COMPLETE %s\n", get_err_msg(buf[0])); + DSYS(__FUNCTION__", CONNECTION_COMPLETE %s\n",=20 + get_err_msg(buf[0])); hci_ctrl.nbr_of_connections -=3D 1; reset_hci_con_bd(hci_hdl); } else { DSYS(__FUNCTION__", ACL link is up\n"); - change_connection_packet_type(hci_hdl, DM3|DH3|DM5|DH5); + change_connection_packet_type(hci_hdl,=20 + DM1|DH1|DM3|DH3|DM5|DH5); set_hci_con(buf + 3, hci_hdl); remote_name_request(buf + 3); -// write_link_policy_settings(hci_hdl, 0x01); /* enable m/s switch */ -// hci_switch_role(buf + 3, 0); - role_discovery(hci_hdl); + + /* enable m/s switch */=20 + write_link_policy_settings(hci_hdl, 0x01); + + /* we demand role switch as server */ + if (force_msswitch && !i_am_initiator) { + /* FIXME -- check return code */ + hci_switch_role(buf + 3, 0); + } + /* reset variable again */ + i_am_initiator =3D 0; +=09=09=09=09=09=09 } #endif /* HCI_EMULATION */ =20 @@ -685,6 +698,9 @@ test_wq_active =3D 0; wake_up_interruptible(&test_wq); } + } else { + tcs_add_sco_link(buf[0], hci_hdl); + } =20=09=09 break; } @@ -701,7 +717,6 @@ =20 case DISCONNECTION_COMPLETE: DSYS(__FUNCTION__", DISCONNECTION_COMPLETE %s\n", get_err_msg(buf[3])); - lp_disconnect_ind(CHAR2INT12(buf[2], buf[1])); /* FIXME: No more NBR_OF_COMPLETE_PACKETS will arrive for this connection handle, if we only support point-to-point @@ -817,15 +832,17 @@ break; =20 case ROLE_CHANGED: - D_CMD(__FUNCTION__", ROLE_CHANGED\n"); + DSYS(__FUNCTION__", ROLE_CHANGED\n"); =20 if (buf[0]) {=20 - D_ERR(__FUNCTION__", Role changed faild due to %s\n", + D_ERR(__FUNCTION__", Role changed failed due to %s\n", get_err_msg(buf[0])); } else if (buf[7]) { - DSYS(__FUNCTION__", Role was changed to Slave for unit with BD Address = 0x%04x%08x\n", CHAR2INT16(buf[6], buf[5]), CHAR2INT32(buf[4], buf[3], buf[2= ], buf[1])); + DSYS(__FUNCTION__", Current master is 0x%04x%08x\n",=20 + CHAR2INT16(buf[6], buf[5]),=20 + CHAR2INT32(buf[4], buf[3], buf[2], buf[1])); } else { - DSYS(__FUNCTION__", Role was changed to Master for unit with BD Address= 0x%04x%08x\n", CHAR2INT16(buf[6], buf[5]), CHAR2INT32(buf[4], buf[3], buf[= 2], buf[1])); + DSYS(__FUNCTION__", Our role is master for BD Address 0x%04x%08x\n", CH= AR2INT16(buf[6], buf[5]), CHAR2INT32(buf[4], buf[3], buf[2], buf[1])); } break; =20 @@ -1027,8 +1044,9 @@ break; =20=20=20=20=20=20=20=20=20=20=20 case HCI_HC: /* Host Controller commands */ +=09=09 release_cmd_timer(); -/* FIX ME : The correct timer should be released */ + /* FIXME -- correct timer should be released */ =20=20=20=20=20=20=20=20=20=20=20 switch (ocf) { =20=09=09=09 @@ -1045,7 +1063,7 @@ =20=09=09=09 =20=09=09=09 case READ_STORED_LINK_KEY: - D_CMD(__FUNCTION__", READ_STORED_LINK_KEY\n"); + DSYS(__FUNCTION__", READ_STORED_LINK_KEY\n"); if (r_val[0]) { D_ERR(__FUNCTION__", READ_STORED_LINK_KEY %s\n", get_err_msg(r_val[0])= ); result_param =3D - r_val[0]; @@ -1054,9 +1072,9 @@ result_param =3D CHAR2INT32(r_val[4], r_val[3], r_val[2], r_val[= 1]); } - D_CMD(__FUNCTION__", Max number of Linkkeys: %d\n", + DSYS(__FUNCTION__", Max number of Linkkeys: %d\n", CHAR2INT16(r_val[2], r_val[1])); - D_CMD(__FUNCTION__", Number of Linkkeys read: %d\n", + DSYS(__FUNCTION__", Number of Linkkeys read: %d\n", CHAR2INT16(r_val[4], r_val[3])); break; =20 @@ -1267,6 +1285,26 @@ release_cmd_timer(); =20 switch (ocf) { + + case READ_LOCAL_VERSION_INFORMATION: + D_CMD(__FUNCTION__", READ_LOCAL_VERSION_INFORMATION\n"); + if (r_val[0]) { + D_ERR(__FUNCTION__", READ_LOCAL_VERSION_INFORMATION: %s\n", + get_err_msg(r_val[0])); + break; + } +=09=09=09 + hci_ctrl.hc_buf.acl_len =3D CHAR2INT16(r_val[2],r_val[1]); + hci_ctrl.hc_buf.sco_len =3D (u32) r_val[3]; + hci_ctrl.hc_buf.acl_num =3D CHAR2INT16(r_val[5],r_val[4]); + hci_ctrl.hc_buf.sco_num =3D CHAR2INT16(r_val[7],r_val[6]); + printk("\nHW module contains...\n"); + printk("%d ACL buffers at %d bytes\n%d SCO buffers at %d bytes\n\n", + hci_ctrl.hc_buf.acl_num, hci_ctrl.hc_buf.acl_len, + hci_ctrl.hc_buf.sco_num, hci_ctrl.hc_buf.sco_len); + + break; + case READ_BUFFER_SIZE: D_CMD(__FUNCTION__", READ_BUFFER_SIZE\n"); if (r_val[0]) { @@ -1313,15 +1351,15 @@ =20 switch (ocf) {=20=20 case READ_LOOPBACK_MODE: - D_CMD(__FUNCTION__", READ_LOOPBACK_MODE -- not impl\n"); + D_ERR(__FUNCTION__", READ_LOOPBACK_MODE -- not impl\n"); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 case WRITE_LOOPBACK_MODE: - D_CMD(__FUNCTION__", WRITE_LOOPBACK_MODE -- not impl\n"); + D_ERR(__FUNCTION__", WRITE_LOOPBACK_MODE -- not impl\n"); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 case ENABLE_DEVICE_UNDER_TEST_MODE: - D_CMD(__FUNCTION__", ENABLE_DEVICE_UNDER_TEST_MODE\n"); + DSYS(__FUNCTION__", ENABLE_DEVICE_UNDER_TEST_MODE\n"); if (r_val[0]) { D_ERR(__FUNCTION__", ENABLE_DEVICE_UNDER_TEST_MODE: %s\n", get_err_msg(r_val[0])); @@ -1331,7 +1369,7 @@ break; =20=20=20=20=20=20=20=20=20=20=20=20=20 default: - D_CMD(__FUNCTION__", HCI_TC, ocf %d not recognised!\n", ocf); + D_ERR(__FUNCTION__", HCI_TC, ocf %d not recognised!\n", ocf); break; } wake_up_interruptible(&hci_wq); @@ -1633,28 +1671,32 @@ send_data_task.data =3D NULL; #endif =20 + /* Disable parity bit and set to H4 IF + flow ctrl */ + /* Not activated until after reset !!!! */ + /* always... */ DSYS(__FUNCTION__", Reading buffer sizes in the module...\n"); hci_read_buffer_size(HCI_BLOCK); =20 hci_read_firmware_rev_info(); =20 -// hci_read_stored_link_key(NULL,1); - - //hci_write_authentication_enable(1); #ifdef HOST_FLOW_CTRL DSYS(__FUNCTION__", Host flow control enabled\n"); + hci_set_host_controller_flow_control(TRUE); #else DSYS(__FUNCTION__", Host flow control not enabled\n"); #endif -=09 - hci_set_host_controller_flow_control(TRUE); - hci_host_buffer_size(HCI_ACL_LEN,HCI_SCO_LEN,HCI_ACL_NUM,HCI_SCO_NUM); =20 #ifdef USE_NCPTIMER start_ncp_timer();=09 #endif + +#ifdef CONFIG_BLUETOOTH_FORCE_MSSWITCH + hci_force_msswitch(1); +#else + hci_force_msswitch(0); +#endif=20=20=20=20=20=20=20 } =20 void=20 @@ -1712,9 +1754,11 @@ c_pkt.data[4] =3D num_resp; c_pkt.len =3D 5; =20 - print_data("hci_inquiry", (u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR= _LEN); + print_data("hci_inquiry", (u8*) &c_pkt , + c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); =20 - tmp =3D send_inq_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HD= R_LEN); + tmp =3D send_inq_cmd_block((u8*) &c_pkt,=20 + c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); =20 if (tmp < 0) { kfree(inq_res); @@ -2048,6 +2092,9 @@ return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= ); } =20 + +/* fixme -- fix return code so we know whether role change was succesful= =20 + or not */ s32 hci_switch_role(u8 *bd, u8 role) { @@ -2552,10 +2599,8 @@ c_pkt.len =3D 5; =20 =20=09 - /*FIXME Risk for race against sending acl packets ? */ - //printk("Host pkt start\n"); + /*FIXME -- Risk for race against sending acl packets ? */ tmp =3D bt_write_lower_driver((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI= _HDR_LEN); - //printk("Host pkt stop\n"); return tmp; #else return 0; @@ -2615,6 +2660,24 @@ return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); } =20 +#if 0 +s32 +hci_read_local_version_info(s32 block) +{ + D_CMD(__FUNCTION__"\n"); +=09 + c_pkt.type =3D CMD_PKT; + c_pkt.ocf =3D READ_LOCAL_VERSION_INFORMATION; + c_pkt.ogf =3D HCI_IP; + c_pkt.len =3D 0; + + if (block) + return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); + else + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} +#endif + /* * This command will read the value for the BD_ADDR parameter of the local * unit, returns bd in little endian @@ -2734,7 +2797,7 @@ } =20 =20 -/* This function is used to send custom commands over the HCI interface. */ +/* This function is used to send custom commands/data over the HCI interfa= ce. */ =20 s32 hci_send_raw_data(u8 *data, u8 len) @@ -2744,20 +2807,31 @@ return bt_write_lower_driver(data ,len); } =20 - s32 hci_test_connect_req(u8 *bd) { /* Must add a l2cap con to store bd address in !!! */ =20 +#ifdef CONFIG_BLUETOOTH_ENABLE_MSSWITCH if (create_connection(bd, 0xcc18, 0x00, 0x00, 0x00, DONT_ALLOW_ROLE_SWITC= H)) { D_ERR("hci_test_connect_req, error sending command\n"); } +#else + if (create_connection(bd, 0xcc18, 0x00, 0x00, 0x00, ALLOW_ROLE_SWITCH)) { + D_ERR("hci_test_connect_req, error sending command\n"); + } +#endif test_wq_active =3D 1; interruptible_sleep_on(&test_wq); return test_hci_hdl; } =20 +void +hci_force_msswitch(u8 enable) +{ + printk("Setting force_msswitch to %d\n", enable); + force_msswitch =3D enable;=20 +} =20 /* Sends a connect request to the BT unit with the address bd_addr */ s32=20 @@ -2766,11 +2840,18 @@ PRINTPKT(__FUNCTION__", bd address is: ", bd_addr, 6); /* FIXME, store the inparameters in the ctrl-block instead */ =20 -// if (!get_con(bd_addr, ANY_STATE)) -// l2cap_create_con(bd_addr); + if (!get_con(bd_addr, ANY_STATE)) + l2cap_create_con(bd_addr); =20=20=20 -// return create_connection(bd_addr, 0xcc18, 0x00, 0x00, 0x00, ALLOW_ROLE_= SWITCH); - return create_connection(bd_addr, 0xcc18, 0x00, 0x00, 0x00, DONT_ALLOW_RO= LE_SWITCH); + i_am_initiator =3D 1; + +#ifdef CONFIG_BLUETOOTH_ENABLE_MSSWITCH + return create_connection(bd_addr, 0xcc18, 0x00, 0x00,=20 + 0x00, ALLOW_ROLE_SWITCH); +#else + return create_connection(bd_addr, 0xcc18, 0x00, 0x00,=20 + 0x00, DONT_ALLOW_ROLE_SWITCH); +#endif } =20 /* A response from L2CAP to a previous lp_connect_ind */ @@ -2779,7 +2860,6 @@ {=20 D_CMD(__FUNCTION__"Status:%d\n", cfm); if (cfm) { -// return accept_connection_request(bd_addr, MS_SWITCH_BECOME_MASTER); return accept_connection_request(bd_addr, MS_SWITCH_REMAIN_SLAVE); } else { return reject_connection_request(bd_addr, 0x0d); @@ -2793,8 +2873,7 @@ s32=20 lp_disconnect(u32 hci_hdl) { - return disconnect(hci_hdl, 0x14); - /* FIXME: 0x14 =3D Low Resources store this somewhere else */ + return disconnect(hci_hdl, DISCMSG_USER_ENDED_CONNECTION); } =20 =20 @@ -2810,7 +2889,6 @@ sends the data. */ tx_buf->pb_flag =3D L2CAP_FRAME_START; =20=09=09 - #ifdef __KERNEL__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) queue_task(&send_data_task, &tq_scheduler); @@ -2838,6 +2916,7 @@ tx_buf =3D get_bt_buf(); if (tx_buf) { bytes2send =3D tx_buf->cur_len; + D_SND(__FUNCTION__", %d bytes \n", tx_buf->cur_len); } =20=09 D_SND(__FUNCTION__", %d bytes \n", bytes2send); @@ -2851,7 +2930,6 @@ =20=09 cli(); while ((hci_ctrl.hc_buf.acl_num > 0) && bytes2send) { - hci_ctrl.hc_buf.acl_num--; sti(); =20=09=09 @@ -2860,7 +2938,6 @@ D_QUEUE("<--%d (%d)\n", buf_byte_count(),=20 hci_ctrl.hc_buf.acl_num); =20 - if (bytes2send =3D=3D 0) { /* The current frame has now been sent, check if more data is waiting to be sent from the driver. */ @@ -2869,14 +2946,12 @@ if (tx_buf) { bytes2send =3D tx_buf->cur_len; } -=09=09=09=09 } cli(); } sti(); } =20 - u32 send_acl_packet(bt_tx_buf *tx_buf) { @@ -2919,7 +2994,7 @@ /* bt_write_lower_driver checks in serial driver if there are room=20 in serial tx buffer, if 0 is returned there was insufficient=20 room */ - //printk("ACL start\n"); + if (!bt_write_lower_driver(cur_data,=20 c + ACL_HDR_LEN + HCI_HDR_LEN)) { =20=09=09 @@ -2930,7 +3005,6 @@ D_SND(__FUNCTION__", cannot send now, leave in buffers\n"); return 0; } - //printk("ACL stop\n"); #endif /* We always set the next part to be a continous part of the packet */ tx_buf->pb_flag =3D L2CAP_FRAME_CONT; @@ -3009,7 +3083,6 @@ case 0x22: return "LMP Response Timeout"; case 0x23: return "LMP Error Transaction Collision"; case 0x24: return "LMP PDU Not Allowed"; - case 0x25: return "Encryption Mode Not Acceptable"; case 0x26: return "Unit Key Used"; case 0x27: return "QOS is Not Supported"; @@ -3208,6 +3281,7 @@ =20=20=20 while ((tmp =3D get_next_cmd()) !=3D NULL) { kfree(tmp->data); + tmp->data =3D NULL; } =20=20=20 cmd_buf.first_free =3D 0; @@ -3354,8 +3428,9 @@ #else bt_write_lower_driver(tmp->data, tmp->len); #endif - D_QUEUE(__FUNCTION__", sent data..., freeing memory\n"); kfree(tmp->data); + tmp->data =3D NULL; + cli(); hci_ctrl.hc_buf.cmd_num -=3D 1; } @@ -3402,8 +3477,6 @@ =20 if (!hw.acl_num_count && /* no new buffers since last timeout */=20 hci_ctrl.hc_buf.acl_num !=3D hw.max_acl_num) { -// printk("bt_feedstack from ncp_timeout [acl:%d]\n",=20 -// hci_ctrl.hc_buf.acl_num); bt_feedstack(); } =20 @@ -3411,6 +3484,7 @@ start_ncp_timer(); } #endif + #endif /* USE_NCPTIMER */ =20 void @@ -3426,13 +3500,12 @@ #endif } =20 - void release_cmd_timer(void) { #ifdef __KERNEL__ - D_CTRL(__FUNCTION__"\n"); del_timer(&hci_cmd_timer); + D_CMD(__FUNCTION__"\n"); #endif hci_cmd_pending =3D 0; } @@ -3441,8 +3514,8 @@ static void cmd_timeout(unsigned long ptr) { - /* The command timed out, then we reset the command buffer counter to - 1 again */ + /* The command timed out, then we reset the command buffer=20 + counter to 1 again */ hci_ctrl.hc_buf.cmd_num =3D 1; =20=09 printk(__FUNCTION__", Timeout when waiting for command response\n"); @@ -3480,9 +3553,10 @@ static void inq_timeout(unsigned long ptr) { - /* The command timed out, then we reset the command buffer counter to - 1 again */ + /* The command timed out, then we reset the command buffer=20 + counter to 1 again */ /* FIX ME: What to do here !! */ + /* hci_ctrl.hc_buf.cmd_num =3D 1;*/ =20 printk(__FUNCTION__", Timeout when waiting for inquiry response\n"); @@ -3490,8 +3564,7 @@ wake_up_interruptible(&inq_wq); } #endif -#endif /* USE_INQTIMER */ - +#endif =20 s32=20 send_cmd_block(u8 *cmd, u8 len) |
From: Mattias A. <mat...@us...> - 2001-03-30 11:04:31
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btmem.c 1.39 1.40=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: set buffer head to NULL after deallocating memory added timestamp in 'buffer meter' The diff of the modified file(s): --- btmem.c 2001/03/23 13:21:57 1.39 +++ btmem.c 2001/03/30 11:04:27 1.40 @@ -134,6 +134,7 @@ /* FIXME - Check that the stack is not in use */ /* Deallocate memory area */ kfree(bt_buf.head); + bt_buf.head =3D NULL; } =20 /* Is run whenever buffer is empty */ @@ -516,7 +517,7 @@ i =3D ((count*BUFFERMETERRESOLUTION)/BT_BUF_SIZE); memset(buffermeter, '|', i); buffermeter[i+1] =3D 0; /* null terminate */=20 - printk("%s (%d)\n", buffermeter, count); + printk("%s [%s - %d bytes]\n", buffermeter, print_time(0), count); } =20 void show_bt_buf(bt_tx_buf *tx, s32 no_data) |
From: Mattias A. <mat...@us...> - 2001-03-30 11:00:49
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.157 1.158=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * renamed m/s switch control function The diff of the modified file(s): --- bluetooth.c 2001/03/30 10:09:38 1.157 +++ bluetooth.c 2001/03/30 11:00:41 1.158 @@ -1037,16 +1037,17 @@ return l2ca_getinfo(bd, type); } =20 + /* force m/s switch as server */ case BTSETMSSWITCH : { - u8 mode; + u8 enable; =20 GET_USER(tmp, (s32*)arg); =20 - mode =3D (u8)(tmp & 0xff); + enable =3D (u8)(tmp & 0xff); =20 - BT_DRIVER("BTSETMSSWITCH : %d\n", mode); - hci_set_msswitch_mode(mode); + BT_DRIVER("BTSETMSSWITCH : %d\n", enable); + hci_force_msswitch(enable); } =20=09=09 default:=09=09 |
From: Mattias A. <mat...@us...> - 2001-03-30 10:58:53
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btdebug.h 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * renamed define BT_DATADEBUG to BT_DATADUMP_DEBUG * fixed declaration of print_data when running usermode stack The diff of the modified file(s): --- btdebug.h 2001/03/04 15:59:23 1.37 +++ btdebug.h 2001/03/30 10:58:51 1.38 @@ -73,7 +73,7 @@ /***************** Bluetooth Debug defines *******************************= ****/ =20 #define BT_DATA_DEBUG 0 -#define BT_DATAFLOW_DEBUG 0 /* print pkt */ +#define BT_DATADUMP_DEBUG 0 /* print each byte */ =20 #define BT_DRIVER_DEBUG 1 =20 @@ -184,11 +184,11 @@ =20 #ifdef __KERNEL__ u8* print_time(s32 use_stdout); +void print_data(const u8 *message, u8 *buf, s32 len); #else char* print_time(int use_stdout); +void print_data(const unsigned char *message, unsigned char *buf, int len); #endif - -void print_data(const u8 *message, u8 *buf, s32 len); =20 #endif /****************** END OF FILE btdebug.h ********************************= ****/ |
From: Mattias A. <mat...@us...> - 2001-03-30 10:53:33
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci_internal.h 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added some defines The diff of the modified file(s): --- hci_internal.h 2001/03/04 17:54:55 1.12 +++ hci_internal.h 2001/03/30 10:53:31 1.13 @@ -111,6 +111,7 @@ =20 /* How many inbuffers we have got, the size of them, and how many command buffers we have got */ + #define NBR_OF_HCI_INBUFFERS 7 =20 #define NBR_CMD_BUFS 10 @@ -241,7 +242,7 @@ #define WRITE_LOOPBACK_MODE 0x02 #define ENABLE_DEVICE_UNDER_TEST_MODE 0x03 =20 -/* Defines of the different events that is sent from the Host Controler +/* Defines of the different events that is sent from the Host Controller to the Host */ #define INQUIRY_COMPLETE 0x01 #define INQUIRY_RESULT 0x02 @@ -288,6 +289,10 @@ #define SCO_HDR_LEN 3 #define CMD_HDR_LEN 3 #define EVENT_HDR_LEN 2 + +#define DISCMSG_USER_ENDED_CONNECTION 0x13 +#define DISCMSG_LOW_RESOURCES 0x14 +#define DISCMSG_ABOUT_TO_POWER_OFF 0x15 =20 /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 |
From: Mattias A. <mat...@us...> - 2001-03-30 10:51:54
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.h 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added release_wq_timer The diff of the modified file(s): --- bluetooth.h 2001/03/07 18:13:48 1.37 +++ bluetooth.h 2001/03/30 10:51:53 1.38 @@ -99,7 +99,9 @@ #else void start_wq_timer(struct timer_list *wq_timer, u32 timeout, struct wait_queue **wq); + #endif /* LINUX_VERSION_CODE */ +void release_wq_timer(struct timer_list *wq_timer); #endif /* __KERNEL__ */ =20 #endif |
From: Mattias A. <mat...@us...> - 2001-03-30 10:48:11
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.h 1.48 1.49=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: renamed ms switch control function The diff of the modified file(s): --- hci.h 2001/03/30 09:42:41 1.48 +++ hci.h 2001/03/30 10:48:07 1.49 @@ -140,8 +140,6 @@ s32 hci_read_local_bd(u8 *bd); s32 hci_read_local_version_info(s32 block); =20 - - /* Internal */ /* FIXME -- add parameter to choose from different devices */ s32 get_remote_bd(u8 *bd); @@ -151,7 +149,7 @@ s32 hci_test_connect_req(u8 *bd); s32 hci_send_raw_data(u8 *data, u8 len); =20 -void hci_set_msswitch_mode(u8 mode); +void hci_force_msswitch(u8 enable); =20 /* Vendor specific */ s32 hci_set_bd_addr(u8 bd[6]); |
From: Mattias A. <mat...@us...> - 2001-03-30 10:28:22
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btdebug.c 1.17 1.18=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added time diff since last debug printout The diff of the modified file(s): --- btdebug.c 2001/03/02 21:52:15 1.17 +++ btdebug.c 2001/03/30 10:28:20 1.18 @@ -66,24 +66,45 @@ #ifdef __KERNEL__ =20 static u8 buf[20]; +static struct timeval tv_old =3D {0,0}; =20=20 u8* print_time(s32 use_stdout) { - s32 len; + s32 len, diff; struct timeval tv;=20=20 do_gettimeofday(&tv); +=09 + diff =3D ((tv.tv_sec - tv_old.tv_sec)*1000000 + tv.tv_usec) -=20 + tv_old.tv_usec; +=09 if (use_stdout=3D=3D1) { - printk(buf, "[%d,%d] ", tv.tv_sec, tv.tv_usec); - return NULL; + printk("[%03d,%08d|%06d] ",=20 + (int)tv.tv_sec, (int)tv.tv_usec, diff); } else {=20=20 - len =3D sprintf(buf, "[%d,%d]", (int)tv.tv_sec, (int)tv.tv_usec); + len =3D sprintf(buf, "[%03d,%08d|%06d] ",=20 + (int)tv.tv_sec, tv.tv_usec, diff); buf[len]=3D0; } + tv_old =3D tv; return buf; } =20 +void=20 +print_data(const u8 *message, u8 *buf, s32 len) +{=20 + s32 t; + printk("\n%s (%d)", message, len); + for (t=3D0;t<len;t++)=20 + { + if((t%16)=3D=3D0) + printk("\n "); + printk("0x%02x ", buf[t]); + } + printk("\n"); +} + #else /* No timestamps in usermode yet */ char* print_time(int use_stdout) @@ -92,19 +113,21 @@ return "No timestamps in usermode stack yet\n"; } =20 -#endif void=20 print_data(const u8 *message, u8 *buf, s32 len) {=20 s32 t; - printk("\n%s (%d)", message, len); + printf("\n%s (%d)", message, len); for (t=3D0;t<len;t++)=20 { if((t%16)=3D=3D0) printk("\n "); - printk("0x%02x ", buf[t]); + printf("0x%02x ", buf[t]); } - printk("\n"); + printf("\n"); } + +#endif + =20 /****************** END OF FILE debug.c **********************************= ***/ |
From: Mattias A. <mat...@us...> - 2001-03-30 10:09:40
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.156 1.157=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * changed debug macro name PRINTPKT to BT_DATADUMP * increased connection timeout to 10 secs * modified BT_DATA macro when using timestamps * don't use linebuf by default * added info req functionality * temp disabled forwarding to serial driver in bt_ioctl * fixed block / correct return code when disconnecting an rfcomm con * lots of cleanup / removed unused code The diff of the modified file(s): --- bluetooth.c 2001/03/30 06:17:19 1.156 +++ bluetooth.c 2001/03/30 10:09:38 1.157 @@ -81,6 +81,7 @@ #include <linux/bluetooth/tcs.h> #include <linux/bluetooth/sdp.h> #include <linux/bluetooth/sec_client.h> + #ifdef CONFIG_BLUETOOTH_USE_TCI #include <linux/bluetooth/tci.h> #endif @@ -101,16 +102,15 @@ #define BT_DRIVER(fmt...) #endif /* BT_DRIVER_DEBUG */ =20 -#if BT_DATAFLOW_DEBUG -#define PRINTPKT(str, data, len) print_data(str, data, len) +#if BT_DATADUMP_DEBUG +#define BT_DATADUMP(str, data, len) print_data(str, data, len) #else -#define PRINTPKT(str, data, len) +#define BT_DATADUMP(str, data, len) #endif =20 #if BT_DATA_DEBUG - #if BT_USE_TIMESTAMPS -#define BT_DATA(fmt...) do { print_time(0); printk(BT_DBG_STR"DATA " fmt);= } while (0) +#define BT_DATA(fmt...) do {print_time(1);printk(BT_DBG_STR"DATA " fmt);} = while (0) #else #define BT_DATA(fmt...) printk(BT_DBG_STR"DATA " fmt) #endif @@ -125,8 +125,8 @@ #define BT_LDISC(fmt...) #endif /* BT_LDISC_DEBUG */ =20 -#ifndef PRINTPKT -#define PRINTPKT(str, data, len) +#ifndef BT_DATADUMP +#define BT_DATADUMP(str, data, len) #endif =20 /****************** CONSTANT AND MACRO SECTION ***************************= ***/ @@ -188,7 +188,6 @@ static s32 bt_connect(u8 *bd_addr, u32 con_id); static s32 bt_disconnect(u32 con_id); static const u8* psmname(u16 psm); -static void release_wq_timer(struct timer_list *wq_timer); static void wq_timeout(unsigned long ptr); static s32 bt_execute_sdp_request(bt_sdp_request *sdpRequest); =20 @@ -233,7 +232,7 @@ =20 static void bt_reset_session(s32 line); =20 -#define BT_USELINEBUF +//#define BT_USELINEBUF =20 /* windoz fix... */ #ifdef BT_USELINEBUF @@ -289,7 +288,8 @@ static tty_linebuffer tty_linebuf; =20 static struct timer_list bt_timer; -#define BT_CON_TIMEOUT (7*HZ) + +#define BT_CON_TIMEOUT (10*HZ) =20 /****************** FUNCTION DEFINITION SECTION **************************= ***/ =20 @@ -487,20 +487,10 @@ bt_connection btcon; u8 bd_addr[6]; =20 -#if 0 - /* We don't have to check this here since all commands not intended - for us will be forwarded to the serial driver */ - if (_IOC_TYPE(cmd) !=3D BT_IOC_MAGIC) { - return -EINVAL; - } - if (_IOC_NR(cmd) > BT_IOC_MAXNR) { - return -EINVAL; - } -#endif -=20 /* The direction is a bitmask, and VERIFY_WRITE catches R/W transfer. The ioctl direction is user-oriented, while verify_area is kernel- oriented, so the concept of "read" and "write" is reversed */ + if (_IOC_DIR(cmd) & _IOC_READ) { err =3D verify_area(VERIFY_WRITE, (void*)arg, size); if (err) { @@ -521,29 +511,28 @@ bt_sdp_request sdpRequest; int returnValue =3D -1; =20 - /*-----------------------------------------------------------*/ - /* Copy arguments to kernel space. */ - /*-----------------------------------------------------------*/ + /* Copy arguments to kernel space */ + BT_DRIVER(FNC"Copying arguments from user to kernel space\n"); copy_from_user(&sdpRequest, (s32*)arg, size); =20 - /*-----------------------------------------------------------*/ - /* Now execute the request. */ - /*-----------------------------------------------------------*/ + /* Now execute the request */ + BT_DRIVER(FNC"Executing bt_execute_sdp_request\n"); =20 if ((returnValue =3D bt_execute_sdp_request(&sdpRequest)) >=3D 0) { - /*---------------------------------------------------*/ - /* Copy the data back to user space and return. */ - /*---------------------------------------------------*/ + + /* Copy the data back to user space and return */ + BT_DRIVER(FNC"Copying data back to user space\n"); copy_to_user((s32*)arg, &sdpRequest, size); } =20 return returnValue; - } /* End of BT_SDP_REQUEST */ + } =20 case BTCONNECT: + { /* argument is an object with all info to start a remote=20 connection */ =20 @@ -552,6 +541,7 @@ BT_DRIVER(FNC"BTCONNECT\n"); =20=09=09=09=20=20=20=20=20=20=20 return bt_connect(btcon.bd, btcon.id); + } =20=09=20 case BTDISCONNECT: { @@ -572,18 +562,17 @@ printk("Already got connection on line %d\n", line);=20 return 0; } - printk("Waiting on line %d\n", line); + BT_DRIVER("Waiting on line %d\n", line); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); - printk("Got connection on line %d\n", line); + BT_DRIVER("Got connection on line %d\n", line); break; } =20=09 case BTWAITNEWCONNECTIONS: { /* wait for any new connections coming in */ - printk("Waiting for new connections\n"); + BT_DRIVER("Waiting for new connections\n"); interruptible_sleep_on(&bt_ctrl.any_wq); - printk("Got new connection\n"); break; } =20 @@ -703,11 +692,19 @@ u8 bd[6]; copy_from_user(bd, (s32*)arg, 6); return hci_test_connect_req(bd); -// return bt_connect_req(bd, RFCOMM_LAYER, 0); } =20 - /* ioctls executing HCI commands */ + case BTTESTCOMMAND: + { + extern void test_process_cmd(unsigned char *cmd, s32 size); + u8 cmd[size]; + copy_from_user(cmd, (s32*)arg, size); + printk("TEST_COMMAND ", cmd, size); + test_process_cmd(cmd, size); + } =20=09 + /* Ioctls executing HCI commands */ +=09 /* Link Control Command */ =20 case HCIINQUIRY: @@ -807,7 +804,7 @@ break; } =20 - /* Host Controler & Basband Commands */ + /* Host Controller & Baseband Commands */ =20 case HCIRESET: hci_reset(); @@ -993,32 +990,77 @@ case HCIWRITEBDADDR: copy_from_user(&bd_addr, (s32*)arg, size); BT_DRIVER(FNC"setting BD_ADDR to \n"); - PRINTPKT("bd :",(u8*)bd_addr,6); + print_data("bd :",(u8*)bd_addr,6); hci_set_bd_addr(bd_addr); break;=20=20 =20=20=20=20=20=20 case HCISENDRAWDATA: { u8 len; - u8 data[256]; + u8 data[261]; /* | len (1) | hci header (4) | data (max 256)| */ =20 - /* first 4 bytes contains length of whole hci message */ - copy_from_user(&len, (s32*)arg, 1); - copy_from_user(data, (s32*)arg + 1, len); + /* first byte contains length of whole hci message */ + copy_from_user(&len, (u8*)arg, 1); + BT_DRIVER("Copying %d bytes to raw interface\n", len); + copy_from_user(data, (u8*)arg + 1, len); + BT_DRIVER("Sending %d bytes\n", len); + BT_DATADUMP("RAW : ", data, len); hci_send_raw_data(data, len); break; } =20=09=09 + case BTPING: + { + ping_struct ping; +=09=09 + copy_from_user(&ping, (u8*)arg, 8); + print_data("ping bd : ", ping.bd, 6); + + copy_from_user(&ping+8, (u8*)arg+8, ping.len); + + printk("len : %d\n", ping.len); + + return l2ca_ping(ping.bd, ping.data, ping.len); + } + + case BTGETINFO: + { + u8 bd[6]; + u16 type; + + /* first byte contains length of whole hci message */ + copy_from_user(&bd, (u8*)arg, 6); + copy_from_user(&type, (u8*)arg + 6, 2); + + BT_DRIVER("l2ca_getinfo : type %d\n", type); +=09=09 + return l2ca_getinfo(bd, type); + } + + case BTSETMSSWITCH : + { + u8 mode; + + GET_USER(tmp, (s32*)arg); + + mode =3D (u8)(tmp & 0xff); + + BT_DRIVER("BTSETMSSWITCH : %d\n", mode); + hci_set_msswitch_mode(mode); + } +=09=09 default: +#if 0=09=20=20 /* forward rest to serial driver ! */ BT_DRIVER(FNC"forwarding ioctl 0x%x to serial driver\n", cmd);=20 - - /* FIXME - this MUST be set before using bt driver !! */ if (sertty !=3D NULL) return sertty->driver.ioctl(sertty, file, cmd, arg); + break; +#else + return -ENOIOCTLCMD; +#endif } -=20=20 return 0; #undef FNC } @@ -1114,8 +1156,6 @@ BT_LDISC("bt_tty_write (%d) done !x\n", count); =20=20=20 return tty->driver.write(tty, 1/*from user*/, data, count); -// PRINTPKT("ttySx wrote : ", (u8*)data, (s32)count); -// return count; } =20 =20 @@ -1137,7 +1177,7 @@ BT_LDISC(FNC"forwarding ioctl 0x%x to n_tty line disc\n", cmd); return n_tty_ioctl(tty, file, cmd, arg); } - return 0; + return -ENOIOCTLCMD; #undef FNC } =20 @@ -1256,7 +1296,7 @@ return 0; } else { bt_flash_led(); - PRINTPKT("bt_write_lower_driver :", (u8*)data, len); + BT_DATADUMP("<--|X|", (u8*)data, len); sent =3D sertty->driver.write(sertty, 0, data, len); } =20=09=09 @@ -1285,7 +1325,7 @@ char *flags, s32 count) { BT_DATA("-->|X| %3d\n", count); - PRINTPKT("bt_receive_lower_stack :", (u8*)data, count); + BT_DATADUMP("-->|X|", (u8*)data, count); =20 bt_flash_led();=20=20 =20 @@ -1298,7 +1338,6 @@ #endif /* CONFIG_BLUETOOTH_USE_INBUFFER */ } =20 - /*=20 * Upper tty writes to top of stack (BT drivers write())=20 */ @@ -1314,6 +1353,7 @@ struct bt_session *bt; =20=09 BT_DATA(" |X|<-- %3d [%d]\n", count, line); + BT_DATADUMP("|X|<--", (u8*)buf, count); =20 bt =3D (bt_session *)tty->driver_data; =20=09 @@ -1360,6 +1400,7 @@ /* get upper tty and call its ldisc->receive_buf */ =20 BT_DATA(" |X|--> %3d [%d]\n", len, line); + BT_DATADUMP("|X|-->", data, len); =20 if (SESSIONSTATE(line) !=3D BT_ACTIVE) { /* change debug macro... */ @@ -1382,7 +1423,7 @@ if (upper_tty) { upper_tty->ldisc.receive_buf(upper_tty, data, NULL, len);=20=20 } else { - D_ERR("No upper tty registered !!!\n"); + //D_ERR("No upper tty registered !!!\n"); return -1; } return 0; @@ -1417,7 +1458,7 @@ check_line =3D bt_ctrl.tty_last_unthrottled+1;=09 } =20=09=09 - BT_DATA("bt_feedstack : start on line %d\n", check_line); + //BT_DATA("bt_feedstack : start on line %d\n", check_line); =20=09=09 /* skip non-active and control port (last) */ while ((SESSIONSTATE(check_line) !=3D BT_ACTIVE) &&=20 @@ -1429,18 +1470,18 @@ } =20 /* found an active */ - BT_DATA("bt_feedstack : wakeup line %d !\n", check_line); + //BT_DATA("bt_feedstack : wakeup line %d !\n", check_line); upper_tty =3D GET_UPPERTTY(check_line); bt_ctrl.tty_last_unthrottled =3D check_line; =20=09=09 if (!upper_tty) { - BT_DATA("No active line to feed from!\n"); + //BT_DATA("No active line to feed from!\n"); return; } =20=09 if ((upper_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && upper_tty->ldisc.write_wakeup) { - BT_DATA(" |X|<<*** [%d]\n", check_line); + //BT_DATA(" |X|<<*** [%d]\n", check_line); =20=09=09 /* TTY_DO_WRITE_WAKEUP bit is cleared in=20 upper_tty->flags which means user mode process=20 @@ -1450,7 +1491,7 @@ } else if (!upper_tty->ldisc.write_wakeup) {=20=20=20=20=20 /* if no wake_up function is defined (N_TTY ldisc) wake up wait queue */ - BT_DATA(" |X|<<*** [%d] (n_tty)\n", check_line); + //BT_DATA(" |X|<<*** [%d] (n_tty)\n", check_line); wake_up_interruptible(&upper_tty->write_wait); } #undef FNC @@ -1578,13 +1619,13 @@ return -1; }=20 =20 + bt_ctrl.session[line].connect_status =3D -1; + BT_DRIVER(FNC"Connecting srv ch %d on line %d\n", srv_ch, line); - PRINTPKT("Remote BD : ", bd_addr, 6); + BT_DATADUMP("Remote BD : ", bd_addr, 6); rfcomm_connect_req(bd_addr, srv_ch, line);=09=09 =20 - printk("sleep on line %d\n", line); -=09=09 start_wq_timer(&bt_timer, BT_CON_TIMEOUT,=20 &bt_ctrl.connect_wq[line]); =20 @@ -1598,14 +1639,12 @@ int sdp_connection_id =3D -1; int return_value; =20 - /*-----------------------------------------------------------*/ - /* Get the line to use for SDP communication. */ - /*-----------------------------------------------------------*/ + /* Get the line to use for SDP communication */ + line =3D GET_SDPLINE(con_id); =20 - /*-----------------------------------------------------------*/ - /* Check the line to assure no other connections on it. */ - /*-----------------------------------------------------------*/ + /* Check the line to assure no other connections on it */ + if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) || (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { D_WARN("already got connection on line %d\n", @@ -1613,26 +1652,28 @@ return -1; } =20 - /*-----------------------------------------------------------*/ - /* Initiate the connection. */ - /*-----------------------------------------------------------*/ + /* Initiate the connection */ + BT_DRIVER(FNC"Connecting SDP on line %d\n", line); - PRINTPKT("Remote BD : ", bd_addr, 6); + BT_DATADUMP("Remote BD : ", bd_addr, 6); if ((sdp_connection_id =3D sdp_connect_req(bd_addr, line)) >=3D 0) { - /*---------------------------------------------------*/ - /* If here, we have successfully created an SDP */ - /* connection entry and are starting the sequence of */ - /* opening an l2cap connection. Allow the bottom */ - /* half to process the request and get back to us. */ - /*---------------------------------------------------*/ +=09=09=20=20 + /*=20 + * If here, we have successfully created an SDP=20=20=20=20=20 + * connection entry and are starting the sequence of=20 + * opening an l2cap connection. Allow the bottom=20=20=20=20=20 + * half to process the request and get back to us.=20=20=20 + */ +=09=09=09 BT_DRIVER(FNC"sleep on line %d\n", line); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); =20 - /*---------------------------------------------------*/ - /* If the connect_status is >=3D 0, then the lower */ - /* stack did not have a problem handling the request.*/ - /* Therefore return the sdp_connection_id */ - /*---------------------------------------------------*/ + /*=20 + * If the connect_status is >=3D 0, then the lower + * stack did not have a problem handling the request. + * Therefore return the sdp_connection_id=20=20=20=20=20=20=20=20=20=20= =20=20 + */ +=09=09=09 BT_DRIVER(FNC"Wake up - line %d\n", line); if (bt_ctrl.session[line].connect_status >=3D 0) { return_value =3D sdp_connection_id; @@ -1661,9 +1702,9 @@ int sdpIndex =3D GET_SDPINDEX(sdpRequest->conID); =20 if (SESSIONSTATE(line) !=3D BT_ACTIVE) { - /*-----------------------------------------------------------*/ - /* SDP connection not active! Don't issue the request. */ - /*-----------------------------------------------------------*/ + + /* SDP connection not active! Don't issue the request */ + BT_DRIVER("bt_execute_sdp_request: line %d does not have an active conne= ction!\n", line); return -1; } @@ -1676,16 +1717,14 @@ sdpRequest->pduLength) < 0) return -1; =20 - /*-------------------------------------------------------------------*/ - /* Sleep on this line while the response is going through. */ - /*-------------------------------------------------------------------*/ + /* Sleep on this line while the response is going through */ + printk("bt_execute_sdp_request: sleep on line %d\n", line); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); =20 - /*-------------------------------------------------------------------*/ - /* If we're back, there may be data to send back. */ - /* Copy into sdpRequest and return. */ - /*-------------------------------------------------------------------*/ + /* If we're back, there may be data to send back. + Copy into sdpRequest and return */ +=09 if (bt_ctrl.session[line].sdpRequestResponseData) { BT_DRIVER("bt_execute_sdp_request: sdpRequestResponseData 0x%x - copying= \n", (int)bt_ctrl.session[line].sdpRequestResponseData); memcpy(sdpRequest->requestResponse, @@ -1695,12 +1734,16 @@ } =20 return 0; -} /* End of bt_execute_sdp_request() */ +} =20 void bt_connect_ind(u32 con_id)=20 { - DSYS("Got connect indication on PSM %d\n", GET_PSM(con_id)); + if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) + BT_DRIVER("bt_connect_ind : RFCOMM dlci : %d\n",=20 + GET_RFCOMMDLCI(con_id)); + else + BT_DRIVER("bt_connect_ind : psm %d\n", GET_PSM(con_id)); } =20 void @@ -1710,11 +1753,10 @@ s32 line; =20=09 psm =3D GET_PSM(con_id); - printk("bt_connect_cfm status : %d\n", status); =20=09 switch (psm) { case RFCOMM_LAYER: - BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm)); + line =3D GET_RFCOMMLINE(con_id); CHECK_RFCOMM(con_id); =20 @@ -1725,31 +1767,29 @@ } =20 bt_ctrl.session[line].connect_status =3D status; + BT_DRIVER("bt_connect_cfm, line %d [%s]\n", GET_RFCOMMLINE(con_id), psmname(psm)); + release_wq_timer(&bt_timer); wake_up_interruptible(&bt_ctrl.connect_wq[line]); wake_up_interruptible(&bt_ctrl.any_wq); break; =20=09 case SDP_LAYER: - BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm)); line =3D GET_SDPLINE(con_id); =20 - /*-----------------------------------------------------------*/ - /* Check incomming line for validity. */ - /*-----------------------------------------------------------*/ + /* Check incoming line for validity */ if ((line < 0) || (line > BT_NBR_DATAPORTS)) { D_ERR("bt_connect_cfm on invalid line (%d)\n", line); return; } =20 - /*-----------------------------------------------------------*/ /* Record the connection status for bt_connect() to process. */ - /*-----------------------------------------------------------*/ + bt_ctrl.session[line].connect_status =3D status; BT_DRIVER("bt_connect_cfm, line %d [%s]\n", GET_SDPLINE(con_id), psmname= (psm)); - printk("wake up line %d\n", line); + BT_DRIVER("wake up line %d\n", line); release_wq_timer(&bt_timer); wake_up_interruptible(&bt_ctrl.connect_wq[line]); wake_up_interruptible(&bt_ctrl.any_wq); @@ -1765,25 +1805,21 @@ } } =20 -void bt_send_sdp_data_received(u8 line, u8 *data, int len) +void=20 +bt_send_sdp_data_received(u8 line, u8 *data, int len) { - /*----------------------------------------------------------*/ - /* Check the line for validity. */ - /*----------------------------------------------------------*/ + /* Check the line for validity */ if (line > BT_NBR_DATAPORTS) { D_ERR("bt_connect_cfm on invalid line (%d)\n", line); return; } =20 - /*----------------------------------------------------------*/ - /* When data received for this line, we simply attach the */ - /* data (& length) and wake up. */ - /*----------------------------------------------------------*/ + /* When data received for this line, we simply attach the + data (& length) and wake up */ +=09 BT_DRIVER("bt_send_sdp_data_received: data 0x%x len %d\n", (int)data, len= ); + /* If previous data, deallocate it */ =20 - /*----------------------------------------------------------*/ - /* If previous data, deallocate it. */ - /*----------------------------------------------------------*/ if (bt_ctrl.session[line].sdpRequestResponseData) { D_WARN("bt_send_sdp_data_received: sdpRequestResponseData set - dealloca= te\n"); kfree(bt_ctrl.session[line].sdpRequestResponseData); @@ -1795,9 +1831,10 @@ bt_ctrl.session[line].sdpRequestResponseDataLength =3D len; wake_up_interruptible(&bt_ctrl.connect_wq[line]); return; -} /* End of bt_send_sdp_data_received() */ +} =20 -static s32 bt_disconnect(u32 con_id) +static s32=20 +bt_disconnect(u32 con_id) { int line =3D GET_RFCOMMLINE(con_id); BT_DRIVER("bt_disconnect : Disconnecting line %d (ONLY RFCOMM)\n",=20 @@ -1805,20 +1842,29 @@ =20 CHECK_RFCOMM(con_id); =20 + bt_ctrl.session[line].disconnect_status =3D -1; + start_wq_timer(&bt_timer, BT_CON_TIMEOUT, &bt_ctrl.connect_wq[line]); =20 rfcomm_disconnect_req(GET_RFCOMMLINE(con_id)); =20 - /* use connect wq for disconnect aswell */ + /* Only sleep if no reply yet, use connect wq for=20 + disconnect aswell */ + if (bt_ctrl.session[line].disconnect_status =3D=3D -1) { interruptible_sleep_on(&bt_ctrl.connect_wq[line]); + } =20 - return 0; + return bt_ctrl.session[line].disconnect_status; } =20 void bt_disconnect_ind(u32 con_id)=20 { - DSYS("Got disconnect indication on PSM %d\n",GET_PSM(con_id)); + if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) + BT_DRIVER("bt_disconnect_ind : RFCOMM dlci : %d\n",=20 + GET_RFCOMMDLCI(con_id)); + else + BT_DRIVER("bt_disconnect_ind : psm %d\n", GET_PSM(con_id)); } =20 void @@ -1826,8 +1872,12 @@ { u32 line =3D GET_RFCOMMLINE(con_id); =20 - DSYS("Got disconnect confirm on PSM %d status %d\n",=20 + BT_DRIVER("bt_disconnect_cfm : psm %d, status %d\n",=20 GET_PSM(con_id), status); + + bt_ctrl.session[line].disconnect_status =3D status; + + release_wq_timer(&bt_timer); wake_up_interruptible(&bt_ctrl.connect_wq[line]); } =20 @@ -2250,7 +2300,7 @@ =20=20 void bt_reset_session(s32 line) { - bt_ctrl.session[line].connect_status =3D 0; + /* don't touch con/disc status here */ bt_ctrl.session[line].upper_tty =3D NULL; bt_ctrl.session[line].rfcomm =3D NULL; bt_ctrl.session[line].dlci =3D 0;=20 @@ -2348,9 +2398,8 @@ return -1;=09 } =20 - /*-------------------------------------------------------------*/ /* Better not have any sdp data pending for this connection */ - /*-------------------------------------------------------------*/ + if (bt_ctrl.session[line].sdpRequestResponseData) { D_WARN("bt_register_sdp: Pending SDP data for this new connection @ line= %d\n", line); } @@ -2370,6 +2419,7 @@ } =20 s32 + bt_unregister_rfcomm(s32 line) { BT_DRIVER("bt_unregister_rfcomm : line %d\n", line);=09 @@ -2402,10 +2452,9 @@ return -1;=09 } =20 - /*-------------------------------------------------------------------*/ - /* Part of unregistering SDP is to deallocate any sdp request */ - /* response data AND clear length and pointer. */ - /*-------------------------------------------------------------------*/ + /* Part of unregistering SDP is to deallocate any sdp request + response data AND clear length and pointer */ + if (bt_ctrl.session[line].sdpRequestResponseData) { DSYS("bt_unregister_sdp: Free request data 0x%x\n", (unsigned int)bt_ctrl.session[line].sdpRequestResponseData); @@ -2597,12 +2646,16 @@ wq_timer->data =3D (unsigned long)wq; wq_timer->expires =3D jiffies + timeout; add_timer(wq_timer); + //printk("start_wq_timer wq 0x%x : timer 0x%x\n", wq, wq_timer); } =20 + +/* fixme -- only works for one function call at a time */ void release_wq_timer(struct timer_list *wq_timer) { del_timer(wq_timer); + //printk("release_wq_timer timer 0x%x\n", wq_timer); } =20 void @@ -2613,6 +2666,8 @@ #else struct wait_queue **wq =3D (struct wait_queue **)ptr; #endif /* LINUX_VERSION_CODE */ + + //printk("wq_timeout wq 0x%x\n", wq); =20 /* wake up wait queue */ wake_up_interruptible(wq); |
From: Mattias A. <mat...@us...> - 2001-03-30 09:47:17
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added test.o (for unplug tests) The diff of the modified file(s): --- Makefile 2001/03/12 16:23:20 1.19 +++ Makefile 2001/03/30 09:47:15 1.20 @@ -8,7 +8,7 @@ =20 OBJS =3D bluetooth.o bt_proc.o btdebug.o btmem.o hci.o hci_vendor.o \ l2cap.o l2cap_con.o l2cap_sec.o rfcomm.o rfcomm_sec.o \ - sec_client.o sdp.o tcs.o=20 + sec_client.o sdp.o tcs.o test.o =20 ifeq ($(TOPDIR)/Rules.make,$(wildcard $(TOPDIR)/Rules.make)) =20 |
From: Mattias A. <mat...@us...> - 2001-03-30 09:45:47
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- sdp.h 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added include to l2cap.h The diff of the modified file(s): --- sdp.h 2001/03/06 11:05:23 1.25 +++ sdp.h 2001/03/30 09:45:45 1.26 @@ -47,9 +47,11 @@ #ifdef __KERNEL__ #include <linux/types.h> #include <linux/bluetooth/btcommon.h> +#include <linux/bluetooth/l2cap.h> #else #include "btcommon.h" #include "local.h" +#include "l2cap.h" #endif =20 /****************** CONSTANT AND MACRO SECTION ***************************= ***/ @@ -64,6 +66,7 @@ /* bt_ctrl data structure). = */ /* index =3D The SDP connection data structure. = */ /*------------------------------------------------------------------------= --*/ + #define CREATE_SDP_ID(line, index) ( ((SDP_LAYER << 16) & 0xffff0000) | ((= line << 8) & 0x0000ff00) | (index & 0xff) ) #define GET_SDPINDEX(conID) ( (conID & 0xff) ) #define GET_SDPLINE(conID) ( ((conID & 0xff00) >> 8) ) |
From: Mattias A. <mat...@us...> - 2001-03-30 09:45:08
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap_con.h 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added flags defines used to control blocking waitqueues * added result defines used to return internal connection status to=20 upper layers * added l2ca_wait / l2ca_wakeup, used to block on a connection The diff of the modified file(s): --- l2cap_con.h 2001/02/15 16:28:47 1.4 +++ l2cap_con.h 2001/03/30 09:45:06 1.5 @@ -57,10 +57,22 @@ /* internal test of connection manager */ #define L2CAP_SELFTEST 0 =20 - /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 +/* con->c_flags */ +#define FLAG_WAKEMEUP 0x1 /* wake up con->wq */ +#define FLAG_RETURNNOW 2 /* return immediately, used when setting up=20 + baseband */ +#define FLAG_DONTSLEEP (2<<2) /* used when e.g ertx_timeout calls disc req= */ +#define FLAG_SOMETHING (2<<3) /* ??? */ =20 +/* con->c_status */ +#define CSTATUS_SUCCESS 0 /* return status success to upper caller */ +#define CSTATUS_FAILED 1 /* return status failed to upper caller */ +#define CSTATUS_RTX_TIMEOUT 2 /* resend request */ +#define CSTATUS_ERTX_TIMEOUT 3 /* disconnect link */ +#define CSTATUS_MAX_NO_RTX 4 +#define CSTATUS_CMDREJECT 5 =20 /****************** EXPORTED FUNCTION DECLARATION SECTION ****************= ***/ =20 @@ -96,6 +108,10 @@ void show_con(const u8* head, l2cap_con* con); void show_list(void); s32 count_con(u16 hci_hdl); + +void l2ca_wait(const char *str, l2cap_con *con); +void l2ca_wakeup(const char *str, l2cap_con *con); + =20 #if L2CAP_SELFTEST void test_conlist(void); |
From: Mattias A. <mat...@us...> - 2001-03-30 09:44:17
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.h 1.36 1.37=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * modified echo / info functions * added result param in l2cap_config_rsp The diff of the modified file(s): --- l2cap.h 2001/03/02 10:55:03 1.36 +++ l2cap.h 2001/03/30 09:44:15 1.37 @@ -80,7 +80,7 @@ #define MIN_DYNAMIC_PSM 0x1001 #define MAX_DYNAMIC_PSM 0xFFFF =20 -/* Result in respones in L2CAP */ +/* Result in responses in L2CAP */ #define RES_SUCCESS 0x0 #define RES_PENDING 0x01 #define RES_PSMNEG 0x02 @@ -338,12 +338,17 @@ u16 link_timeout); =20 s32 l2cap_config_rsp(l2cap_con* con, u32 out_mtu,=20 - flow *in_flow); + flow *in_flow, s32 result); =20 s32 l2cap_disconnect_req(l2cap_con *con); =20 s32 l2cap_disconnect_rsp(l2cap_con* con); =20 +s32 l2cap_echo_rsp(s32 hci_hdl, s32 id, u8 *opt_data, u16 opt_len); + +s32 l2cap_info_rsp(s32 hci_hdl, s32 id, u16 info_type, u8 *info_data,=20 + s32 info_len, s32 result); + /*******************************************************************/ /* (E3) Data from peers */ /************************/ @@ -368,15 +373,12 @@ s32 l2ca_disconnect_req(l2cap_con *con); s32 l2ca_disconnect_rsp(l2cap_con *con); =20 -s32 l2ca_ping(BD_ADDR bd); -s32 l2cap_echo_req(l2cap_con *con, u8 *opt_data, s32 opt_len); +s32 l2ca_ping(BD_ADDR bd, u8 *opt_data, u16 len); +s32 l2cap_echo_req(l2cap_con *con, u8 *opt_data, u16 opt_len); =20 =20 s32 l2ca_getinfo(BD_ADDR bd, u16 infotype); s32 l2cap_info_req(l2cap_con *con, u16 info_type); -s32 l2cap_info_rsp(s32 hci_hdl, s32 id, u16 info_type, u8 *info_data,=20 - s32 info_len, s32 result); - =20 /**************************************************************/ /* (E5) Timer events */ @@ -432,8 +434,6 @@ =20 /* FIXME */ void l2ca_qos_violation_ind(l2cap_con *con); - -void l2ca_ping_rsp(u8* data, u32 len, BD_ADDR remote_bd); =20 int l2ca_opened(l2cap_con *con); =20 |
From: Mattias A. <mat...@us...> - 2001-03-30 09:42:43
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.h 1.47 1.48=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added prototype for reading local verions info * added ms_set_msswitch_mode used to enable/disable m/s switch The diff of the modified file(s): --- hci.h 2001/03/12 15:55:02 1.47 +++ hci.h 2001/03/30 09:42:41 1.48 @@ -138,6 +138,9 @@ =20 /* Informational Parameters */ s32 hci_read_local_bd(u8 *bd); +s32 hci_read_local_version_info(s32 block); + + =20 /* Internal */ /* FIXME -- add parameter to choose from different devices */ @@ -147,6 +150,8 @@ s32 hci_enable_dut(void); s32 hci_test_connect_req(u8 *bd); s32 hci_send_raw_data(u8 *data, u8 len); + +void hci_set_msswitch_mode(u8 mode); =20 /* Vendor specific */ s32 hci_set_bd_addr(u8 bd[6]); |
From: Mattias A. <mat...@us...> - 2001-03-30 09:40:55
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btcommon.h 1.66 1.67=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added blocking calls on l2cap messages * rewrote rtx/ertx timer handling * added result and internal connection status in l2cap con obj * added ping_struct used to send ping via ioctl * removed l2cap command backup, use blocking calls instead when=20 resending lost l2cap messages. * added ioctls for enabling m/s switch, sending test cmd and do ping * minor changes The diff of the modified file(s): --- btcommon.h 2001/03/06 10:11:34 1.66 +++ btcommon.h 2001/03/30 09:40:53 1.67 @@ -176,12 +176,22 @@ /* ioctls vendor specific HCI commands */ #define HCISETBAUDRATE _IOW(BT_IOC_MAGIC, 0x70, s32) #define HCIWRITEBDADDR _IOW(BT_IOC_MAGIC, 0x71, u8[6]) -#define HCISENDRAWDATA _IOW(BT_IOC_MAGIC, 0x72, u8[64]) + +/* | len 1 byte | 4 bytes hci header | data (max 256) | */ +#define HCISENDRAWDATA _IOW(BT_IOC_MAGIC, 0x72, u8[261]) =20 /* other ioctls used for testing */ #define BTSENDTESTDATA _IOW(BT_IOC_MAGIC, 0xf0, s32[2]) #define HCITESTCONNECTREQ _IOW(BT_IOC_MAGIC, 0xf1, u8[6]) +#define BTTESTCOMMAND _IOW(BT_IOC_MAGIC, 0xf2, u8[261]) +#define BTSETMSSWITCH _IOW(BT_IOC_MAGIC, 0xf3, u8) =20 +/* | BD(6) | len(2) | data |*/ +#define BTPING _IOW(BT_IOC_MAGIC, 0x73, ping_struct) + +/* | BD(6) | type (2) |*/ +#define BTGETINFO _IOW(BT_IOC_MAGIC, 0x74, u8[8]) + /* NOTE ! * N_BT should be defined in /include/asm/termios.h=20 * However, if you are compiling this source standalone @@ -276,18 +286,32 @@ /* FIXME -- move all layer specific structs into each layers .h file=20 and fix include order ! */ =20 -/* used to resend lost l2cap commands */ -typedef struct l2cap_cmd_backup { - u8 type; /* conreq/confreq/discreq */=09 - u8 nbr_resends; - /* params for config req */ - u16 in_mtu; - u16 flush_timeout; - u16 link_to; - flow *outflow; /* danger if this is deallocated in upper layers */ - u16 inforeq_type; -} l2cap_cmd_backup; +/* RTX Actions */ +#define RTX_ACTION_DISCONNECT 0 /* default */ +#define RTX_ACTION_START_ERTX 1 /* during con*/ +#define RTX_ACTION_TERMINATE 2 /* if we tried to disconnect and got no res= p */ + +#define ERTX_ACTION_DISCONNECT 0xf0 /* default */ +#define ERTX_ACTION_TERMINATE 0xf1 =20 +typedef struct l2cap_timer_obj +{ +#ifdef __KERNEL__ + struct timer_list rtx; + struct timer_list ertx; +#else + /* fixme */ +#endif + u16 rtx_no; /* nbr retries */ + u16 rtx_action; /* preferred action when rtx expires */=09 + u16 rtx_inuse; /* to avoid concurrent use */ + + u16 ertx_action; /* preferred action when ertx expires */=09 + u16 ertx_inuse; + + //struct timeval caller_id; /* used to identify caller */ +} __attribute__ ((packed)) l2cap_timer_obj; + typedef struct l2cap_con { s32 magic; BD_ADDR remote_bd; /* 6 bytes */ @@ -302,33 +326,38 @@ u16 psm; u16 local_mtu; =20 - /* remote options temp stored when receiving config req */ + /* Config options from remote peer */ u16 remote_mtu; u16 flush_timeout; flow remote_qos; + u16 remote_flags; /* more config options to come */ =20 + u16 local_flags; /* indicates more config options to be sent */ + u8 initiator; =20 u8 link_up;=20=20 u8 sig_id_sent; /* last sent command id */ u8 sig_id_rcv; /* last received command id*/ =20=09 - - u8 ping_sent; - u8 inforeq_sent; - - s32 reconfiguring; /* indicates if we are currently reconfiguring */ -=09 s32 conf_req_ready; /* indicates if we received pos rsp on our req */ s32 conf_rsp_ready; /* indicates if we replied pos on a config req */ =20 -#ifdef __KERNEL__ - struct timer_list rtx_timer; - struct timer_list ertx_timer; + /* Fixme -- fix multicall */ + struct l2cap_timer_obj timer; + + /* Fixme -- fix all return values according this system */ + s32 c_result; /* returns result to higher layers, used together with + MSGCODE macro */ + s32 c_status; /* used to indicate status up caller */ + u32 c_flags; /* internal connection flags see l2cap_con.h for=20 + flag codes */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) + struct wait_queue *wq; #else - /* timers for usermode is in l2cap.c */ -#endif - struct l2cap_cmd_backup last_cmd; /* used to resend signals */ + wait_queue_head_t wq; +#endif /* LINUX_VERSION_CODE */ =20 /* stats packets sent/received/lost etc*/ =20 @@ -429,8 +458,8 @@ { /* general */ struct tty_struct *upper_tty; - s32 connect_status; - + volatile s32 connect_status; + volatile s32 disconnect_status; /* hci link */ =20 /* rfcomm */ @@ -491,6 +520,13 @@ u8 bd_addr[0]; } inquiry_results; =20 +typedef struct ping_struct +{ + u8 bd[6]; + u16 len; + u8 data[1024]; +} ping_struct; + typedef struct serport_profile_info { s32 rfcomm_serv_chan; u32 serport_name_length; @@ -499,18 +535,6 @@ =20 extern s32 bt_current_hw; extern u8 bt_hw_firmware_info[255]; - -/* unique status codes 32 bits : | layer 16 bits | code 16 bits | */ - -#define MSG_LAYER_HCI 0 -#define MSG_LAYER_L2CAP 1 -#define MSG_LAYER_RFCOMM 2 -#define MSG_LAYER_SDP 4 -#define MSG_LAYER_TCS 8 - -/* unique status codes 32 bits : | layer 16 bits | code 16 bits | */ - -#define MSGCODE(layer, msgcode) ((((layer)<<16)&0xffff0000) | ((msgcode)&0= xffff)) =20 #endif /****************** END OF FILE btcommon.h *******************************= ***/ |
From: Peter K. <pk...@us...> - 2001-03-30 06:17:24
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- Config.in 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20 bluetooth.c 1.155 1.156=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Allow pin G11 to be used for reset of the Bluetooth hardware too. The diff of the modified file(s): --- Config.in 2001/03/21 16:27:39 1.8 +++ Config.in 2001/03/30 06:17:19 1.9 @@ -32,7 +32,8 @@ "None CONFIG_BLUETOOTH_RESET_NONE \ Port_PA_Bit_7 CONFIG_BLUETOOTH_RESET_PA7 \ Port_PB_Bit_5 CONFIG_BLUETOOTH_RESET_PB5 \ - Port_G_Bit_10 CONFIG_BLUETOOTH_RESET_G10" None + Port_G_Bit_10 CONFIG_BLUETOOTH_RESET_G10 \ + Port_G_Bit_11 CONFIG_BLUETOOTH_RESET_G11" None fi =20 endmenu --- bluetooth.c 2001/03/27 19:32:27 1.155 +++ bluetooth.c 2001/03/30 06:17:19 1.156 @@ -668,6 +668,18 @@ udelay(1000); REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); #endif +#elif defined(CONFIG_BLUETOOTH_RESET_G11) +#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) + BT_DRIVER(FNC"Resetting hardware (G11) Active High\n"); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); + udelay(1000); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); +#else + BT_DRIVER(FNC"Resetting hardware (G11) Active Low\n "); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); + udelay(1000); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); +#endif #else D_ERR(FNC"Resetting hardware : No reset pin defined\n"); #endif |