|
From: Anders J. <and...@us...> - 2001-10-15 08:48:55
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.39 1.40=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.27 1.28=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Made bt_inq return a returnvalue.
* Added errormessages.
The diff of the modified file(s):
--- bt_if.c 2001/10/12 14:56:41 1.39
+++ bt_if.c 2001/10/15 08:48:53 1.40
@@ -663,9 +663,10 @@
/* HCI functions */
=20
=20
-void
+int
bt_inquiry(int bt_cfd, int nbr_rsp, int t)
{
+ int retval =3D 0;
#ifdef BTD_USERSTACK
char inq_lap[6];
=20
@@ -675,7 +676,7 @@
inq_lap[1] =3D 0x8b;
inq_lap[2] =3D 0x9e;
=20
- hci_inquiry(inq_lap, t, nbr_rsp);
+ retval =3D hci_inquiry(inq_lap, t, nbr_rsp);
#else
int i;
inquiry_results *inq_res;
@@ -683,15 +684,17 @@
if (!(inq_res =3D malloc(sizeof *inq_res + nbr_rsp * 6)))
{
fprintf(stderr, __FUNCTION__ ": Failed to allocate result structure!\n=
");
+ return -ENOMEM;
}
=20
inq_res->nbr_of_units =3D nbr_rsp;
inq_res->inq_time =3D t;
=20
- if (ioctl(bt_cfd, HCIINQUIRY, inq_res) < 0)
+ if ((retval =3D ioctl(bt_cfd, HCIINQUIRY, inq_res)) < 0)
{
- perror(__FUNCTION__);
- exit(1);
+ printf("Inquiry failed [%s (%d)]\n", error_msg(retval), MSG_GET_CODE(-=
retval));
+ free(inq_res);
+ return retval;
}
=20
for (i =3D 0; i < inq_res->nbr_of_units; i++)
@@ -704,6 +707,7 @@
=20
free(inq_res);
#endif
+ return retval;
}
=20
void
--- bt_if.h 2001/10/10 14:56:00 1.27
+++ bt_if.h 2001/10/15 08:48:53 1.28
@@ -317,7 +317,7 @@
int bt_getinfo(int bt_cfd, unsigned char bd[6], unsigned short type);
int bt_testcmd(int bt_cfd, unsigned char *cmd);
=20
-void bt_inquiry(int bt_cfd, int nbr_rsp, int t);
+int bt_inquiry(int bt_cfd, int nbr_rsp, int t);
int bt_set_baudrate(int bt_cfd, const char *speedstr);
void bt_set_bd_addr(int bt_cfd, unsigned char *bd);
void read_local_bd(int bt_cfd, unsigned char *bd_addr);
|