|
From: Peter K. <pk...@us...> - 2001-02-27 12:50:04
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.123 1.124=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Made psmname() static.
The diff of the modified file(s):
--- bluetooth.c 2001/02/16 14:21:40 1.123
+++ bluetooth.c 2001/02/27 12:51:12 1.124
@@ -165,6 +165,7 @@
static s32 bt_ctrl_init(void);
static s32 bt_connect(u8 *bd_addr, u32 con_id);
static s32 bt_disconnect(u32 con_id);
+static const u8* psmname(u16 psm);
=20
#ifdef __USE_OLD_SYMTAB__
/*
@@ -2044,7 +2045,6 @@
return pos;
}
=20
-
/*
* FIXME -- make this register function more general i.e
* enable registering any layer.=20
@@ -2258,7 +2258,8 @@
}
=20
=20
-const u8* psmname(u16 psm)
+static const u8*
+psmname(u16 psm)
{
switch(psm)
{
|
|
From: Mats F. <ma...@us...> - 2001-02-27 14:56:54
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.124 1.125=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added Read Scan Enable IOCTL
Added parameters for time and nbr of units in inquiry
Added parameter to initiate sdp as server or client
The diff of the modified file(s):
--- bluetooth.c 2001/02/27 12:51:12 1.124
+++ bluetooth.c 2001/02/27 14:58:02 1.125
@@ -59,6 +59,7 @@
#include <linux/bluetooth/rfcomm.h>
#include <linux/bluetooth/tcs.h>
#include <linux/bluetooth/sdp.h>
+#include <linux/bluetooth/tci.h>
#include <linux/bluetooth/sec_client.h>
=20
#ifdef BT_USE_PROC
@@ -218,6 +219,8 @@
void bt_linebuf_send(s32 line);
#endif
=20
+const u8* psmname(u16 psm);
+
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
@@ -653,14 +656,14 @@
=20
case HCIINQUIRY:
{=20
- s32 max_nbr_of_units;
+ s32 in_param[2];
u8 lap[3];
=20=09=09
BT_DRIVER(FNC"HCINQUIRY\n");
=20=09=09
- copy_from_user(&max_nbr_of_units, (s32*)arg, 4);
- inq_res =3D hci_inquiry(lap, 10 , max_nbr_of_units);
- copy_to_user((s32*)arg, inq_res, size + 6 * max_nbr_of_units);
+ copy_from_user(in_param, (s32*)arg, 8);
+ inq_res =3D hci_inquiry(lap, in_param[1] , in_param[0]);
+ copy_to_user((s32*)arg, inq_res, size + 6 * inq_res->nbr_of_units);
break;
}
=20=09
@@ -810,6 +813,13 @@
break;
}
=20=09
+ case HCIREADSCANENABLE:
+ BT_DRIVER("Reading scan enable\n");
+
+ tmp =3D hci_read_scan_enable();
+ put_user(tmp, (s32*)arg);
+ break;
+=09
case HCIWRITESCANENABLE:
GET_USER(tmp, (s32*)arg);
BT_DRIVER("setting write scan enable : [0x%x]\n", tmp);
@@ -1842,6 +1852,22 @@
procfs_status);
}
=20=09
+#ifdef USE_TCI
+#ifdef KERNEL_VERSION /* Not defined for kernel 2.0.x */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
+ procfs_status =3D proc_register(&proc_root, &tci_proc_entry);
+#else
+ procfs_status =3D proc_register_dynamic(&proc_root, &tci_proc_entry);
+#endif /* LINUX_VERSION_CODE */
+#else /* KERNEL_VERSION */
+ procfs_status =3D proc_register_dynamic(&proc_root, &tci_proc_entry);
+#endif/* KERNEL_VERSION */
+
+ if (procfs_status < 0) {
+ D_ERR("Couldn't register proc file for tci database %d\n",
+ procfs_status);
+ }
+#endif /* USE_TCI */
=20
#endif /* BT_USE_PROC */
=20
@@ -1898,9 +1924,13 @@
hci_init();
l2cap_init();
=20
+#ifdef USE_TCI
+ tci_init();
+#else
rfcomm_init();
- sdp_init();
+ sdp_init(1); /* For now always init as server */
tcs_init();
+#endif
btmem_init();
bt_stack_initiated =3D 1;
bt_stat.bytes_received =3D 0;
|
|
From: Mats F. <ma...@us...> - 2001-02-27 15:02:41
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.125 1.126=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Removed dupplicated declaration of function psmname The diff of the modified file(s): --- bluetooth.c 2001/02/27 14:58:02 1.125 +++ bluetooth.c 2001/02/27 15:03:50 1.126 @@ -219,8 +219,6 @@ void bt_linebuf_send(s32 line); #endif =20 -const u8* psmname(u16 psm); - /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ |
|
From: Mats F. <ma...@us...> - 2001-02-27 15:23:11
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.126 1.127=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Do not include tci.h, when TCI isn't in use The diff of the modified file(s): --- bluetooth.c 2001/02/27 15:03:50 1.126 +++ bluetooth.c 2001/02/27 15:24:20 1.127 @@ -59,8 +59,10 @@ #include <linux/bluetooth/rfcomm.h> #include <linux/bluetooth/tcs.h> #include <linux/bluetooth/sdp.h> -#include <linux/bluetooth/tci.h> #include <linux/bluetooth/sec_client.h> +#ifdef USE_TCI +#include <linux/bluetooth/tci.h> +#endif =20 #ifdef BT_USE_PROC #include <linux/bluetooth/bt_proc.h> |
|
From: Mattias ?g. <mat...@us...> - 2001-02-27 17:08:00
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.127 1.128=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added generic wait queue timer which wakes up a blocking call if there=20 is no response. * added call to start_wq_timer before going to sleep in bt_connect and bt_disconnect * added bt_disconnect_cfm * added debug for reset pins * removed some debug * minor changes |
|
From: Olov H. <ol...@us...> - 2001-03-02 15:36:33
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.130 1.131=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added initiation of LED timer The diff of the modified file(s): --- bluetooth.c 2001/03/01 00:31:05 1.130 +++ bluetooth.c 2001/03/02 15:37:49 1.131 @@ -2211,6 +2211,7 @@ =20 #ifdef __CRIS__ /* start led timer */ + init_timer(&bt_clear_led_timer); bt_clear_led_timer.function =3D &bt_clear_led; bt_clear_led_timer.expires =3D jiffies + 10; add_timer(&bt_clear_led_timer); |
|
From: Peter K. <pk...@us...> - 2001-03-04 15:53:40
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.132 1.133=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Corrected the indentation and cleaned up some of the code.
The diff of the modified file(s):
--- bluetooth.c 2001/03/02 21:52:15 1.132
+++ bluetooth.c 2001/03/04 15:55:03 1.133
@@ -110,15 +110,6 @@
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
-#define BT_PORT_0 /* Should be set from Config.in */
-
-#ifdef BT_PORT_0
-#define BT_PORT 0x3F8=20
-#define BT_IRQ 4
-#else
-/* ??? */
-#endif
-
#define BLUETOOTH_TYPE_DATA 1
#define BLUETOOTH_TYPE_DATA_VOICE 2
=20
@@ -131,8 +122,8 @@
=20
#ifdef BT_USEINBUFFER
=20
-/* This buffer is used decrease overruns on serial port. Copies data in in=
terrupt context
- and schedules a task which consumes data at 'safe' time */
+/* This buffer is used decrease overruns on serial port. Copies data in
+ interrupt context and schedules a task which consumes data at 'safe' ti=
me */
=20
#define BT_INBUFFER_SIZE 4000
=20
@@ -163,7 +154,6 @@
static void bt_handle_indata(const __u8 *data, s32 count);
#endif
=20
-
static void bt_init_stack(void);
static s32 bt_ctrl_init(void);
static s32 bt_connect(u8 *bd_addr, u32 con_id);
@@ -189,12 +179,11 @@
/*
* LINUX 2.2.X SPECIFIC CODE
*/
-static ssize_t
-bt_tty_read(struct tty_struct *tty, struct file *file, u8 *buf, size_t nr);
+static ssize_t bt_tty_read(struct tty_struct *tty, struct file *file,
+ u8 *buf, size_t nr);
=20
-static ssize_t
-bt_tty_write(struct tty_struct *tty, struct file *file, const u8 *buf,
- size_t nr);
+static ssize_t bt_tty_write(struct tty_struct *tty, struct file *file,
+ const u8 *buf, size_t nr);
=20
static u32 bt_tty_poll(struct tty_struct *tty, struct file *file,
struct poll_table_struct *wait);
@@ -367,8 +356,6 @@
=20
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20
=20
-
-
*/
=20
=20
@@ -379,11 +366,9 @@
static s32
bt_open(struct tty_struct *tty, struct file * filp)
{
- s32 line;
+ s32 line =3D GET_TTYLINE(tty);
s32 ret_val;
=20=09
- line =3D GET_TTYLINE(tty);
-
BT_DRIVER("bt_open on line %d\n", line);=09
=20=09
ret_val =3D bt_register_tty(tty) ;
@@ -400,9 +385,7 @@
static void
bt_close(struct tty_struct *tty, struct file * filp)
{
- s32 line;
-
- line =3D GET_TTYLINE(tty);
+ s32 line =3D GET_TTYLINE(tty);
=20
BT_DRIVER("bt_close on line %d \n", line);
=20
@@ -415,15 +398,11 @@
MOD_DEC_USE_COUNT;
}
=20
-=20
-
static void
bt_put_char(struct tty_struct *tty, u8 ch)
{
- u8 c;
- c =3D ch;
- BT_DRIVER("bt_put_char %c\n", c);
- bt_write_top(tty, 0, &c, 1);
+ BT_DRIVER("bt_put_char %c\n", ch);
+ bt_write_top(tty, 0, &ch, 1);
}
=20
static void
@@ -438,8 +417,8 @@
static s32=20
bt_write_room(struct tty_struct *tty)
{
- s32 n;
- n=3Dbuf_write_room();
+ s32 n =3D buf_write_room();
+
BT_DRIVER("bt_write_room : %d\n", n);
return n;
}
@@ -447,19 +426,19 @@
static s32
bt_chars_in_buffer(struct tty_struct *tty)
{
- u16 n;
- n=3Dbuf_byte_count();
+ u16 n =3D buf_byte_count();
+
BT_DRIVER("bt_chars_in_buffer : %d\n", n);=20=20
return n;
}
=20
-
/* Must flush the buffer, otherwise chars_in_buffer returns nonzero
and pppd hangs on the exit while doing the set line disc ioctl */
static void
bt_flush_buffer(struct tty_struct *tty)
{
bt_tx_buf* tx_buf;
+
BT_DRIVER("bt_flush_buffer\n");
=20=09
while((tx_buf =3D get_bt_buf())){
@@ -509,39 +488,34 @@
}
=20=09
switch (cmd) {
-
case BT_SDP_REQUEST:
{
bt_sdp_request sdpRequest;
int returnValue =3D -1;
=20
- /*---------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
/* 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. */
- /*---------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
BT_DRIVER(FNC"Executing bt_execute_sdp_request\n");
=20=20=20=20=20=20=20
- if ( (returnValue =3D bt_execute_sdp_request(&sdpRequest)) >=3D 0 )
- {
- /*---------------------------------------------------------*/
+ if ((returnValue =3D bt_execute_sdp_request(&sdpRequest)) >=3D 0) {
+ /*---------------------------------------------------*/
/* 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
@@ -559,7 +533,6 @@
return bt_disconnect(con_id);
}
=20
-
case BTWAITFORCONNECTION:
{
s32 line;
@@ -590,10 +563,7 @@
{
s32 line;=09=20=20
copy_from_user(&line, (s32*)arg, size);
- if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED)
- return 1;
- else
- return 0;
+ return (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED);
}
=20=09
case BTSETSPEED:
@@ -892,8 +862,7 @@
=20
case HCIREAD_AUTHENTICATION_ENABLE:
{
- s32 result;
- result =3D hci_read_authentication_enable();
+ s32 result =3D hci_read_authentication_enable();
put_user(result, (s32*)arg);
break;
}
@@ -913,8 +882,7 @@
=20=09=09
case HCIREAD_ENCRYPTION_MODE:
{
- s32 result=3D0;
- result =3D hci_read_encryption_mode();
+ s32 result =3D hci_read_encryption_mode();
put_user(result, (s32*)arg);
break;
}
@@ -948,6 +916,7 @@
BT_DRIVER(FNC"HCIREADLOCALBDADDR\n");
=20=09=09
hci_read_local_bd(bd_addr);
+
{
BD_ADDR rev_bd;
u16 i;
@@ -1151,7 +1120,6 @@
}
#endif
=20
-
static s32
bt_tty_open (struct tty_struct *tty)
{
@@ -1223,8 +1191,7 @@
{
#define FNC "bt_write_lower_driver: "
=20
- if (len < 0) /* (!) */
- {
+ if (len < 0) { /* (!) */
D_ERR("Can't write neg length...\n");
return 0;
}
@@ -1295,27 +1262,22 @@
const u8 *buf, s32 count)
{
#define FNC "bt_write_top"
- s32 line;
+ s32 line =3D GET_TTYLINE(tty);
s32 bytes_sent;
u32 rfcomm_conid;
struct bt_session *bt;
=20=09
-=09
- line =3D GET_TTYLINE(tty);
-
BT_DATA(" |X|<-- %3d [%d]\n", count, line);
=20
bt =3D (bt_session *)tty->driver_data;
=20=09
- if ((bt->rfcomm !=3D NULL) && (bt->rfcomm->magic !=3D RFCOMM_MAGIC))
- {
+ if ((bt->rfcomm !=3D NULL) && (bt->rfcomm->magic !=3D RFCOMM_MAGIC)) {
D_ERR(FNC": rfcomm magic failed (0x%x !=3D 0x%x)\n",=20
bt->rfcomm->magic, RFCOMM_MAGIC);
return 0;
}
=20
- if (SESSIONSTATE(line) !=3D BT_ACTIVE)
- {
+ if (SESSIONSTATE(line) !=3D BT_ACTIVE) {
D_WARN("bt_write_top : line %d is not in active state\n",
line);
return 0;
@@ -1421,8 +1383,7 @@
}
=20
/* found an active */
- BT_DATA("bt_feedstack : wakeup line %d !\n",=20
- 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
@@ -1431,8 +1392,8 @@
return;
}
=20=09
- if ((upper_tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
- && upper_tty->ldisc.write_wakeup) {
+ if ((upper_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
+ upper_tty->ldisc.write_wakeup) {
BT_DATA(" |X|<<*** [%d]\n", check_line);
=20=09=09
/* TTY_DO_WRITE_WAKEUP bit is cleared in=20
@@ -1440,8 +1401,7 @@
will be able to write more data */
=20
(upper_tty->ldisc.write_wakeup)(upper_tty);
- }
- else if (!upper_tty->ldisc.write_wakeup) {=20=20=20=20=20
+ } 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);
@@ -1474,9 +1434,7 @@
/* check for overruns... */
if ( hci_data.put + count - BT_INBUFFER_SIZE >=3D hci_data.get ) {
D_ERR("bt_handle_indata : buffer overrun!\n");
- }
- else
- {
+ } else {
/* Calculate how much space there is left at the end=20
of the buffer */
free =3D hci_data.tail - hci_data.put + 1;
@@ -1484,21 +1442,18 @@
/* normal case, data fits in buffer */
if ( count < free ) {
memcpy(hci_data.put, (u8*)data, count);
- }
+ } else {
/* wrap buffer */
- else {
memcpy(hci_data.put, (u8*)data, free);
memcpy(hci_data.head, (u8*)(data + free), count - free);=20=20=20=20
}
- }
}
- else {=20
+ } else {=20
/* hci_data.put < hci_data.get */
/* check for overruns ... */
if ( hci_data.put + count >=3D hci_data.get ) {
D_ERR("bt_handle_indata: buffer overrun!\n");
- }
- else {
+ } else {
/* Copy the data to the buffer */
memcpy(hci_data.put, (u8*)data, count);
}
@@ -1520,8 +1475,7 @@
if ( hci_data.get =3D=3D hci_data.put ) {
sti();
return;
- }
- else if ( hci_data.get > hci_data.put ) {
+ } else if (hci_data.get > hci_data.put) {
/* buffer is wrapped */
size_end =3D hci_data.tail - hci_data.get + 1;
size_start =3D hci_data.put - hci_data.head;
@@ -1598,51 +1552,48 @@
int sdp_connection_id =3D -1;
int return_value;
=20
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
/* Get the line to use for SDP communication. =
*/
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
line =3D GET_SDPLINE(con_id);
=20=20=20=20=20=20=20
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
/* 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", GET_SDPLINE(con_id));=20
+ /*-----------------------------------------------------------*/
+ if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) ||
+ (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) {
+ D_WARN("already got connection on line %d\n",
+ GET_SDPLINE(con_id));=20
return -1;
}=20
=20
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
/* Initiate the connection. =
*/
- /*------------------------------------------------------------------=
----*/
+ /*-----------------------------------------------------------*/
BT_DRIVER(FNC"Connecting SDP on line %d\n", line);
PRINTPKT("Remote BD : ", bd_addr, 6);
- if ( (sdp_connection_id =3D sdp_connect_req(bd_addr, line)) >=3D 0 )
- {
- /*---------------------------------------------------------------=
--------*/
- /* If here, we've successfully created a SDP connection entry and=
are */
- /* starting the sequence of opening a l2cap connection. =
*/
- /* Allow the bottom half to process the request and get back to u=
s. */
- /*---------------------------------------------------------------=
--------*/
+ 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. */
+ /*---------------------------------------------------*/
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_connec=
tion_id */
- /*---------------------------------------------------------------=
--------*/
+ /*---------------------------------------------------*/
+ /* 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 */
+ /*---------------------------------------------------*/
BT_DRIVER(FNC"Wake up - line %d\n", line);
- if ( bt_ctrl.session[line].connect_status >=3D 0 )
- {
+ if (bt_ctrl.session[line].connect_status >=3D 0) {
return_value =3D sdp_connection_id;
- }
- else
- {
+ } else {
return_value =3D bt_ctrl.session[line].connect_status;
- }
}
- else
- {
+ } else {
return_value =3D sdp_connection_id;
}
=20
@@ -1652,6 +1603,7 @@
=20
default:=20=20=20=20
BT_DRIVER(FNC"PSM %d not supported as client\n", GET_PSM(con_id));
+ break;
}
return -1;
#undef FNC
@@ -1659,56 +1611,50 @@
=20
static s32 bt_execute_sdp_request(bt_sdp_request *sdpRequest)
{
- int line, sdpIndex;
- s32 returnValue =3D -1;
+ int line =3D GET_SDPLINE(sdpRequest->conID);
+ int sdpIndex =3D GET_SDPINDEX(sdpRequest->conID);
=20
- /*-------------------------------------------------------------*/
- /* Initiate the request. */
- /*-------------------------------------------------------------*/
- line =3D GET_SDPLINE(sdpRequest -> conID);
- sdpIndex =3D GET_SDPINDEX(sdpRequest -> conID);
- if ( SESSIONSTATE(line) =3D=3D BT_ACTIVE )
- {
- BT_DRIVER("bt_execute_sdp_request: line %d SDP index %d\n", line, sd=
pIndex);
- if ( sdpStartRequest(sdpIndex, sdpRequest->sdpCommand, sdpRequest->p=
duPayload, sdpRequest->pduLength) > 0 )
- {
+ if (SESSIONSTATE(line) !=3D BT_ACTIVE) {
+ /*-----------------------------------------------------------*/
+ /* 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;
+ }
+
+ BT_DRIVER("bt_execute_sdp_request: line %d SDP index %d\n",
+ line, sdpIndex);
+ if (sdpStartRequest(sdpIndex,
+ sdpRequest->sdpCommand,
+ sdpRequest->pduPayload,
+ sdpRequest->pduLength) < 0)
+ return -1;
+
/*---------------------------------------------------------------=
----*/
/* 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 sdpR=
equest */
- /* and return. =
*/
- /*---------------------------------------------------------------=
-------*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
+ /*-------------------------------------------------------------------*/
+ /* If we're back, there may be data to send back. */
+ /* Copy into sdpRequest and return. */
+ /*-------------------------------------------------------------------*/
+ 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, bt_ctrl.session[line].sdpR=
equestResponseData,=20
+ memcpy(sdpRequest->requestResponse,
+ bt_ctrl.session[line].sdpRequestResponseData,=20
bt_ctrl.session[line].sdpRequestResponseDataLength);
sdpRequest->responseLength =3D bt_ctrl.session[line].sdpReques=
tResponseDataLength;
}
- returnValue =3D 1;
- }
- }
- else
- {
- /*-----------------------------------------------------------*/
- /* SDP connection not active! Don't issue the request. */
- /*-----------------------------------------------------------*/
- BT_DRIVER("bt_execute_sdp_request: line %d does not have an active c=
onnection!\n", line);
- }
-
- return returnValue;
=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",=20
- GET_PSM(con_id));
+ DSYS("Got connect indication on PSM %d\n", GET_PSM(con_id));
}
=20
void
@@ -1722,7 +1668,6 @@
=20=09
switch (psm) {
case RFCOMM_LAYER:
- {=09
BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm));
line =3D GET_RFCOMMLINE(con_id);
CHECK_RFCOMM(con_id);
@@ -1734,30 +1679,28 @@
}
=20
bt_ctrl.session[line].connect_status =3D status;
- BT_DRIVER("bt_connect_cfm, line %d [%s]\n", GET_RFCOMMLINE(con_id), psmn=
ame(psm));
+ 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. */
- /*---------------------------------------------------------------*/
- if ( (line < 0) || (line > BT_NBR_DATAPORTS))
- {
+ /*-----------------------------------------------------------*/
+ 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);
@@ -1765,11 +1708,11 @@
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
wake_up_interruptible(&bt_ctrl.any_wq);
break;
- }
=20=09=09
case TCS_LAYER:
BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm));
break;
+
default:
D_ERR("bt_connect_cfm : unknown layer %d\n", psm);
break;
@@ -1781,8 +1724,7 @@
/*----------------------------------------------------------*/
/* Check the line for validity. */
/*----------------------------------------------------------*/
- if (line > BT_NBR_DATAPORTS)=20
- {
+ if (line > BT_NBR_DATAPORTS) {
D_ERR("bt_connect_cfm on invalid line (%d)\n", line);
return;
}
@@ -1796,8 +1738,7 @@
/*----------------------------------------------------------*/
/* If previous data, deallocate it. */
/*----------------------------------------------------------*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
+ if (bt_ctrl.session[line].sdpRequestResponseData) {
D_WARN("bt_send_sdp_data_received: sdpRequestResponseData set - deal=
locate\n");
kfree(bt_ctrl.session[line].sdpRequestResponseData);
bt_ctrl.session[line].sdpRequestResponseData =3D NULL;
@@ -1808,7 +1749,6 @@
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)
@@ -1832,14 +1772,14 @@
void
bt_disconnect_ind(u32 con_id)=20
{
- DSYS("Got disconnect indication on PSM %d\n",=20
- GET_PSM(con_id));
+ DSYS("Got disconnect indication on PSM %d\n",GET_PSM(con_id));
}
=20
void
bt_disconnect_cfm(u32 con_id, s32 status)=20
{
u32 line =3D GET_RFCOMMLINE(con_id);
+
DSYS("Got disconnect confirm on PSM %d status %d\n",=20
GET_PSM(con_id), status);
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
@@ -1887,7 +1827,6 @@
}
#endif
=20
-
/**********************************/
/* Bluetooth Stack Initialization */
/**********************************/
@@ -1899,7 +1838,6 @@
s32 status;
s32 procfs_status =3D -1;
=20=09
-
show_bt_version();
=20
/* Initialize the tty_driver structure */
@@ -1985,17 +1923,19 @@
sertty =3D NULL;
=20
#ifdef BT_USE_PROC
-
DSYS("Registering BT proc files\n");
=20=20
#ifdef KERNEL_VERSION /* Not defined for kernel 2.0.x */
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(bt_status.name, bt_status.mode, &proc_root,=
bt_status.get_info) )
+ if (create_proc_info_entry(bt_status.name,
+ bt_status.mode,
+ &proc_root,
+ bt_status.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &bt_status);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &bt_status);
@@ -2014,10 +1954,13 @@
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(bt_internal_info.name, bt_internal_info.mod=
e, &proc_root, bt_internal_info.get_info) )
+ if (create_proc_info_entry(bt_internal_info.name,
+ bt_internal_info.mode,
+ &proc_root,
+ bt_internal_info.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &bt_internal_info);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &bt_internal_info);
@@ -2036,18 +1979,19 @@
{
struct proc_dir_entry *entry;
procfs_status =3D -1;
- if ( (entry =3D create_proc_entry(sdp_proc_entry.name, sdp_proc_entry.m=
ode, &proc_root)) )
- {
- /*------------------------------------------------------------*/
- /* If the proc entry was registered successfully, then set */
- /* all the necessary structure information. */
- /*------------------------------------------------------------*/
+ if ((entry =3D create_proc_entry(sdp_proc_entry.name,
+ sdp_proc_entry.mode,
+ &proc_root))) {
+ /*---------------------------------------------------*/
+ /* If the proc entry was registered successfully, */
+ /* then set all the necessary structure information. */
+ /*---------------------------------------------------*/
entry->proc_iops =3D sdp_proc_entry.proc_iops;
entry->proc_fops =3D sdp_proc_entry.proc_fops;
procfs_status =3D 1;
}
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &sdp_proc_entry);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &sdp_proc_entry);
@@ -2067,19 +2011,20 @@
{
struct proc_dir_entry *entry;
procfs_status =3D -1;
- if ( (entry =3D create_proc_entry(sec_man_proc_entry.name, sec_man_proc=
_entry.mode, &proc_root)) )
- {
- /*------------------------------------------------------------*/
- /* If the proc entry was registered successfully, then set */
- /* all the necessary structure information. */
- /*------------------------------------------------------------*/
+ if ((entry =3D create_proc_entry(sec_man_proc_entry.name,
+ sec_man_proc_entry.mode,
+ &proc_root))) {
+ /*---------------------------------------------------*/
+ /* If the proc entry was registered successfully, */
+ /* then set all the necessary structure information. */
+ /*---------------------------------------------------*/
entry->proc_iops =3D sec_man_proc_entry.proc_iops;
entry->proc_fops =3D sec_man_proc_entry.proc_fops;
entry->get_info =3D sec_man_proc_entry.get_info;
procfs_status =3D 1;
}
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &sec_man_proc_entry);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &sec_man_proc_entry);
@@ -2098,10 +2043,13 @@
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(bt_proc_doit.name, bt_proc_doit.mode, &proc=
_root, bt_proc_doit.get_info) )
+ if (create_proc_info_entry(bt_proc_doit.name,
+ bt_proc_doit.mode,
+ &proc_root,
+ bt_proc_doit.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &bt_proc_doit);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &bt_proc_doit);
@@ -2121,10 +2069,13 @@
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
- if ( create_proc_info_entry(tci_proc_entry.name, tci_proc_entry.mode, &=
proc_root, tci_proc_entry.get_info) )
+ if (create_proc_info_entry(tci_proc_entry.name,
+ tci_proc_entry.mode,
+ &proc_root,
+ tci_proc_entry.get_info))
procfs_status =3D 1;
}
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) && (LINUX_VERSION_CODE =
> KERNEL_VERSION(2,2,0))
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
procfs_status =3D proc_register(&proc_root, &tci_proc_entry);
#else
procfs_status =3D proc_register_dynamic(&proc_root, &tci_proc_entry);
@@ -2162,7 +2113,6 @@
return bt_stack_initiated;
}
=20
-
void
bt_init_stack()
{
@@ -2233,8 +2183,7 @@
if ((line!=3Dtty_linebuf.line) && (tty_linebuf.line!=3DTTY_NOLINE)) {
D_ERR("Line %d not active and linebuf busy, silent discard...\n", line);
return;
- }
- else if (tty_linebuf.line =3D=3D TTY_NOLINE)
+ } else if (tty_linebuf.line =3D=3D TTY_NOLINE)
tty_linebuf.line =3D line;
=20
/* is there room for data ? */
@@ -2263,8 +2212,7 @@
NULL, tty_linebuf.cur_len);=20=20
=20
bt_reset_linebuf();
- }
- else
+ } else
DSYS("bt_linebuf_empty : no data sent\n");
}
#endif /* BT_USELINEBUF */
@@ -2329,7 +2277,6 @@
}
}
=20
-
s32 bt_sprintf_status(u8 *buf)
{
s32 pos =3D 0;
@@ -2363,17 +2310,13 @@
s32
bt_register_rfcomm(struct rfcomm_con *rfcomm, u8 dlci)
{
- s32 line;
+ s32 line =3D rfcomm->line;
s32 found =3D -1;
=20
- line =3D rfcomm->line;
-=09
if ((SESSIONSTATE(line) =3D=3D BT_INACTIVE) ||=20
- (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED))=20
- {
+ (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED)) {
/* now register ! */
- DSYS("bt_register_rfcomm : dlci %d on line %d\n",=20
- dlci, line);
+ DSYS("bt_register_rfcomm : dlci %d on line %d\n", dlci, line);
=20=09=09
bt_ctrl.session[line].rfcomm =3D rfcomm;=20
bt_ctrl.session[line].dlci =3D dlci;
@@ -2397,8 +2340,7 @@
{
s32 found =3D 0;
=20
- if (!bt_stack_initiated)
- {
+ if (!bt_stack_initiated) {
D_WARN("bt_register_sdp : Bluetooth stack not initialized\n");
return -1;=09
}
@@ -2406,13 +2348,11 @@
/*-------------------------------------------------------------*/
/* Better not have any sdp data pending for this connection */
/*-------------------------------------------------------------*/
- if ( bt_ctrl.session[line].sdpRequestResponseData )
- {
+ if (bt_ctrl.session[line].sdpRequestResponseData) {
D_WARN("bt_register_sdp: Pending SDP data for this new connection @ =
line %d\n", line);
}
=20
- if ( SESSIONSTATE(line) =3D=3D BT_INACTIVE )
- {
+ if (SESSIONSTATE(line) =3D=3D BT_INACTIVE) {
/* now register ! */
DSYS("bt_register_sdp : line %d\n", line);
SESSIONSTATE(line) =3D BT_ACTIVE;
@@ -2441,11 +2381,9 @@
BT_DRIVER("Upper tty still open...\n");
SESSIONSTATE(line) =3D BT_UPPERCONNECTED;
NBR_ACTIVE--;
- }
- else if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) {
+ } else if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) {
bt_reset_session(line);
- }
- else {
+ } else {
D_WARN("bt_unregister_rfcomm : inactive session\n");
return -1;
}
@@ -2456,26 +2394,24 @@
{
BT_DRIVER("bt_unregister_sdp : line %d\n", line);=09
=20
- if (!bt_stack_initiated)
- {
+ if (!bt_stack_initiated) {
D_WARN("bt_unregister_sdp : Bluetooth stack not initialized\n");
return -1;=09
}
=20
- /*---------------------------------------------------------------------=
*/
- /* Part of unregistering SDP is to deallocate any sdp request response =
*/
- /* data AND clear length and pointer. =
*/=20
- /*------------------------------------...
[truncated message content] |
|
From: Olov H. <ol...@us...> - 2001-03-07 16:51:11
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.140 1.141=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Rearranged so that debug print is done before write to serial port. Prevent=
s a racing condition.
The diff of the modified file(s):
--- bluetooth.c 2001/03/06 11:04:15 1.140
+++ bluetooth.c 2001/03/07 16:52:52 1.141
@@ -1210,8 +1210,8 @@
return 0;
} else {
bt_flash_led();
- sent =3D sertty->driver.write(sertty, 0, data, len);
PRINTPKT("bt_write_lower_driver :", (u8*)data, len);
+ sent =3D sertty->driver.write(sertty, 0, data, len);
}
=20=09=09
if (sent !=3D len) {
|
|
From: Gordon M. <gm...@us...> - 2001-03-07 18:12:36
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.141 1.142=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--Added __init & __exit to module init & cleanup routines. The code is now =
properly initialized when included as part of a 2.4 kernel.
The diff of the modified file(s):
--- bluetooth.c 2001/03/07 16:52:52 1.141
+++ bluetooth.c 2001/03/07 18:13:48 1.142
@@ -50,6 +50,10 @@
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/timer.h>
+#include <linux/init.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+#include <linux/kcomp.h>
+#endif
=20
#include <linux/bluetooth/bluetooth.h>
#include <linux/bluetooth/btcommon.h>
@@ -1231,6 +1235,7 @@
=20
/*
* Callback function when data is available at the tty driver.
+ * Context: timer task or (less likely) hard interrupt.
*/
=20=20
static void
@@ -1830,8 +1835,11 @@
/* Bluetooth Stack Initialization */
/**********************************/
=20
-s32
-bt_init(void)
+#if defined(MODULE) || defined(__KERNEL__)
+static int __init bt_init(void)
+#else
+s32 bt_init(void)
+#endif
{
static struct tty_ldisc bt_ldisc;
s32 status;
@@ -2536,16 +2544,10 @@
}
=20
/************************ MODULE STUFF ***********************************=
***/
-#ifdef MODULE
-s32
-init_module(void)
-{
- /* FIXME - check if serial module is loaded */
- return bt_init();
-}
+#if defined(MODULE) || defined(__KERNEL__)
=20
-void
-cleanup_module(void)=20
+static void
+__exit bt_exit(void)=20
{
unsigned long flags;
s32 error;
@@ -2591,6 +2593,8 @@
=20=09
DSYS("Bluetooth Driver unregistered\n");
}
+module_init(bt_init);
+module_exit(bt_exit);
#endif /* MODULE */
=20
/****************** END OF FILE bluetooth.c ******************************=
***/
|
|
From: Gordon M. <gm...@us...> - 2001-03-07 18:53:24
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.142 1.143=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--Fixed last changes to work for linux 2.0.x (hopefully...)
The diff of the modified file(s):
--- bluetooth.c 2001/03/07 18:13:48 1.142
+++ bluetooth.c 2001/03/07 18:54:56 1.143
@@ -50,9 +50,15 @@
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/timer.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
+# define module_init(x) int init_module(void) { return x(); }
+# define module_exit(x) void cleanup_module(void) { x(); }
+#else
#include <linux/init.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
#include <linux/kcomp.h>
+# endif
#endif
=20
#include <linux/bluetooth/bluetooth.h>
|
|
From: Gordon M. <gm...@us...> - 2001-03-07 19:33:16
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.143 1.144=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--Added empty __exit and __init defines for linux 2.0.x
The diff of the modified file(s):
--- bluetooth.c 2001/03/07 18:54:56 1.143
+++ bluetooth.c 2001/03/07 19:34:58 1.144
@@ -54,6 +54,8 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
# define module_init(x) int init_module(void) { return x(); }
# define module_exit(x) void cleanup_module(void) { x(); }
+# define __init
+# define __exit
#else
# include <linux/init.h>
# if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
|
|
From: Peter K. <pk...@us...> - 2001-03-08 15:27:36
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.144 1.145=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
module_init() and module_exit() needs to be defined differently
depending on whether this is compiled as a module or not.
The diff of the modified file(s):
--- bluetooth.c 2001/03/07 19:34:58 1.144
+++ bluetooth.c 2001/03/08 15:29:21 1.145
@@ -52,8 +52,13 @@
#include <linux/timer.h>
=20
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
+# ifdef MODULE
# define module_init(x) int init_module(void) { return x(); }
# define module_exit(x) void cleanup_module(void) { x(); }
+# else
+# define module_init(x) int x##_module(void) { return x(); }
+# define module_exit(x) void x##_module(void) { x(); }
+# endif
# define __init
# define __exit
#else
@@ -2552,6 +2557,7 @@
}
=20
/************************ MODULE STUFF ***********************************=
***/
+
#if defined(MODULE) || defined(__KERNEL__)
=20
static void
@@ -2601,8 +2607,10 @@
=20=09
DSYS("Bluetooth Driver unregistered\n");
}
+
module_init(bt_init);
module_exit(bt_exit);
+
#endif /* MODULE */
=20
/****************** END OF FILE bluetooth.c ******************************=
***/
|
|
From: Peter K. <pk...@us...> - 2001-03-13 11:03:46
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.145 1.146=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Corrected verify_area() check in bt_ioctl() (VERIFY_READ and
VERIFY_WRITE were incorrectly exchanged).
The diff of the modified file(s):
--- bluetooth.c 2001/03/08 15:29:21 1.145
+++ bluetooth.c 2001/03/13 11:05:45 1.146
@@ -488,18 +488,18 @@
#endif
=20=20
/* The direction is a bitmask, and VERIFY_WRITE catches R/W transfer.
- 'Type' is user-oriented, while verify_area is kernel-oriented, so
- the concept of "read" and "write" is reversed */
+ 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_READ, (void*)arg, size);
+ err =3D verify_area(VERIFY_WRITE, (void*)arg, size);
if (err) {
- BT_DRIVER("verify_area(VERIFY_READ) error:%d\n", err);
+ BT_DRIVER("verify_area(VERIFY_WRITE) error:%d\n", err);
return err;
}
} else if (_IOC_DIR(cmd) & _IOC_WRITE) {
- err =3D verify_area(VERIFY_WRITE, (void*)arg, size);
+ err =3D verify_area(VERIFY_READ, (void*)arg, size);
if (err) {
- BT_DRIVER("verify_area(VERIFY_WRITE) error:%d\n", err);
+ BT_DRIVER("verify_area(VERIFY_READ) error:%d\n", err);
return err;
}
}
|
|
From: Peter K. <pk...@us...> - 2001-03-14 11:47:51
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.146 1.147=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
A little more debug in bt_hangup().
The diff of the modified file(s):
--- bluetooth.c 2001/03/13 11:05:45 1.146
+++ bluetooth.c 2001/03/14 11:49:54 1.147
@@ -803,6 +803,7 @@
{
s32 result;
u8 param[size];
+
BT_DRIVER(FNC"HCIREADSTOREDLINKKEY\n");
copy_from_user(param, (s32*)arg, size);
=20
@@ -828,6 +829,7 @@
{
s32 result;
u8 param[size];
+
BT_DRIVER(FNC"HCIDELETESTOREDLINKKEY\n");
copy_from_user(param, (s32*)arg, size);
=20
@@ -841,6 +843,7 @@
/* FIXME: If we send the length of the string too, we don't
have to copy all the 248 byte... */
u8 local_name[248];
+
copy_from_user(local_name, (s32*)arg, 248);
hci_change_local_name(local_name);
break;
@@ -1034,7 +1037,8 @@
void
bt_hangup(struct tty_struct *tty)
{
- BT_DRIVER("bt_hangup (nothing done)\n");
+ BT_DRIVER("bt_hangup on line %d (nothing done) pid %d (%s)\n",
+ GET_TTYLINE(tty), current->pid, current->comm);
}
=20
/********************************************/
|
|
From: Gordon M. <gm...@us...> - 2001-03-14 16:21:42
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.147 1.148=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Added Mattias Fuchs patch to compile with CONFIG_BLUETOOTH_USE_INBUFFER u= nder 2.4.x. The diff of the modified file(s): --- bluetooth.c 2001/03/14 11:49:54 1.147 +++ bluetooth.c 2001/03/14 16:23:45 1.148 @@ -68,6 +68,10 @@ # endif #endif =20 +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0) +# include <linux/interrupt.h> +#endif + #include <linux/bluetooth/bluetooth.h> #include <linux/bluetooth/btcommon.h> #include <linux/bluetooth/btmem.h> |
|
From: Peter K. <pk...@us...> - 2001-03-18 14:21:38
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.149 1.150=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Do not do a hangup on ttyBTC when it is closed.
The diff of the modified file(s):
--- bluetooth.c 2001/03/15 16:27:33 1.149
+++ bluetooth.c 2001/03/18 14:23:52 1.150
@@ -1163,7 +1163,7 @@
=20=09
/* Now hangup all active upper tty:s */
=20=09
- while (line < BT_NBR_PORTS)
+ while (line < BT_NBR_DATAPORTS)
{
if ((SESSIONSTATE(line) =3D=3D BT_ACTIVE) ||
(SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED))
@@ -2239,7 +2239,7 @@
pos +=3D sprintf(buf+pos, "\n[BT Interface]\n");
=20=09
/* Data TTY:s */
- for (line =3D 0; line < (BT_NBR_PORTS-1); line++) {
+ for (line =3D 0; line < BT_NBR_DATAPORTS; line++) {
pos +=3D sprintf(buf+pos, "line[%d] state : %s\n", line,
statename(SESSIONSTATE(line)));
}
@@ -2380,7 +2380,7 @@
DSYS("Registering tty on line %d\n", line);
=20=09
/* Allow multiple open for ttyBTC */
- if (line =3D=3D (BT_NBR_PORTS-1)) {
+ if (line =3D=3D BT_NBR_PORTS-BT_NBR_CTRLPORTS) {
NBR_CTRL_FDS++;
=20=09=09
DSYS("Now %d open fd:s for ttyBTC\n",=20
@@ -2423,9 +2423,8 @@
{
DSYS("Unregistering tty on line %d\n", line);
=20
- if (line =3D=3D (BT_NBR_PORTS-1)) {
- NBR_CTRL_FDS--;
- if (NBR_CTRL_FDS !=3D 0)
+ if (line =3D=3D BT_NBR_PORTS-BT_NBR_CTRLPORTS) {
+ if (--NBR_CTRL_FDS !=3D 0)
return 0; /* still more open fd:s on ttyBTC */
}
=20
|
|
From: Olov H. <ol...@us...> - 2001-03-19 12:35:25
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.150 1.151=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added a function call in order to tell that stack is going down The diff of the modified file(s): --- bluetooth.c 2001/03/18 14:23:52 1.150 +++ bluetooth.c 2001/03/19 12:37:42 1.151 @@ -2473,7 +2473,9 @@ bt->rfcomm =3D NULL; } } - +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER + sec_client_shutdown(); /* Inform that stack is getting closed */ +#endif rfcomm_close(); sdp_shutdown(); tcs_shutdown(); |
|
From: Peter K. <pk...@us...> - 2001-03-19 16:58:11
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.151 1.152=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Always use HZ when setting times relative to jiffies.
The diff of the modified file(s):
--- bluetooth.c 2001/03/19 12:37:42 1.151
+++ bluetooth.c 2001/03/19 17:00:26 1.152
@@ -161,7 +161,8 @@
/****************** LOCAL FUNCTION DECLARATION SECTION *******************=
***/
=20
#ifdef __CRIS__
-#define BT_FLASH_LED_TIME 2 /* jiffies */
+#define BT_FLASH_LED_TIME (HZ/50) /* 20 ms */
+
static struct timer_list bt_clear_led_timer;
static int bt_led_clear_time;
static void bt_clear_led(unsigned long dummy);
@@ -281,7 +282,7 @@
static tty_linebuffer tty_linebuf;
=20
static struct timer_list bt_timer;
-#define BT_CON_TIMEOUT 700 /* jiffies */
+#define BT_CON_TIMEOUT (7*HZ)
=20
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
@@ -1836,7 +1837,7 @@
{
if (jiffies > bt_led_clear_time)
LED_ACTIVE_SET(0);
- bt_clear_led_timer.expires =3D jiffies + 10;
+ bt_clear_led_timer.expires =3D jiffies + HZ/10;
add_timer(&bt_clear_led_timer);
}
=20
@@ -2116,7 +2117,7 @@
/* start led timer */
init_timer(&bt_clear_led_timer);
bt_clear_led_timer.function =3D &bt_clear_led;
- bt_clear_led_timer.expires =3D jiffies + 10;
+ bt_clear_led_timer.expires =3D jiffies + HZ/10;
add_timer(&bt_clear_led_timer);
#endif
}
@@ -2473,9 +2474,11 @@
bt->rfcomm =3D NULL;
}
}
+
#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
sec_client_shutdown(); /* Inform that stack is getting closed */
#endif
+
rfcomm_close();
sdp_shutdown();
tcs_shutdown();
|
|
From: Gordon M. <gm...@us...> - 2001-03-19 22:52:36
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.152 1.153=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--Some of the proc registration wasn't bracketed in CONFIG_BLUEOOTH_USE_PROC
The diff of the modified file(s):
--- bluetooth.c 2001/03/19 17:00:26 1.152
+++ bluetooth.c 2001/03/19 22:54:55 1.153
@@ -2016,7 +2016,6 @@
D_ERR("Couldn't register proc file bt_status %d\n",=20
procfs_status);
}
-#endif /* CONFIG_BLUETOOTH_PROC */
=20
#ifdef CONFIG_BLUETOOTH_USE_TCI
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
@@ -2041,6 +2040,9 @@
#endif /* CONFIG_BLUETOOTH_USE_TCI */
=20=09
sdp_create_proc_file();
+
+#endif /* CONFIG_BLUETOOTH_PROC */
+
=20
#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
sec_man_create_proc_file();
|
|
From: Gordon M. <gm...@us...> - 2001-03-20 15:27:29
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.153 1.154=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--Undid previous change, so we once again do some proc registration even if=
CONFIG_BLUETOOTH_USE_PROC is undefined.
The diff of the modified file(s):
--- bluetooth.c 2001/03/19 22:54:55 1.153
+++ bluetooth.c 2001/03/20 15:29:49 1.154
@@ -2017,6 +2017,8 @@
procfs_status);
}
=20
+#endif /* CONFIG_BLUETOOTH_PROC */
+
#ifdef CONFIG_BLUETOOTH_USE_TCI
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
@@ -2040,8 +2042,6 @@
#endif /* CONFIG_BLUETOOTH_USE_TCI */
=20=09
sdp_create_proc_file();
-
-#endif /* CONFIG_BLUETOOTH_PROC */
=20
=20
#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
|
|
From: Gordon M. <gm...@us...> - 2001-03-21 23:22:59
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.154.2.1 1.154.2.2=20=20=20=20=20=20=20
The accompanying log:
--Needed to reverse the LAP bytes.
The diff of the modified file(s):
--- bluetooth.c 2001/03/20 16:42:53 1.154.2.1
+++ bluetooth.c 2001/03/21 23:22:31 1.154.2.2
@@ -716,7 +716,7 @@
=20
// REVISIT The user should specify this...
// --gmcnutt
- u8 lap[3] =3D { 0x9e, 0x8b, 0x33 };
+ u8 lap[3] =3D { 0x33, 0x8b, 0x9e };
u8 num_resp;
int ret;
=20=09=09
@@ -2686,7 +2686,7 @@
#include <linux/types.h>
=20
#define INIT_BAUD B57600
-#define FINAL_BAUD B115200
+#define FINAL_BAUD B57600
#define SERIAL "/dev/ttyS1"
=20
#ifdef __KERNEL__
@@ -2718,7 +2718,7 @@
printk(__FUNCTION__":open '%s' failed\n", SERIAL);
return ser_fd;
}
-
+#if 0
if ((ret =3D ioctl(ser_fd, TCGETA, (unsigned long) &t)) < 0) {
printk(__FUNCTION__":ioctl TCGETA failed\n");
goto exit;
@@ -2736,7 +2736,7 @@
printk(__FUNCTION__":ioctl TCSETA failed\n");
goto exit;
}
-
+#endif
if ((ret =3D ioctl(ser_fd, TIOCSETD, (unsigned long)&bt_ldisc)) < 0) {
printk(__FUNCTION__":ioctl TIOCSETD failed\n");
goto exit;
@@ -2853,9 +2853,9 @@
=20
if ((ret =3D do_initial_serial_port_setup()) < 0) goto exit;
if ((ret =3D initialize_bluetooth_stack()) < 0) goto exit;
- if ((ret =3D do_final_serial_port_setup()) < 0) goto exit;
+// if ((ret =3D do_final_serial_port_setup()) < 0) goto exit;
if ((ret =3D check_bluetooth_address()) < 0) goto exit;
- if ((ret =3D look_for_other_bluetooth_devices()) < 0) goto exit;
+// if ((ret =3D look_for_other_bluetooth_devices()) < 0) goto exit;
=20
/*
* At this point we can either spawn ppp and wait, or we might be
|
|
From: Gordon M. <gm...@us...> - 2001-03-24 19:37:18
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.154.2.2 1.154.2.3=20=20=20=20=20=20=20 The accompanying log: --Fixed a bug in bluetooth.c. Copying the wrong size data back to the use f= or an HCI Inquiry. The diff of the modified file(s): --- bluetooth.c 2001/03/21 23:22:31 1.154.2.2 +++ bluetooth.c 2001/03/24 19:37:17 1.154.2.3 @@ -735,7 +735,7 @@ inq_res)) < 0) goto end_inquiry; =20 - copy_to_user((s32*)arg, inq_res, size + 6 *=20 + copy_to_user((s32*)arg, inq_res, sizeof(inquiry_results) + 6 *=20 inq_res->nbr_of_units); end_inquiry: kfree(inq_res); |
|
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 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-31 15:51:28
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.158 1.159=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
added show_bt_vendor during init which shows the configured BT vendor
The diff of the modified file(s):
--- bluetooth.c 2001/03/30 11:00:41 1.158
+++ bluetooth.c 2001/03/31 15:51:26 1.159
@@ -2195,6 +2195,8 @@
/* Initialise all layers in the bluetooth stack */
=20=09
DSYS("Initialising Bluetooth Stack\n");
+
+ show_bt_vendor();
hci_init();
l2cap_init();
=20
|