|
From: Peter K. <pk...@us...> - 2001-06-15 12:30:04
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.182 1.183=20=20=20=20=20=20=20=20=20=20=20
hci.c 1.159 1.160=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added line argument to get_remote_bd() and corresponding ioctl to
retrieve the BD address for a specific line, instead of the last
one connected.
The diff of the modified file(s):
--- bluetooth.c 2001/06/14 10:59:58 1.182
+++ bluetooth.c 2001/06/15 12:30:03 1.183
@@ -628,22 +628,24 @@
break;
=20
case BTREADREMOTEBDADDR:
- BT_DRIVER(FNC"BTREADREMOTEBDADDR\n");
-
- /* FIXME -- add parameter do get remote bd from any
- connected device */
- get_remote_bd(bd_addr);
-
{
BD_ADDR rev_bd;
+ s32 line;=09=20=20
u16 i;
+
+ BT_DRIVER(FNC"BTREADREMOTEBDADDR\n");
+
+ copy_from_user(&line, (s32*)arg, size);
+
+ get_remote_bd(line, bd_addr);
+
/* return as big endian */
for (i =3D 0; i < 6; i++) {
rev_bd[5-i] =3D bd_addr[i];
}
copy_to_user((s32*)arg, rev_bd, 6);
- }
break;
+ }
=20
case BTRESETPHYSICALHW:
bt_reset_phys_hw();
@@ -2429,7 +2431,7 @@
if (!tmp_bt_buf) {
page =3D get_free_page(GFP_KERNEL);
if (!page)
- return;
+ return -ENOMEM;
=20=09=09
if (tmp_bt_buf)
free_page(page);
--- hci.c 2001/06/14 10:52:14 1.159
+++ hci.c 2001/06/15 12:30:03 1.160
@@ -1609,14 +1609,12 @@
memcpy(hci_ctrl.con[i].bd, bd, 6);
hci_ctrl.con[i].con_hdl =3D con_hdl;
hci_ctrl.con[i].state =3D UNIT_ACTIVE;
- hci_ctrl.active_connection =3D i;
return;
}
}
- if (i >=3D MAX_NBR_OF_CONNECTIONS) {
+
D_ERR(__FUNCTION__ ": No free connection object\n");
}
-}
=20
void reset_hci_con_bd(u16 con_hdl)
{
@@ -1630,10 +1628,9 @@
return;
}
}
- if (i >=3D MAX_NBR_OF_CONNECTIONS) {
+
D_ERR(__FUNCTION__ ": Didn't find connection with con_hdl %d\n", con_hdl=
);
}
-}
=20
void
set_hci_con_name(u8 *bd, u8 *name)
@@ -1651,10 +1648,9 @@
return;
}
}
- if (i >=3D MAX_NBR_OF_CONNECTIONS) {
+
D_ERR(__FUNCTION__ ": Didn't fin connecton with BD adress 0x%02x:%02x:%0=
2x:%02x:%02x:%02x\n", bd[5],bd[4],bd[3],bd[2],bd[1],bd[0]);
}
-}
=20
s32 hci_sprint_local_bd(u8 *buf)
{
@@ -1673,7 +1669,6 @@
=20
pos +=3D sprintf(buf + pos, "unit_id unit_bd_address unit_mode unit_name\=
n");
=20
-
/* Then we printout the other connections bd addresses and their user
friendly device names */
for (i =3D 0; i < MAX_NBR_OF_CONNECTIONS; i++) {
@@ -1692,7 +1687,6 @@
}
pos +=3D sprintf(buf + pos, "%s\n", hci_ctrl.con[i].name);
}
-
}
=20=09
return pos;
@@ -3024,17 +3018,13 @@
=20=09
for (i =3D 0 ; i < MAX_NBR_OF_CONNECTIONS ; i ++) {
if (memcmp(hci_ctrl.con[i].bd, bd, 6) =3D=3D 0) {
- break;
+ return hci_ctrl.con[i].con_hdl;
}
}
=20
- if (i >=3D MAX_NBR_OF_CONNECTIONS) {
D_ERR(__FUNCTION__ ": No connection handle found for bd 0x%02x:%02x:%02x=
:%02x:%02x:%02x:\n", bd[5], bd[4], bd[3], bd[2], bd[1], bd[0]);
return -1;
- } else {
- return hci_ctrl.con[i].con_hdl;
}
-}
=20
#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
u8*
@@ -3044,43 +3034,36 @@
=20=20
for (i =3D 0 ; i < MAX_NBR_OF_CONNECTIONS ; i ++) {
if (hci_ctrl.con[i].con_hdl =3D=3D con_hdl) {
- break;
+ return hci_ctrl.con[i].bd;
}
}
=20
- if (i >=3D MAX_NBR_OF_CONNECTIONS) {
D_ERR(__FUNCTION__ ": No BD Address found for connection handle %d\n", c=
on_hdl);
return NULL;
- } else {
- return hci_ctrl.con[i].bd;
- }
}
#endif /* CONFIG_BLUETOOTH_USE_SECURITY_MANAGER */
=20
/*
- * This function will return the value of the active bd address, i.e. the
- * bd address of the last connected client
+ * This function will return the BD address for a specific line
*/
=20
/* Consider changing bd to BD_ADDR */
=20
s32
-get_remote_bd(u8 *bd)
+get_remote_bd(s32 line, u8 *bd)
{
- s32 active =3D hci_ctrl.active_connection;
-
D_CMD(__FUNCTION__ "\n");
=20
memset(bd, 0, 6);
=20
- if (active >=3D 0 && active < MAX_NBR_OF_CONNECTIONS) {
- memcpy(bd, hci_ctrl.con[active].bd, 6);
+ if (line >=3D 0 && line < MAX_NBR_OF_CONNECTIONS) {
+ memcpy(bd, hci_ctrl.con[line].bd, 6);
DSYS(__FUNCTION__": %02x:%02x:%02x:%02x:%02x:%02x\n",
bd[5], bd[4], bd[3], bd[2], bd[1], bd[0]);
return 0;
} else {
/* No connection yet */
- D_WARN("get_remote_bd : No active connection!\n");
+ D_WARN(__FUNCTION__ ": Unknown line: %d!\n", line);
return -1;
}
}
|