|
From: Peter K. <pk...@us...> - 2001-04-27 16:48:44
|
The following file was modified in apps/bluetooth/btd:
Name Old version New version Comment
---- ----------- ----------- -------
btd.c 1.96 1.97=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Reorganized code somewhat.
The diff of the modified file(s):
--- btd.c 2001/04/27 15:38:03 1.96
+++ btd.c 2001/04/27 16:48:43 1.97
@@ -312,12 +312,14 @@
=20
static int hw_vendor(void);
=20
-static void ericsson_init_phys(int fd);
-static void ericsson_init_hw(int spd);
static void csr_init_phys(int fd);
static void csr_init_hw(int spd);
static void digianswer_init_phys(int fd);
static void digianswer_init_hw(int spd);
+static void ericsson_init_phys(int fd);
+static void ericsson_init_hw(int spd);
+static void infineon_init_phys(int fd);
+static void infineon_init_hw(int spd);
static void usb_init_phys(int fd);
static void usb_init_hw(int spd);
static void generic_init_phys(int fd);
@@ -326,8 +328,6 @@
static void no_init_hw(int spd);
static void unknown_init_phys(int fd);
static void unknown_init_hw(int spd);
-static void infineon_init_phys(int fd);
-static void infineon_init_hw(int spd);
=20
=20
#undef ECS_TEST_FUNCTIONS
@@ -418,14 +418,14 @@
#define BTD_HISTORY_FILE "/tmp/btd_history"
=20
#define HW_NOT_PROBED -1
-#define HW_ERICSSON 0
-#define HW_CSR 1
-#define HW_DIGIANSWER 2
-#define HW_USB 3
-#define HW_GENERIC 4
-#define HW_NO_INIT 5
-#define HW_UNKNOWN 6
-#define HW_INFINEON 7
+#define HW_CSR 0
+#define HW_DIGIANSWER 1
+#define HW_ERICSSON 2
+#define HW_INFINEON 3
+#define HW_USB 4
+#define HW_GENERIC 5
+#define HW_NO_INIT 6
+#define HW_UNKNOWN 7
=20
/*=20
Bluetooth discipline define. Should reside in /include/asm/termios.h
@@ -3197,10 +3197,6 @@
{
switch (hw_vendor())
{
- case HW_ERICSSON:
- ericsson_init_phys(fd);
- break;
-
case HW_CSR:
csr_init_phys(fd);
break;
@@ -3209,14 +3205,18 @@
digianswer_init_phys(fd);
break;
=20
- case HW_USB:
- usb_init_phys(fd);
+ case HW_ERICSSON:
+ ericsson_init_phys(fd);
break;
=20
case HW_INFINEON:
infineon_init_phys(fd);
break;
=20
+ case HW_USB:
+ usb_init_phys(fd);
+ break;
+
case HW_GENERIC:
generic_init_phys(fd);
break;
@@ -3237,10 +3237,6 @@
{
switch (hw_vendor())
{
- case HW_ERICSSON:
- ericsson_init_hw(spd);
- break;
-
case HW_CSR:
csr_init_hw(spd);
break;
@@ -3249,14 +3245,18 @@
digianswer_init_hw(spd);
break;
=20
- case HW_USB:
- usb_init_hw(spd);
+ case HW_ERICSSON:
+ ericsson_init_hw(spd);
break;
=20
case HW_INFINEON:
infineon_init_hw(spd);
break;
=20
+ case HW_USB:
+ usb_init_hw(spd);
+ break;
+
case HW_GENERIC:
generic_init_hw(spd);
break;
@@ -3283,20 +3283,20 @@
=20
if (!vendor)
hw_vendor =3D HW_UNKNOWN;
- else if (!strcmp(vendor, "Ericsson"))
- hw_vendor =3D HW_ERICSSON;
else if (!strcmp(vendor, "CSR"))
hw_vendor =3D HW_CSR;
else if (!strcmp(vendor, "Digianswer"))
hw_vendor =3D HW_DIGIANSWER;
+ else if (!strcmp(vendor, "Ericsson"))
+ hw_vendor =3D HW_ERICSSON;
+ else if (!strcmp(vendor, "Infineon"))
+ hw_vendor =3D HW_INFINEON;
else if (!strcmp(vendor, "USB"))
hw_vendor =3D HW_USB;
else if (!strcmp(vendor, "Generic"))
hw_vendor =3D HW_GENERIC;
else if (!strcmp(vendor, "No Init"))
hw_vendor =3D HW_NO_INIT;
- else if (!strcmp(vendor, "Infineon"))
- hw_vendor =3D HW_INFINEON;
else
hw_vendor =3D HW_UNKNOWN;
}
@@ -3305,67 +3305,6 @@
}
=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*/
-/* Ericsson specific commands */
-/* =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*/
-
-/* Set the phys device to Ericsson default speed, 57600 */
-void
-ericsson_init_phys(int fd)
-{
- fd_setup(fd, 57600, USE_FLOW_CTRL);
-}
-
-void
-ericsson_init_hw(int spd)
-{
-#ifndef BTD_USERSTACK
- unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
- unsigned char evfilter[3];
-=20=20
- /* wait for Ericsson module to boot if running this app directly at star=
tup=20
- */
- sleep(1);
-
- printf("Setting write_scan_enable in Ericsson module!\n");
- if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0)
- {=20
- perror("HCIWRITESCANENABLE");
- exit(1);
- }
-
- /* set_event_filter must be called for m/s switch on IrmaC! */
- sleep(1);
- evfilter[0] =3D 0x02; /* Connection setup */
- evfilter[1] =3D 0x00; /* All devices */
- evfilter[2] =3D 0x01; /* No auto accept */
- printf("Setting event filter in Ericsson module!\n");
- if (ioctl(bt_cfd, HCISET_EVENT_FILTER, &evfilter) < 0)
- {=20
- perror("HCISET_EVENT_FILTER");
- exit(1);
- }
-
- sleep(1); // wait for HW...=20
- printf("Setting baudrate in Ericsson module!\n");=20=20
- if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0)
- {
- perror("HCISETBAUDRATE");
- exit(1);
- }
-#else=20=20
- printf("Setting write_scan_enable in Ericsson module!\n");
- hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);=09=09
- sleep(1); /* wait for HW... */
-=20=20
- tcflush(phys_fd, TCIOFLUSH);
-
- printf("Setting baudrate in Ericsson module!\n");=20=20
- hci_set_baudrate(spd);=20=20
- usleep(10000); /* needed for some reason... */
-#endif
-}
-
-/* =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*/
/* CSR specific commands */
/* =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*/
=20
@@ -3384,6 +3323,7 @@
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
unsigned char evfilter[3];=20
unsigned int tmp[2];
+
tmp[0]=3D0x800;
tmp[1]=3D0x12;
=20=20=20
@@ -3455,35 +3395,66 @@
}
=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*/
-/* USB specific commands */
+/* Ericsson specific commands */
/* =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*/
=20
+/* Set the phys device to Ericsson default speed, 57600 */
void
-usb_init_phys(int fd)
+ericsson_init_phys(int fd)
{
- fd_setup(fd, 115200, USE_FLOW_CTRL);
+ fd_setup(fd, 57600, USE_FLOW_CTRL);
}
=20
void
-usb_init_hw(int spd)
+ericsson_init_hw(int spd)
{
#ifndef BTD_USERSTACK
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
+ unsigned char evfilter[3];
+=20=20
+ /* wait for Ericsson module to boot if running this app directly at star=
tup=20
+ */
sleep(1);
- printf("Setting write_scan_enable in USB module!\n");
=20=20=20
+ printf("Setting write_scan_enable in Ericsson module!\n");
if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0)
{=20
perror("HCIWRITESCANENABLE");
exit(1);
}
+
+ /* set_event_filter must be called for m/s switch on IrmaC! */
+ sleep(1);
+ evfilter[0] =3D 0x02; /* Connection setup */
+ evfilter[1] =3D 0x00; /* All devices */
+ evfilter[2] =3D 0x01; /* No auto accept */
+ printf("Setting event filter in Ericsson module!\n");
+ if (ioctl(bt_cfd, HCISET_EVENT_FILTER, &evfilter) < 0)
+ {=20
+ perror("HCISET_EVENT_FILTER");
+ exit(1);
+ }
+
+ sleep(1); // wait for HW...=20
+ printf("Setting baudrate in Ericsson module!\n");=20=20
+ if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0)
+ {
+ perror("HCISETBAUDRATE");
+ exit(1);
+ }
#else
+ printf("Setting write_scan_enable in Ericsson module!\n");
hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);
- sleep(1); /* wait for HW */
+ sleep(1); /* wait for HW... */
+=20=20
+ tcflush(phys_fd, TCIOFLUSH);
+
+ printf("Setting baudrate in Ericsson module!\n");=20=20
+ hci_set_baudrate(spd);=20=20
+ usleep(10000); /* needed for some reason... */
#endif
}
=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*/
/* Infineon specific commands */
/* =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*/
@@ -3526,7 +3497,35 @@
printf("Setting baudrate in Infineon chip!\n");
hci_set_baudrate(spd);=20=20
#endif
+}
+
+/* =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*/
+/* USB specific commands */
+/* =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*/
=20
+void
+usb_init_phys(int fd)
+{
+ fd_setup(fd, 115200, USE_FLOW_CTRL);
+}
+
+void
+usb_init_hw(int spd)
+{
+#ifndef BTD_USERSTACK
+ unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
+ sleep(1);
+ printf("Setting write_scan_enable in USB module!\n");
+=20=20
+ if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0)
+ {=20
+ perror("HCIWRITESCANENABLE");
+ exit(1);
+ }
+#else
+ hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);
+ sleep(1); /* wait for HW */
+#endif
}
=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*/
|