|
From: Anders J. <and...@us...> - 2003-11-05 21:27:40
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.240 1.241=20=20=20=20=20=20=20=20=20=20=20=20=
=20
bnep.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20
bnep_status_proc.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20
The accompanying log:
Made it possible to specify source and target role for bnep connect.
The diff of the modified file(s):
--- bluetooth.c 2003/11/05 15:21:58 1.240
+++ bluetooth.c 2003/11/05 17:03:14 1.241
@@ -1548,7 +1548,8 @@ hci_inq_exit0:
BT_DRIVER("Using src UUID 0x%04x and dst UUID 0x%04x\n", btcon.bnep_src_=
uuid,
btcon.bnep_dst_uuid);
=20=09=09
- tmp =3D bnep_connect_req(btcon.bd, &btcon.pincode);
+ tmp =3D bnep_connect_req(btcon.bd, &btcon.pincode, btcon.bnep_src_uuid,=
=20
+ btcon.bnep_dst_uuid);
=20
result[0] =3D (tmp>>8)&0x0ff; // conn hdl
result[1] =3D (tmp>>16)&0x0ff; // conn hdl
--- bnep.c 2003/11/05 15:21:58 1.19
+++ bnep.c 2003/11/05 17:03:14 1.20
@@ -114,11 +114,15 @@
#define BNEP_INTERFACES 7
#define MAX_EHEADERS 20
=20
+#define DEFAULT_ROLE UUID_NAP
+
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
static s32 result_param_bnep;
+static u16 role =3D 0;
+static u16 remote_role =3D 0;
=20
/*************************** UPF TEST VARS *******************************=
***/
extern int dont_send_reply;
@@ -299,6 +303,8 @@ bnep_init_interface(struct net_device *d
=20=09
local->state =3D DISCONNECTED;
local->magic =3D BNEP_MAGIC_NUMBER;
+ local->role =3D DEFAULT_ROLE;
+ local->remote_role =3D 0;
=20=09
dev->irq =3D 0;
dev->dma =3D 1;
@@ -1068,6 +1074,7 @@ bnep_control(l2cap_con *l2cap, u8 *data,
source_uuid =3D be16_to_cpu(*(u16*)&data[src_pos + uuid_length]);
D_MISC("UUID length: %x, dest uuid: %02lx, source uuid: %02lx\n",
data[0], destination_uuid, source_uuid);
+ local->remote_role =3D source_uuid;
/* Lets compare destination uuid, dont care about source uuid */
if (destination_uuid =3D=3D UUID_NAP || destination_uuid =3D=3D UUID_GN=
) {=09
D_MISC("uuids are matching, enter connected state\n");
@@ -1418,6 +1425,7 @@ bnep_connect_ind(l2cap_con *l2cap)=20
result_param_bnep =3D ((l2cap->hci_hdl<<8)&0x0ffff00) + ((i<<24)&0=
xff000000);
local->state =3D BNEP_CONFIG;
local->initiator =3D 0;
+ local->role =3D DEFAULT_ROLE;
l2cap->upper_con =3D (void *)&dev_bnep[i];
=20
result_param_bnep &=3D 0xffffff00;
@@ -1453,6 +1461,8 @@ bnep_connect_cfm(l2cap_con *l2cap, s32 s
local->l2cap =3D l2cap;
local->state =3D BNEP_CONFIG;
local->initiator =3D 1;
+ local->role =3D role;
+ local->remote_role =3D remote_role;
l2cap->upper_con =3D (void *)&dev_bnep[i];
break;
}=20
@@ -1600,10 +1610,12 @@ bnep_setup_connection(struct net_local *
}
=20
u32
-bnep_connect_req(u8 *bd_addr, bt_pincode *pincode)=20
+bnep_connect_req(u8 *bd_addr, bt_pincode *pincode, u16 src_role, u16 dst_r=
ole)=20
{
DSYS("BNEP: Connect request %02x:%02x:%02x:%02x:%02x:%02x\n",
bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5]);
+ role =3D src_role;
+ remote_role =3D dst_role;
=20=09
if (l2ca_connect_req(bd_addr, BNEP_LAYER, pincode)) {
D_ERR(__FUNCTION__": l2ca_connect_req failed\n");
--- bnep_status_proc.c 2003/01/22 13:33:49 1.3
+++ bnep_status_proc.c 2003/11/05 17:03:14 1.4
@@ -117,6 +117,12 @@
static s32
bnep_status_proc_read(char *buf, char **start, off_t offset, int len);
=20
+static u8 *
+bnep_statetostr(int state);
+
+static u8 *
+bnep_roletostr(int role);
+
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
#ifdef __KERNEL__
@@ -201,23 +207,7 @@ int bnep_status_proc_read(char *buf, int
local =3D dev_bnep[i].priv;
if (local->state !=3D DISCONNECTED) {
len +=3D sprintf(buf + len,"%s State =3D ",dev_bnep[i].name);
- switch (local->state) {
- case DISCONNECTED:
- len +=3D sprintf(buf + len, "DISCONNECTED ");
- break;
- case BNEP_CONFIG:
- len +=3D sprintf(buf + len, "CONFIG ");
- break;
- case SETUP:
- len +=3D sprintf(buf + len, "SETUP ");
- break;
- case CONNECTED:
- len +=3D sprintf(buf + len, "CONNECTED ");
- break;
- default:
- len +=3D sprintf(buf + len, "UNKNOWN ");
- }
-=09=09=09
+ len +=3D sprintf(buf + len, "%s", bnep_statetostr(local->state));
if (local->l2cap !=3D NULL) {
len +=3D sprintf(buf +len," Remote BD %02x:%02x:%02x:%02x:%02x:%02x",
local->l2cap->remote_bd[5],local->l2cap->remote_bd[4],
@@ -228,6 +218,9 @@ int bnep_status_proc_read(char *buf, int
//...
}
=20=09=09=09
+ len +=3D sprintf(buf + len, " Role: %s Remote role: %s", bnep_roletostr=
(local->role),
+ bnep_roletostr(local->remote_role));
+
len +=3D sprintf(buf + len,=20
"\n Stats: tx_packets %ld tx_bytes %ld tx_dropped %ld "
"rx_packets %ld rx_bytes %ld rx_dropped %ld\n",
@@ -269,4 +262,29 @@ bnep_status_proc_write(struct file *f, c
{
D_PROC(__FUNCTION__ " Someone wrote %d bytes to bnep proc-file\n", count);
return 0;
+}
+
+static u8 *
+bnep_statetostr(int state)
+{
+ switch (state)
+ {
+ case DISCONNECTED: return "DISCONNECTED ";
+ case BNEP_CONFIG: return "CONFIG ";
+ case SETUP: return "SETUP ";
+ case CONNECTED: return "CONNECTED ";
+ default: return "UNKNOWN ";
+ }
+}=09
+
+static u8 *
+bnep_roletostr(int role)
+{
+ switch(role)
+ {
+ case UUID_PANU: return "PANU ";
+ case UUID_NAP: return "NAP ";
+ case UUID_GN: return "GN ";
+ default: return "Unknown ";
+ }
}
|