|
From: Anders J. <and...@us...> - 2003-01-13 19:49:08
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.55 1.56=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.38 1.39=20=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.41 1.42=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added support to get class of device.
The diff of the modified file(s):
--- bt_if.c 19 Nov 2002 14:15:46 -0000 1.55
+++ bt_if.c 13 Jan 2003 19:48:07 -0000 1.56
@@ -1141,6 +1141,47 @@
#endif
}
=20
+void=20
+read_remote_class(int bt_cfd, unsigned char *bd_addr, unsigned char *remot=
e_class)
+{
+ int err =3D 0;
+ int i;
+
+ unsigned char result[6];
+=20=20
+ for (i =3D 0; i < 6; i++)
+ {
+ result[i] =3D bd_addr[5-i];
+ }
+#ifndef BT_USERSTACK
+
+ if (ioctl(bt_cfd, BTREADREMOTECLASSOFDEV, result) < 0)
+ {
+ perror(__FUNCTION__);
+ err =3D -1;
+ }
+#else
+ if((con =3D get_con(result, ANY_STATE)))=20
+ {
+ memcpy(result, con->remote_class_of_dev, 3);
+ }=20
+ else=20
+ {
+ err =3D -1;
+ }
+#endif
+ if(err < 0)
+ {
+ memset(remote_class, 0, 3);
+ }=20
+ else=20
+ {
+ remote_class[2] =3D result[0];
+ remote_class[1] =3D result[1];
+ remote_class[0] =3D result[2];
+ }=20=20=20=20=20=20=20
+}
+
void
enable_dut(int bt_cfd)
{
--- bt_if.h 19 Nov 2002 14:21:18 -0000 1.38
+++ bt_if.h 13 Jan 2003 19:48:14 -0000 1.39
@@ -140,6 +140,7 @@
#define BTDISCONNECT_BB _IOW(BT_IOC_MAGIC, 0x11, unsigned char[6])
=20
#define BTREADREMOTENAME _IOWR(BT_IOC_MAGIC, 0x12, unsigned char[BT_NAME_L=
ENGTH])
+#define BTREADREMOTECLASSOFDEV _IOWR(BT_IOC_MAGIC, 0x13, unsigned char[6])
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Ioctls for executing HCI commands */
@@ -358,6 +359,7 @@
void bt_set_bd_addr(int bt_cfd, unsigned char *bd);
void read_local_bd(int bt_cfd, unsigned char *bd_addr);
void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr);
+void read_remote_class(int bt_cfd, unsigned char *bd_addr, unsigned char *=
remote_class);
int read_remote_name(int bt_cfd, int line, unsigned char *name, unsigned i=
nt length);
void role_switch(int bt_cfd, unsigned char *bd_addr, int role);
=20
--- btd.c 22 Nov 2002 16:59:03 -0000 1.41
+++ btd.c 13 Jan 2003 19:48:16 -0000 1.42
@@ -499,6 +499,7 @@
static char remote_bd_addr[18];
static char remote_bd_str[36];
static char local_bd_str[32];
+ static char remote_class_of_dev[27];
static char remote_name[20 + BT_NAME_LENGTH];
struct ip_set *ipset =3D PEER(line).ipset;
int i =3D 0;
@@ -533,6 +534,7 @@
if (ipset->useradius)
{
unsigned char local_bd[6];
+ unsigned char class_of_device[3];
=20
opts[i++] =3D "plugin";
opts[i++] =3D "radius.so";
@@ -578,6 +580,15 @@
=20
opts[i++] =3D "avpair";
opts[i++] =3D remote_bd_str;
+
+ read_remote_class(bt_cfd, PEER(line).remote_bd, class_of_device);
+ sprintf(remote_class_of_dev, "Axis-BT-Client-Type=3D%02x%02x%02x",
+ class_of_device[0],=20
+ class_of_device[1],=20
+ class_of_device[2]);
+
+ opts[i++] =3D "avpair";
+ opts[i++] =3D remote_class_of_dev;
=20
if (*PEER(line).remote_name)
{
|