|
From: Peter K. <pk...@us...> - 2001-04-12 15:56:42
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.155 1.155.2.1=20=20=20=20=20=20=20
rfcomm.c 1.95 1.95.4.1=20=20=20=20=20=20=20=20
The accompanying log:
Branch to fix disconnection of Bluetooth connection in R2_1_11.
The diff of the modified file(s):
--- bluetooth.c 2001/03/27 19:32:27 1.155
+++ bluetooth.c 2001/04/12 15:56:40 1.155.2.1
@@ -466,6 +466,7 @@
static void
bt_flush_buffer(struct tty_struct *tty)
{
+#if 0=09
bt_tx_buf* tx_buf;
=20
BT_DRIVER("bt_flush_buffer\n");
@@ -473,6 +474,7 @@
while ((tx_buf =3D get_bt_buf())) {
unsubscribe_bt_buf(tx_buf);
}
+#endif
}
=20
static s32
@@ -2378,6 +2380,11 @@
D_WARN("bt_unregister_rfcomm : inactive session\n");
return -1;
}
+
+ /* notify upper tty that this rfcomm connection is down */
+#ifdef __KERNEL__
+ bt_hangupline(line);
+#endif
return 0;
}
=20
--- rfcomm.c 2001/03/12 15:54:35 1.95
+++ rfcomm.c 2001/04/12 15:56:40 1.95.4.1
@@ -975,31 +975,30 @@
void=20
rfcomm_disconnect_ind(l2cap_con *l2cap)
{
-#define FNC "rfcomm_disconnect_ind: "
rfcomm_con *rfcomm;
=20
- D_CTRL(FNC"remote cid %d\n", l2cap->remote_cid);
+ D_CTRL(__FUNCTION__" remote cid %d\n", l2cap->remote_cid);
=20
rfcomm =3D ((rfcomm_con*) l2cap->upper_con);
=20
- if (l2ca_disconnect_rsp(l2cap)) {
- D_ERR(FNC"l2ca_disconnect_rsp failed\n");
- return;
- }
+ /* This l2cap connection is going down, remove all rfcomm cons=20
+ and notify upper tty */
=20
+ if (!l2cap->link_up)
+ {
+ DSYS("Baseband is down, reset this RFCOMM session\n");
#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
+ bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line, 0));
rfcomm_reset_con(rfcomm->line);
+ }
=20=09
-#undef FNC
+ /* always try to send back rsp (if link is down con is deleted) */
+ if (l2ca_disconnect_rsp(l2cap)) {
+ D_ERR(__FUNCTION__" l2ca_disconnect_rsp failed\n");
+ return;
+ }
}
=20
void=20
@@ -1013,8 +1012,17 @@
=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));
=20=09
+ /* fixme -- add these glue layer functions in userstack */
+#ifdef __KERNEL__
+ bt_unregister_rfcomm(rfcomm->line);
+
+ /* wake up bt line */
+ bt_disconnect_cfm(CREATE_RFCOMM_ID(rfcomm->line, 0), 0);
+#endif=09
rfcomm_reset_con(rfcomm->line);
=20=09
#undef FNC
@@ -1154,6 +1162,7 @@
=20
} else if (rfcomm->dlci[tmp_dlci].state =3D=3D DISCONNECTING) {
if (tmp_dlci =3D=3D 0) {
+ rfcomm->dlci[0].state =3D DISCONNECTED;
#ifdef __KERNEL__=20=20
wake_up_interruptible(&rfcomm_disconnect_wq);
#else
@@ -1197,6 +1206,8 @@
Tell the tty that the link is down */
send_ua(rfcomm, tmp_dlci);
bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line, 0));
+ bt_unregister_rfcomm(rfcomm->line);
+
} else {
rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED;
send_ua(rfcomm, tmp_dlci);
|