|
From: Alain P. <apa...@us...> - 2002-08-05 15:38:12
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.230 1.231=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_proc.c 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20=20=20
rfcomm.c 1.133 1.134=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added information in proc file bt_channel_con when disconnecting. New synta=
x is :
<line>:<server channel>:<state>
where <state> is either "connected" or "disconnected".
The diff of the modified file(s):
--- bluetooth.c 1 Aug 2002 16:13:17 -0000 1.230
+++ bluetooth.c 5 Aug 2002 15:38:11 -0000 1.231
@@ -277,6 +277,7 @@
#ifdef CONFIG_BLUETOOTH_PROC
extern int new_con_srv_channel;
extern int new_con_line;
+extern int new_con_connected;
=20
#ifdef __KERNEL__
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
@@ -2398,6 +2399,7 @@
#ifdef CONFIG_BLUETOOTH_PROC
new_con_srv_channel =3D bt_ctrl.session[line].dlci >> 1;
new_con_line =3D line;
+ new_con_connected =3D 1; // New connection
/* Wake up if someone reads the proc file */
wake_up_interruptible(&channel_con_wq);
#endif
@@ -2517,6 +2519,7 @@
void
bt_disconnect_ind(u32 con_id)
{
+=09
if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER)
BT_DRIVER(__FUNCTION__ ": RFCOMM dlci: %d\n",
GET_RFCOMMDLCI(con_id));
--- bt_proc.c 1 Aug 2002 16:19:28 -0000 1.25
+++ bt_proc.c 5 Aug 2002 15:38:11 -0000 1.26
@@ -113,9 +113,10 @@
=20
#ifdef CONFIG_BLUETOOTH_PROC
=20
-/* Next variables are declared in bluetooth.c */
+/* Next variables are used to store information to write in channel_con pr=
oc file */
int new_con_srv_channel;
int new_con_line;
+int new_con_connected; // 0 =3D disconnected, 1 =3D connected
=20
=20
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
@@ -400,9 +401,12 @@
/* Maximum : 6:30, so 5 characters with \0 */
=20
position =3D 0;
- position +=3D sprintf(buf + position,"%d", new_con_line);
- position +=3D sprintf(buf + position, ":");
- position +=3D sprintf(buf + position, "%d\n", new_con_srv_channel);
+ position +=3D sprintf(buf + position,"%d:", new_con_line);
+ position +=3D sprintf(buf + position, "%d:", new_con_srv_channel);
+ if (new_con_connected)
+ position +=3D sprintf(buf + position, "connected\n");
+ else
+ position +=3D sprintf(buf + position, "disconnected\n");
=20=09
return position;=09
}
--- rfcomm.c 11 Apr 2002 10:19:50 -0000 1.133
+++ rfcomm.c 5 Aug 2002 15:38:11 -0000 1.134
@@ -501,6 +501,23 @@
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
+/****************** EXTERNAL VARIABLE DECLARATION SECTION ****************=
***/
+
+/* Use global variables to store line and server channel of a new incoming=
connection */
+#ifdef CONFIG_BLUETOOTH_PROC
+extern int new_con_srv_channel;
+extern int new_con_line;
+extern int new_con_connected;
+#endif
+
+#ifdef __KERNEL__
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+extern struct wait_queue *channel_con_wq =3D NULL;
+#else
+extern wait_queue_head_t channel_con_wq;
+#endif /* LINUX_VERSION_CODE */
+#endif /* __KERNEL__ */
+
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
/* The crctable for the FEC field */
@@ -1177,6 +1194,14 @@
rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED;
tmp =3D get_connected_dlci(rfcomm);
=20
+#ifdef CONFIG_BLUETOOTH_PROC
+ new_con_srv_channel =3D tmp_dlci >> 1;
+ new_con_line =3D rfcomm->line;
+ new_con_connected =3D 0; // Disconnection
+ /* Wake up if someone reads the proc file */
+ wake_up_interruptible(&channel_con_wq);=09=09
+#endif=09
+
if (tmp >=3D 0) {
rfcomm->dlci[tmp].state =3D DISCONNECTING;
send_disc(rfcomm, tmp);
@@ -1222,6 +1247,14 @@
} else {
rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED;
send_ua(rfcomm, tmp_dlci);
+=09=09=09
+#ifdef CONFIG_BLUETOOTH_PROC
+ new_con_srv_channel =3D tmp_dlci >> 1;
+ new_con_line =3D rfcomm->line;
+ new_con_connected =3D 0; // Disconnection
+ /* Wake up if someone reads the proc file */
+ wake_up_interruptible(&channel_con_wq);=09=09
+#endif
D_CTRL("dlci %d was disconnected\n", tmp_dlci);
bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line,=20
tmp_dlci));
|