|
From: Mattias A. <mat...@us...> - 2001-06-13 12:00:36
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
hci.c 1.157 1.158=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* changed some debug
* added return val in hci_init to signal failure.
* added check in hci_init to see whether hci initialized ok
* set cmd timeout to 2 secs instead of 3
The diff of the modified file(s):
--- hci.c 2001/06/08 12:01:26 1.157
+++ hci.c 2001/06/13 12:00:35 1.158
@@ -970,7 +970,6 @@
performing the task for this command */
=20=09=09
case COMMAND_STATUS:
-=09=09
D_CMD(__FUNCTION__ ": COMMAND_STATUS\n");
=20=09=09
if (buf[0]) {=09=09=09
@@ -1764,7 +1763,7 @@
return &hci_ctrl.hci_in_buf[i];
}
=20
-/* Finds an free in buffer*/
+/* Finds a free inbuffer */
=20
hci_in_buffer*=20
get_free_inbuffer(void)
@@ -1787,12 +1786,12 @@
return &hci_ctrl.hci_in_buf[i];
}
=20
-void=20
+s32
hci_init(void)
{
u32 i;
=20
- DSYS(__FUNCTION__ ": Initialising HCI\n");
+ DSYS("Initialising HCI\n");
=20
#ifdef HCI_EMULATION
DSYS("*** HCI emulator on ***\n");
@@ -1811,7 +1810,7 @@
#endif /* LINUX_VERSION_CODE */
#endif /* __KERNEL__ */
=20
- DSYS(__FUNCTION__ ": Initialising HCI inbuffers [%d]\n", HCI_IN_SIZE);
+ DSYS("Initialising HCI inbuffers [%d]\n", HCI_IN_SIZE);
=20=09
/* Initiate the hci inbuffers */
for (i =3D 0; i < NBR_OF_HCI_INBUFFERS; i++) {
@@ -1839,13 +1838,11 @@
hci_ctrl.nbr_of_connections =3D 0;
=20
#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP
-=09
- /* If we use bcsp cmd_num will be set from command status event after
+ /* If we use bcsp cmd_num is set from command status event after
syncronizing bcsp */
if (!bt_use_bcsp(-1)) {
hci_ctrl.hc_buf.cmd_num =3D 1;
}
-
#else
hci_ctrl.hc_buf.cmd_num =3D 1;
#endif
@@ -1855,16 +1852,17 @@
send_data_task.data =3D NULL;
#endif
=20
- /* always... */
- DSYS(__FUNCTION__ ": Reading buffer sizes in HW module\n");
+ DSYS("Reading buffer sizes in HW module\n");
hci_read_buffer_size(HCI_BLOCK);
+
+ DSYS("Reading firmware info in HW module\n");
hci_read_firmware_rev_info();=09
=20
#ifdef HOST_FLOW_CTRL
- DSYS(__FUNCTION__ ": Host flow control enabled\n");
+ DSYS("Host flow control enabled\n");
hci_set_host_controller_flow_control(TRUE);
#else
- DSYS(__FUNCTION__ ": Host flow control not enabled\n");
+ DSYS("Host flow control not enabled\n");
#endif
hci_host_buffer_size(HCI_ACL_LEN,HCI_SCO_LEN,HCI_ACL_NUM,HCI_SCO_NUM);
=20
@@ -1881,6 +1879,12 @@
=20
hci_force_msswitch(0);
#endif
+
+ /* Check that hci initialized properly */
+ if (hci_ctrl.hc_buf.acl_num =3D=3D 0)
+ return -1;=09=20=20
+=09
+ return 0;
}
=20
void=20
@@ -3743,7 +3747,6 @@
send_cmd(u8 *cmd, u8 len)
{
s32 tmp;
-=09
tmp =3D insert_cmd(cmd, len);
if (tmp < 0) {
return tmp;
@@ -3878,7 +3881,7 @@
init_timer(&hci_cmd_timer);
hci_cmd_timer.function =3D cmd_timeout;
hci_cmd_timer.data =3D 0;
- hci_cmd_timer.expires =3D jiffies + 3*HZ;
+ hci_cmd_timer.expires =3D jiffies + 2*HZ;
add_timer(&hci_cmd_timer);
#endif
}
@@ -3955,7 +3958,6 @@
send_cmd_block(u8 *cmd, u8 len)
{
u32 tmp;
-
#ifdef __KERNEL__
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
struct wait_queue wait =3D { current, NULL};
@@ -3972,6 +3974,7 @@
hci_cmd_pending =3D 1;
=20=20=20
start_cmd_timer();
+=09
tmp =3D send_cmd(cmd, len);
=20=20=20
#ifdef __KERNEL__
|