|
From: Gordon M. <gm...@us...> - 2001-03-04 17:53:51
|
The following files were modified in apps/bluetooth/btd: Name Old version New version Comment ---- ----------- ----------- ------- btd.c 1.82 1.83=20=20=20=20=20=20=20=20=20=20=20=20 btd.h 1.33 1.34=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Modified the config macros to be compatible with the Linux kernel config = system. The diff of the modified file(s): --- btd.c 2001/03/04 15:49:23 1.82 +++ btd.c 2001/03/04 17:54:54 1.83 @@ -304,7 +304,7 @@ /* Misc */ static void show_menu(void); =20 -#if HW_USED(HW_ERICSSON)&&defined(__CRIS__) +#if defined(CONFIG_BLUETOOTH_ERICSSON)&&defined(__CRIS__) #define ECS_TEST_FUNCTIONS #endif =20 @@ -3062,7 +3062,7 @@ /****************** Vendor dependent functions ***********************/ /*********************************************************************/ =20 -#if HW_USED(HW_ERICSSON) +#if defined(CONFIG_BLUETOOTH_ERICSSON) =20 /* Set the phys device to Ericsson default speed, 57600 */ void init_phys(int fd) @@ -3121,7 +3121,7 @@ #endif } =20 -#elif HW_USED(HW_DIGIANSWER) +#elif defined(CONFIG_BLUETOOTH_DIGIANSWER) /*********************************************************************/ /*********************************************************************/ =20 @@ -3151,7 +3151,7 @@ #endif } =20 -#elif HW_USED(HW_CSR) +#elif defined(CONFIG_BLUETOOTH_CSR) /*********************************************************************/ /*********************************************************************/ =20 @@ -3195,7 +3195,7 @@ #endif } =20 -#elif HW_USED(HW_GENERIC) +#elif defined(CONFIG_BLUETOOTH_GENERIC) /*********************************************************************/ /*********************************************************************/ =20 @@ -3224,7 +3224,7 @@ #endif } =20 -#elif HW_USED(HW_NOINIT) +#elif defined(CONFIG_BLUETOOTH_NOINIT) /*********************************************************************/ /*********************************************************************/ =20 --- btd.h 2001/02/27 15:46:44 1.33 +++ btd.h 2001/03/04 17:54:54 1.34 @@ -46,20 +46,22 @@ =20 /****************** CONSTANT AND MACRO SECTION ***************************= ***/ =20 +/* + * I had to change this section to match btconfig.h, which was modified + * to suit Linux kernel configuration. It's unfortunate I had to influence + * the apps directory with a kernel change, but the user stack uses the + * kernel module configs and the btd.c source. + * --gmcnutt + */ /* HW init defines */ - -#define HW_NOINIT 0 -#define HW_ERICSSON 1 -#define HW_DIGIANSWER 2 -#define HW_CSR 3 -#define HW_GENERIC 4 -#define HW_USBMODULE 5 /* Not implemented */ - +#undef CONFIG_BLUETOOTH_CSR=20=20=20=20=20=20=20=20 +#undef CONFIG_BLUETOOTH_NOINIT=20=20=20=20=20 +#undef CONFIG_BLUETOOTH_DIGIANSWER=20 +#undef CONFIG_BLUETOOTH_USBMODULE /* Not implemented */ +#undef CONFIG_BLUETOOTH_GENERIC=20=20=20=20 /* This sets current HW */ -#define HW_CURRENT HW_ERICSSON -//#define HW_CURRENT HW_CSR +#define CONFIG_BLUETOOTH_ERICSSON =20 -#define HW_USED(x) (HW_CURRENT =3D=3D x) =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=3D=3D */ =20 |
|
From: Peter K. <pk...@us...> - 2001-03-09 13:16:14
|
The following files were modified in apps/bluetooth/btd:
Name Old version New version Comment
---- ----------- ----------- -------
Makefile 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.84 1.85=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Support for compiling without readline (by Matthias Fuchs).
The diff of the modified file(s):
--- Makefile 2000/12/14 16:40:31 1.5
+++ Makefile 2001/03/09 13:18:02 1.6
@@ -16,8 +16,22 @@
=20
OBJS =3D btd.o
=20
+# Define HAVE_READLINE_READLINE if you have readline support, with the inc=
lude
+# files in $(include_dir)/readline. Define HAVE_READLINE if you have the
+# include files in $(include_dir). Define neither if you do not want to use
+# readline.
+HAVE_READLINE_READLINE =3D 1
+#HAVE_READLINE =3D 1
+
+ifdef HAVE_READLINE_READLINE
LDLIBS +=3D -lreadline -ltermcap
-CFLAGS +=3D -I$(prefix)/include
+CFLAGS +=3D -DHAVE_READLINE_READLINE -I$(prefix)/include
+endif
+
+ifdef HAVE_READLINE
+LDLIBS +=3D -lreadline -ltermcap
+CFLAGS +=3D -DHAVE_READLINE -I$(prefix)/include
+endif
=20
all: $(PROGS)
=20
--- btd.c 2001/03/05 11:15:55 1.84
+++ btd.c 2001/03/09 13:18:02 1.85
@@ -150,8 +150,13 @@
#include <sys/un.h>
#include <arpa/inet.h>
=20
+#if defined(HAVE_READLINE_READLINE)
#include <readline/readline.h>
#include <readline/history.h>
+#elif defined(HAVE_READLINE)
+#include <readline.h>
+#include <history.h>
+#endif
=20
#define RESTART_ENABLED
=20
@@ -322,6 +327,13 @@
#define MANUFACTURER_SPEC 0x3f
#endif
=20
+#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE)
+void read_history(char *hist_file_name);
+void write_history(char *hist_file_name);
+void add_history(char *command);
+char *readline(char *promt);
+#endif=20
+
/* Modem emulator stuff */
=20
#define CONNECT 1
@@ -776,6 +788,13 @@
{
char *line =3D readline("> ");
int tmp;
+
+ if (!line)
+ {
+ start_ppp =3D 0;
+ break;
+ }
+
add_history(line);
=20=20=20=20=20=20=20
tmp =3D process_cmd(line, bt_cfd);
@@ -789,6 +808,7 @@
start_ppp =3D 0;
break;
}
+=20=20=20=20=20=20
free(line);
}
write_history(BTD_HISTORY_FILE);
@@ -860,6 +880,42 @@
syslog(LOG_INFO, "ppp child died, now restart!\n\n\n");
}
}
+
+/* readline replacement - mfuchs */
+#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE)
+#define MAXLINE 100
+
+void read_history(char *hist_file_name)
+{
+}
+
+void write_history(char *hist_file_name)
+{
+}
+
+void add_history(char *command)
+{
+}
+
+char *readline(char *promt)
+{
+ int len;
+ char *line;
+
+ if ((line =3D malloc(MAXLINE)))
+ {
+ printf("%s", promt);
+ fflush(stdout);
+ *line =3D 0;
+ if ((len =3D read(STDIN_FILENO, line, MAXLINE-1)) >=3D 0)
+ {
+ line[len] =3D 0;
+ }
+ }
+
+ return line;
+}
+#endif /* !HAVE_READLINE */
=20
#ifndef BTD_USERSTACK
static void start_sdp_server(void)
|
|
From: Peter K. <pk...@us...> - 2001-04-20 16:12:14
|
The following files were modified in apps/bluetooth/btd:
Name Old version New version Comment
---- ----------- ----------- -------
btd.c 1.93 1.94=20=20=20=20=20=20=20=20=20=20=20=20
btd.h 1.35 1.36=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Use bt_hw_vendor() to identify which kind of hardware is used,
instead of deciding this when compiling.
The diff of the modified file(s):
--- btd.c 2001/04/18 11:50:32 1.93
+++ btd.c 2001/04/20 16:12:14 1.94
@@ -300,6 +300,9 @@
static void read_local_bd(int bt_cfd, unsigned char *bd_addr);
static void read_remote_bd(int bt_cfd, unsigned char *bd_addr);
static void role_switch(int bt_cfd, unsigned char *bd_addr, int role);
+#ifndef BTD_USERSTACK
+static char* bt_hw_vendor(void);
+#endif
static void reset_hw(void);
static void bt_set_classofdevice(int bt_fd, unsigned short service_class, =
unsigned char major_class, unsigned char minor_class, unsigned char format);
=20
@@ -307,10 +310,25 @@
/* Misc */
static void show_menu(void);
=20
-#if defined(CONFIG_BLUETOOTH_ERICSSON)&&defined(__CRIS__)
-#define ECS_TEST_FUNCTIONS
-#endif
+static int hw_vendor(void);
+
+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 usb_init_phys(int fd);
+static void usb_init_hw(int spd);
+static void generic_init_phys(int fd);
+static void generic_init_hw(int spd);
+static void no_init_phys(int fd);
+static void no_init_hw(int spd);
+static void unknown_init_phys(int fd);
+static void unknown_init_hw(int spd);
=20
+#undef ECS_TEST_FUNCTIONS
+
#ifdef ECS_TEST_FUNCTIONS
static void enable_dut(int bt_cfd);
static void test_connection_req(int* bd);
@@ -396,6 +414,15 @@
=20
#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
+
/*=20
Bluetooth discipline define. Should reside in /include/asm/termios.h
However, if compiling this standalone simply use the define in bluetoot=
h.h
@@ -2854,7 +2881,6 @@
bt_disconnect(int bt_fd, unsigned int con_id)
{
#ifndef BTD_USERSTACK
-
if (ioctl(bt_fd, BTDISCONNECT, &con_id) < 0)
{
perror("Disconnect");
@@ -3111,6 +3137,23 @@
#endif
}
=20
+#ifndef BTD_USERSTACK
+char*
+bt_hw_vendor(void)
+{
+ int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY);
+ static char buffer[20];
+
+ if (bt_cfd < 0 || ioctl(bt_cfd, BTHWVENDOR, buffer) < 0)
+ {
+ perror(__FUNCTION__);
+ return NULL;
+ }
+ close(bt_cfd);
+ return buffer;
+}
+#endif
+
void
reset_hw(void)
{
@@ -3145,26 +3188,130 @@
/****************** Vendor dependent functions ***********************/
/*********************************************************************/
=20
-#if defined(CONFIG_BLUETOOTH_ERICSSON)
+void
+init_phys(int fd)
+{
+ switch (hw_vendor())
+ {
+ case HW_ERICSSON:
+ ericsson_init_phys(fd);
+ break;
+
+ case HW_CSR:
+ csr_init_phys(fd);
+ break;
+
+ case HW_DIGIANSWER:
+ digianswer_init_phys(fd);
+ break;
+
+ case HW_USB:
+ usb_init_phys(fd);
+ break;
+
+ case HW_GENERIC:
+ generic_init_phys(fd);
+ break;
+
+ case HW_NO_INIT:
+ no_init_phys(fd);
+ break;
=20
+ case HW_UNKNOWN:
+ default:
+ unknown_init_phys(fd);
+ break;
+ }
+}
+
+void
+init_hw(int spd)
+{
+ switch (hw_vendor())
+ {
+ case HW_ERICSSON:
+ ericsson_init_hw(spd);
+ break;
+
+ case HW_CSR:
+ csr_init_hw(spd);
+ break;
+
+ case HW_DIGIANSWER:
+ digianswer_init_hw(spd);
+ break;
+
+ case HW_USB:
+ usb_init_hw(spd);
+ break;
+
+ case HW_GENERIC:
+ generic_init_hw(spd);
+ break;
+
+ case HW_NO_INIT:
+ no_init_hw(spd);
+ break;
+
+ case HW_UNKNOWN:
+ default:
+ unknown_init_hw(spd);
+ break;
+ }
+}
+
+int
+hw_vendor(void)
+{
+ static int hw_vendor =3D HW_NOT_PROBED;
+
+ if (hw_vendor =3D=3D HW_NOT_PROBED)
+ {
+ char *vendor =3D bt_hw_vendor();
+
+ 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, "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
+ hw_vendor =3D HW_UNKNOWN;
+ }
+
+ return hw_vendor;
+}
+
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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 init_phys(int fd)
+void
+ericsson_init_phys(int fd)
{
fd_setup(fd, 57600, USE_FLOW_CTRL);
}
=20
void
-init_hw(int spd)
+ericsson_init_hw(int spd)
{
- /*
- wait for Ericsson module to boot if running this app
- directly at startup=20
- */
#ifndef BTD_USERSTACK
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
unsigned char evfilter[3];
=20=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
@@ -3191,7 +3338,6 @@
perror("HCISETBAUDRATE");
exit(1);
}
-=20=20=20=20=20
#else=20=20
printf("Setting write_scan_enable in Ericsson module!\n");
hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);=09=09
@@ -3203,49 +3349,21 @@
hci_set_baudrate(spd);=20=20
#endif
}
-
-#elif defined(CONFIG_BLUETOOTH_DIGIANSWER)
-/*********************************************************************/
-/*********************************************************************/
-
-/* Set the phys device to Digianswer default, 9600 */=20
-void init_phys(int fd)
-{
- fd_setup(fd, 9600, USE_FLOW_CTRL);
-}
-
-void
-init_hw(int spd)
-{
- printf("Setting baudrate in Digianswer PC card\n");
-#ifndef BTD_USERSTACK
- if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0)
- {
- perror("HCISETBAUDRATE");
- exit(1);
- }
-#else
- hci_set_baudrate(spd);
-#if DIGI_DONGLE_SUPPORT
- // FIXME - what to do about this?
- hci_set_baudrate(115200);
-#endif
-
-#endif
-}
=20
-#elif defined(CONFIG_BLUETOOTH_CSR)
-/*********************************************************************/
-/*********************************************************************/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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
/* Set the phys device to CSR default, 115200 */=20
-void init_phys(int fd)
+void
+csr_init_phys(int fd)
{
fd_setup(fd, 115200, USE_FLOW_CTRL);
}
=20
+/* fixme -- remove hardcoded values */
void
-init_hw(int spd)
+csr_init_hw(int spd)
{=20=20
#ifndef BTD_USERSTACK
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
@@ -3281,8 +3399,6 @@
perror("HCISET_EVENT_FILTER");
exit(1);
}
-
-
#else
printf("Setting write_scan_enable in CSR module!\n");
hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);
@@ -3292,18 +3408,49 @@
#endif
}
=20
-#elif defined(CONFIG_BLUETOOTH_GENERIC)
-/*********************************************************************/
-/*********************************************************************/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+/* Digianswer 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 something, e.g. 115200 */=20
-void init_phys(int fd)
+/* Set the phys device to Digianswer default, 9600 */=20
+void
+digianswer_init_phys(int fd)
+{
+ fd_setup(fd, 9600, USE_FLOW_CTRL);
+}
+
+void
+digianswer_init_hw(int spd)
+{
+ printf("Setting baudrate in Digianswer PC card\n");
+#ifndef BTD_USERSTACK
+ if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0)
{
+ perror("HCISETBAUDRATE");
+ exit(1);
+ }
+#else
+ hci_set_baudrate(spd);
+#if DIGI_DONGLE_SUPPORT
+ // FIXME - what to do about this?
+ hci_set_baudrate(115200);
+#endif
+
+#endif /* BTD_USERSTACK */
+}
+
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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*/
+
+void
+usb_init_phys(int fd)
+{
fd_setup(fd, 115200, USE_FLOW_CTRL);
}
=20
void
-init_hw(int spd)
+usb_init_hw(int spd)
{
#ifndef BTD_USERSTACK
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
@@ -3321,39 +3468,65 @@
#endif
}
=20
-#elif defined(CONFIG_BLUETOOTH_NOINIT)
-/*********************************************************************/
-/*********************************************************************/
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+/* Generic 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 something, e.g. 115200 */=20
-void init_phys(int fd)
+void
+generic_init_phys(int fd)
{
- printf("init_phys: No hardware.\n");
+ fd_setup(fd, 115200, USE_FLOW_CTRL);
}
=20
void
-init_hw(int spd)
+generic_init_hw(int spd)
{
- printf("No hw init done\n");
-}
+#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
+ 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
-void init_phys(int fd)
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+/* No HW init 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*/
+
+void
+no_init_phys(int fd)
+{
+}
+
+void
+no_init_hw(int spd)
{
+}
+
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+/* Default */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+
+void
+unknown_init_phys(int fd)
+{
printf("ERROR: init_phys() not implemented!\n");
}
=20
void
-init_hw(int spd)
+unknown_init_hw(int spd)
{
printf("ERROR: init_hw() not implemented!\n");
}
=20
-#endif /* HW_USED() */
-
/*********************************************************************/
/***************** Ericsson test functions ***************************/
/***************** This will be moved later **************************/
@@ -3463,7 +3636,6 @@
{
perror("test con req");
}
-=20=20
#else
hdl =3D hci_test_connect_req(btcon.bd);
#endif
@@ -3479,7 +3651,6 @@
unsigned char test_msg[17];
int i;
=20
-=20=20
ecs_test_msg[0] =3D CMD_PKT;
ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC);
ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC);
@@ -3510,7 +3681,6 @@
printf("Length_Of_Test_Data : 0x%x\n", tmp[10]);
=20=20=20
#ifndef BTD_USERSTACK
-
test_msg[0] =3D 17;
memcpy(test_msg + 1, ecs_test_msg, 17);
=20=20=20
@@ -3521,9 +3691,10 @@
#else
hci_send_raw_data(test_msg, 17);
#endif
+
printf("TX test starting.\n");
}
-#endif
+#endif /* ECS_TEST_FUNCTIONS */
=20
/*********************************************************************/
/*********************************************************************/
--- btd.h 2001/03/05 16:57:54 1.35
+++ btd.h 2001/04/20 16:12:14 1.36
@@ -46,24 +46,6 @@
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
-/* HW init defines */
-
-/* Let us assume that if CONFIG_BLUETOOTH is definend (from the kernel
- includes), then CONFIG_BLUETOOTH_<hardware> is also defined correctly */
-#ifndef CONFIG_BLUETOOTH
-
-/* Define the one of these that matches the used hardware */
-#undef CONFIG_BLUETOOTH_NOINIT=20=20=20=20=20
-#undef CONFIG_BLUETOOTH_CSR=20=20=20=20=20=20=20=20
-#undef CONFIG_BLUETOOTH_DIGIANSWER=20
-#define CONFIG_BLUETOOTH_ERICSSON
-#undef CONFIG_BLUETOOTH_GENERIC=20=20=20=20
-#undef CONFIG_BLUETOOTH_USBMODULE /* Not implemented */
-
-#endif CONFIG_BLUETOOTH
-
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-
/* Ioctls for the BT driver */
=20
#define BT_IOC_MAGIC 'B' /* Use B as a magic number */
@@ -81,6 +63,7 @@
#define BTREADREMOTEBDADDR _IOR(BT_IOC_MAGIC, 0x07, unsigned char[6])
#define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08)
#define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, int)
+#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0A, char[20])
=20
/* ioctls executing HCI commands */
=20
@@ -144,8 +127,6 @@
#define INQUIRY_SCAN_ENABLE 1
#define PAGE_SCAN_ENABLE 2
=20
-/****************** TYPE DEFINITION SECTION ******************************=
***/
-
#define SDP_LAYER 1
#define RFCOMM_LAYER 3
#define TCS_LAYER 5
@@ -153,13 +134,16 @@
#define CREATE_RFCOMM_ID(line, dlci) ( ((RFCOMM_LAYER << 16)&0xffff0000) |=
((line<<8)&0xff00) | ((dlci) & 0xff) )
#define GET_PSM(con_id) (con_id >> 16)
=20
+/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
-typedef struct bt_connection{
+typedef struct bt_connection
+{
unsigned char bd[6];
unsigned int id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/
} bt_connection;
=20
-typedef struct inquiry_results {
+typedef struct inquiry_results
+{
unsigned int nbr_of_units;
unsigned int inq_time;
unsigned char bd_addr[0];
|
|
From: Peter K. <pk...@us...> - 2001-06-15 12:43:17
|
The following files were modified in apps/bluetooth/btd:
Name Old version New version Comment
---- ----------- ----------- -------
btd.c 1.97 1.98=20=20=20=20=20=20=20=20=20=20=20=20
btd.h 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
read_remote_bd() now takes a line argument.
The diff of the modified file(s):
--- btd.c 2001/04/27 16:48:43 1.97
+++ btd.c 2001/06/15 12:43:15 1.98
@@ -298,7 +298,7 @@
static void bt_inquiry(int bt_cfd, int nbr_rsp, int t);
static void bt_set_bd_addr(int bt_cfd, int* bd);
static void read_local_bd(int bt_cfd, unsigned char *bd_addr);
-static void read_remote_bd(int bt_cfd, unsigned char *bd_addr);
+static void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr);
static void role_switch(int bt_cfd, unsigned char *bd_addr, int role);
#ifndef BTD_USERSTACK
static char* bt_hw_vendor(void);
@@ -2663,7 +2663,10 @@
struct ipa_client *client;
=20
read_local_bd(bt_cfd, local_bd);
- read_remote_bd(bt_cfd, remote_bd);
+
+ /* fixme -- for now only use line 0 */
+ read_remote_bd(bt_cfd, 0, remote_bd);
+
/*=20
* Get options from IPAssigner=20
*/
@@ -3054,9 +3057,11 @@
=20
/* FIXME -- add "line" parameter to differentiate between the remote devic=
es */
void
-read_remote_bd(int bt_cfd, unsigned char *bd_addr)
+read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr)
{
#ifndef BTD_USERSTACK
+ *(int*)bd_addr =3D line;
+
if (ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) < 0)
{
perror("Read client bd addr");
@@ -3065,7 +3070,7 @@
BD_ADDR rev_bd;
int i;
=20=20
- get_remote_bd(rev_bd);
+ get_remote_bd(line, rev_bd);
=20
/* return as big endian */
for (i =3D 0; i < 6; i++) {
--- btd.h 2001/04/26 14:02:18 1.37
+++ btd.h 2001/06/15 12:43:16 1.38
@@ -60,7 +60,7 @@
#define BTSETSERTTY _IO(BT_IOC_MAGIC, 0x04)
#define BTSETMODEMDUMMY _IOW(BT_IOC_MAGIC, 0x05, int)
#define BTSHUTDOWN _IO(BT_IOC_MAGIC, 0x06)
-#define BTREADREMOTEBDADDR _IOR(BT_IOC_MAGIC, 0x07, unsigned char[6])
+#define BTREADREMOTEBDADDR _IOWR(BT_IOC_MAGIC, 0x07, unsigned char[6])
#define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08)
#define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, int)
#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0A, char[20])
|