|
From: Mattias A. <mat...@us...> - 2001-03-26 15:33:14
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
added bt_ping (sends l2cap echo requests)
The diff of the modified file(s):
--- bt_if.c 2001/03/21 17:26:44 1.3
+++ bt_if.c 2001/03/26 15:33:13 1.4
@@ -62,7 +62,6 @@
#include "bt_misc.h"
#include "bt_conf.h"
=20
-
int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len)
{
unsigned char buf[261];
@@ -76,7 +75,7 @@
#ifndef BT_USERSTACK=20
if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0)
{
- perror("ecs_testctrl");
+ perror("bt_send_raw_hci");
}
#else
printf("not yet for usermode stack...\n");
@@ -85,6 +84,35 @@
return 0;
}
=20
+int bt_ping(int bt_cfd, unsigned char bd[6],=20
+ unsigned char *data, unsigned short len)
+{
+ unsigned char buf[264];
+ int ret_val;
+=20=20
+ printf("bt_ping\n");
+
+ memcpy(buf, bd, 6);
+ buf[6] =3D len>>8;
+ buf[7] =3D len&0xff;
+ memcpy(buf, data, len);
+
+#ifndef BT_USERSTACK=20
+ if ((ret_val =3D ioctl(bt_cfd, BTPING, buf)) < 0)
+ {
+ printf("Error : %s\n", error_msg(ret_val));
+ }
+ else
+ printf("Success!\n");
+
+#else
+ printf("not yet for usermode stack...\n");
+#endif
+ return 0;=20=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 */
/* Functions common for kernel and usermode stack */
/* =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 */
@@ -382,14 +410,14 @@
{
int result;
=20=20=20
- printf("bt_waitnewconnections\n");
+ syslog(LOG_INFO, "bt_waitnewconnections\n");
#ifndef BT_USERSTACK
if ((result =3D ioctl(bt_fd, BTWAITNEWCONNECTIONS)) < 0)
{
perror("bt_waitnewconnections");
exit(1);
}
- printf("bt_waitnewconnections : got a connection !\n");
+ printf("bt_waitnewconnections : found a connection !\n");
return;
#else
/* fixme<1>*/
--- bt_if.h 2001/03/21 17:29:55 1.2
+++ bt_if.h 2001/03/26 15:33:13 1.3
@@ -191,6 +191,9 @@
/* | len 1 byte | 4 bytes hci header | data (max 256) | */
#define HCISENDRAWDATA _IOW(BT_IOC_MAGIC, 0x72, unsigned char[261])
=20
+/* | BD(6) | len(2) | data(max 256) |*/
+#define BTPING _IOW(BT_IOC_MAGIC, 0x73, unsigned char[264])
+
/* Used to calculate opcode for HCI commands using raw interface */
#define OPCODE_MSB(ocf, ogf) ((ocf) & 0xff)
#define OPCODE_LSB(ocf, ogf) (((ocf) >> 8) | (((ogf) & 0x3f) << 2))
@@ -263,6 +266,9 @@
*/
=20
int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len);
+int bt_ping(int bt_cfd, unsigned char bd[6],=20
+ unsigned char *data, unsigned short len);
+
void bt_inquiry(int bt_cfd, int nbr_rsp, int t);
int bt_set_baudrate(int bt_cfd, int spd);
void bt_set_bd_addr(int bt_cfd, unsigned char *bd);
|