|
From: Peter K. <pk...@us...> - 2001-09-06 16:16:28
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_vendor.c 1.27 1.28=20=20=20=20=20=20=20=20=20=20=20=20
bt_vendor.h 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20
btinit.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
csr_h4_to_bcsp() and csr_bcsp_to_h4() need the initial hardware speed.
The diff of the modified file(s):
--- bt_vendor.c 2001/09/06 16:02:37 1.27
+++ bt_vendor.c 2001/09/06 16:16:26 1.28
@@ -73,6 +73,8 @@
static void unknown_init_phys(int fd);
static void unknown_init_hw(int bt_cfd, int phys_fd, int spd);
=20
+static void csr_change_if(int bt_cfd, int phys_fd, int speed);
+
void
init_phys(int fd)
{
@@ -161,7 +163,7 @@
*/
=20
void
-init_failed(int bt_cfd, int phys_fd)
+init_failed(int bt_cfd, int phys_fd, int speed)
{
=20
static int did_restart =3D 0; /* only try once */=20=20
@@ -178,7 +180,7 @@
{
case HW_CSR:
/* Try changing interface BCSP<->H4 */
- csr_change_if(bt_cfd, phys_fd);
+ csr_change_if(bt_cfd, phys_fd, speed);
did_restart =3D 1;
=20
/* Restart btd */
@@ -312,21 +314,21 @@
* Switches host interface in CSR HW (H4<->BCSP)=20
*/
=20
-void csr_change_if(int bt_cfd, int phys_fd)
+void csr_change_if(int bt_cfd, int phys_fd, int speed)
{
/* This may seem reversed, but hw_vendor() returns what we want,
not what we have, in this situation... */
if (!bt_bcsp_mode(bt_cfd, -1))
{
- csr_bcsp_to_h4(bt_cfd, phys_fd);
+ csr_bcsp_to_h4(bt_cfd, phys_fd, speed);
}
else
{
- csr_h4_to_bcsp(bt_cfd, phys_fd);
+ csr_h4_to_bcsp(bt_cfd, phys_fd, speed);
}
}
=20
-void csr_bcsp_to_h4(int bt_cfd, int phys_fd)
+void csr_bcsp_to_h4(int bt_cfd, int phys_fd, int speed)
{
unsigned short ps_parbuf[10];
=20
@@ -335,8 +337,11 @@
/* Temporarily set stack to use BCSP framing */
bt_bcsp_mode(bt_cfd, 1);
=20
- /* Setup serial port for BCSP (default baudrate) */
- fd_setup(phys_fd, 115200, USE_FLOW_CTRL);
+ if (speed)
+ fd_setup(phys_fd, speed, USE_FLOW_CTRL);
+ else
+ init_phys(phys_fd);
+
reset_hw();
=20
if (ioctl(bt_cfd, BTINITBCSP) < 0)
@@ -391,7 +396,7 @@
shutdown_stack(bt_cfd);
}
=20
-void csr_h4_to_bcsp(int bt_cfd, int phys_fd)
+void csr_h4_to_bcsp(int bt_cfd, int phys_fd, int speed)
{
unsigned short ps_parbuf[10];
=20
@@ -400,8 +405,10 @@
/* Set stack to use H4 temporarily */=20=20=20=20=20=20=20=20
bt_bcsp_mode(bt_cfd, 0);
=20
- /* Setup serial port for H4 (default baudrate) */
- fd_setup(phys_fd, 115200, USE_FLOW_CTRL);
+ if (speed)
+ fd_setup(phys_fd, speed, USE_FLOW_CTRL);
+ else
+ init_phys(phys_fd);
=20
reset_hw();=20=20=20=20
=20
--- bt_vendor.h 2001/08/29 10:02:05 1.7
+++ bt_vendor.h 2001/09/06 16:16:26 1.8
@@ -66,12 +66,11 @@
=20
void init_hw(int bt_cfd, int phys_fd, int spd);
void init_phys(int fd);
-void init_failed(int bt_cfd, int phys_fd);
+void init_failed(int bt_cfd, int phys_fd, int speed);
=20
int hw_vendor(void);
=20
-void csr_change_if(int bt_cfd, int phys_fd);
-void csr_bcsp_to_h4(int bt_cfd, int phys_fd);
-void csr_h4_to_bcsp(int bt_cfd, int phys_fd);
+void csr_bcsp_to_h4(int bt_cfd, int phys_fd, int speed);
+void csr_h4_to_bcsp(int bt_cfd, int phys_fd, int speed);
=20
#endif /* __BT_VENDOR_H__*/
--- btd.c 2001/09/05 15:33:46 1.25
+++ btd.c 2001/09/06 16:16:26 1.26
@@ -301,7 +301,14 @@
reset_hw();
=20
if (init_stack(bt_cfd) < 0)
- init_failed(bt_cfd, phys_fd);
+ {
+ /* For some reason, the stack sometimes fails to initialize the first
+ time. So let us try an extra time, just to be sure... */
+ if (init_stack(bt_cfd) < 0)
+ {
+ init_failed(bt_cfd, phys_fd, init_hw_speed);
+ }
+ }
=20
if (do_hwinit)
init_hw(bt_cfd, phys_fd, atoi(speedstr));
--- btinit.c 2001/08/29 10:02:05 1.13
+++ btinit.c 2001/09/06 16:16:26 1.14
@@ -222,7 +222,14 @@
reset_hw();
=20=20=20
if (init_stack(bt_cfd) < 0)
- init_failed(bt_cfd, phys_fd);
+ {
+ /* For some reason, the stack sometimes fails to initialize the first
+ time. So let us try an extra time, just to be sure... */
+ if (init_stack(bt_cfd) < 0)
+ {
+ init_failed(bt_cfd, phys_fd, init_hw_speed);
+ }
+ }
=20=20=20
if (do_hwinit)
init_hw(bt_cfd, phys_fd, atoi(speedstr));
|