|
From: Anders J. <and...@us...> - 2002-02-28 20:08:34
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.43 1.44=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.31 1.32=20=20=20=20=20=20=20=20=20=20=20=20
bt_vendor.c 1.31 1.32=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* bt_set_event_filter should now handle any type of filter.
The diff of the modified file(s):
--- bt_if.c 26 Feb 2002 18:08:59 -0000 1.43
+++ bt_if.c 28 Feb 2002 20:08:31 -0000 1.44
@@ -863,18 +863,22 @@
#endif
}
=20
-int bt_set_event_filter(int bt_cfd, unsigned char filter[3])
+int bt_set_event_filter(int bt_cfd, unsigned char *filter, int len)
{
int result;
+ unsigned char tmp[255];
=20
- syslog(LOG_INFO, "Setting event filter [0x%x 0x%x 0x%x]",=20
- filter[0], filter[1], filter[2]);
+ syslog(LOG_INFO, "Setting event filter");
=20
#ifdef BT_USERSTACK
- result =3D hci_set_event_filter((u8*)filter);
+ result =3D hci_set_event_filter((u8*)filter, len);
#else
=20
- if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, filter)) < 0)
+ tmp[0] =3D (len >> 8) & 0xff;
+ tmp[1] =3D len & 0xff;
+ memcpy(&tmp[2], filter, len);
+
+ if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, tmp)) < 0)
{=20
perror(__FUNCTION__);
exit(1);
--- bt_if.h 6 Feb 2002 11:31:56 -0000 1.31
+++ bt_if.h 28 Feb 2002 20:08:31 -0000 1.32
@@ -178,7 +178,7 @@
#define HCIWRITE_AUTHENTICATION_ENABLE _IOWR(BT_IOC_MAGIC, 0x3c, int)
#define HCIREAD_ENCRYPTION_MODE _IOR(BT_IOC_MAGIC, 0x3d, int)
#define HCIWRITE_ENCRYPTION_MODE _IOWR(BT_IOC_MAGIC, 0x3e, int)
-#define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[3])
+#define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[255])
=20
/* Informational Parameters */
=20
@@ -333,7 +333,7 @@
void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr);
void role_switch(int bt_cfd, unsigned char *bd_addr, int role);
=20
-int bt_set_event_filter(int bt_cfd, unsigned char filter[3]);
+int bt_set_event_filter(int bt_cfd, unsigned char *filter, int len);
int bt_write_scan_enable(int bt_cfd, unsigned int flags);
void bt_write_pagescan_activity(int bt_cfd, unsigned int interval,=20
unsigned int wind);
--- bt_vendor.c 16 Oct 2001 15:02:20 -0000 1.31
+++ bt_vendor.c 28 Feb 2002 20:08:31 -0000 1.32
@@ -474,6 +474,7 @@
csr_init_hw(int bt_cfd, int phys_fd, const char *speedstr)
{
/* Connection setup, all devices, no auto accept */
+ unsigned char clear_filter[1] =3D { 0x00 };
unsigned char filter[3] =3D { 0x02, 0x00, 0x01 };
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
int firmware =3D -1;
@@ -491,7 +492,8 @@
=20
bt_write_pagescan_activity(bt_cfd, 0x0800, 0x12);
=20
- bt_set_event_filter(bt_cfd, filter);
+ bt_set_event_filter(bt_cfd, clear_filter, 1);
+ bt_set_event_filter(bt_cfd, filter, 3);
=20
sleep(1);=20=20
=20
@@ -565,7 +567,7 @@
=20
D(syslog(LOG_INFO, "Setting baudrate in Digianswer PC card"));
=20
- bt_set_event_filter(bt_cfd, filter);
+ bt_set_event_filter(bt_cfd, filter, 3);
=20
if (speedstr)
{
@@ -605,7 +607,7 @@
sleep(1);
=20
/* set_event_filter must be called for m/s switch on IrmaC! */
- bt_set_event_filter(bt_cfd, filter);
+ bt_set_event_filter(bt_cfd, filter, 3);
=20
sleep(1); // wait for HW...
=20
@@ -681,7 +683,7 @@
=20
sleep(1);
=20
- bt_set_event_filter(bt_cfd, filter);
+ bt_set_event_filter(bt_cfd, filter, 3);
}
=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=3D*/
@@ -704,7 +706,7 @@
D(syslog(LOG_INFO, "Setting write_scan_enable in generic module"));
=20=20=20
bt_write_scan_enable(bt_cfd, wrscan);
- bt_set_event_filter(bt_cfd, filter);
+ bt_set_event_filter(bt_cfd, filter, 3);
}
=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=3D*/
|