|
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);
|