From: Peter K. <pk...@us...> - 2001-04-20 16:11:36
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_conf.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.h 1.1 1.2=20=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): --- bt_conf.h 2001/04/17 10:38:18 1.3 +++ bt_conf.h 2001/04/20 16:11:35 1.4 @@ -42,18 +42,6 @@ #ifndef __BT_CONF_H__ #define __BT_CONF_H__ =20 -#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 */ - -/* This sets current HW in usermode application */ -#define HW_CURRENT HW_CSR - -#define HW_USED(x) (HW_CURRENT =3D=3D x) - /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D GENERAL =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 #define BT_NBR_DATAPORTS 7 --- bt_vendor.c 2001/04/17 17:35:03 1.8 +++ bt_vendor.c 2001/04/20 16:11:35 1.9 @@ -50,189 +50,224 @@ #include "bt_vendor.h" #include "bt_if.h" =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*/ +#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 -#if HW_USED(HW_ERICSSON) +static int hw_vendor(void); =20 -/* Set the phys device to Ericsson default speed, 57600 */ -void init_phys(int fd) -{ - fd_setup(fd, 57600, USE_FLOW_CTRL); -} +static void ericsson_init_phys(int fd); +static void ericsson_init_hw(int bt_cfd, int phys_fd, int spd); +static void csr_init_phys(int fd); +static void csr_init_hw(int bt_cfd, int phys_fd, int spd); +static void digianswer_init_phys(int fd); +static void digianswer_init_hw(int bt_cfd, int phys_fd, int spd); +static void usb_init_phys(int fd); +static void usb_init_hw(int bt_cfd, int phys_fd, int spd); +static void generic_init_phys(int fd); +static void generic_init_hw(int bt_cfd, int phys_fd, int spd); +static void no_init_phys(int fd); +static void no_init_hw(int bt_cfd, int phys_fd, int spd); +static void unknown_init_phys(int fd); +static void unknown_init_hw(int bt_cfd, int phys_fd, int spd); =20 void -init_hw(int bt_cfd, int phys_fd, int spd) +init_phys(int fd) { - bt_write_scan_enable(bt_cfd, 0 /* inpars not used */); - - sleep(1); + switch (hw_vendor()) + { + case HW_ERICSSON: + ericsson_init_phys(fd); + break; =20 - /* set_event_filter must be called for m/s switch on IrmaC! */ - bt_set_event_filter(bt_cfd, 0 /* inpars not used */); + case HW_CSR: + csr_init_phys(fd); + break; =20 - sleep(1); // wait for HW... + case HW_DIGIANSWER: + digianswer_init_phys(fd); + break; =20 - printf("Setting baudrate in Ericsson module!\n");=20=20 - bt_set_baudrate(bt_cfd, spd); + case HW_USB: + usb_init_phys(fd); + break; =20=20=20 - /* Now set phys device speed to whatever HW was set to use */ - fd_setup(phys_fd, spd, USE_FLOW_CTRL); - tcflush(phys_fd, TCIOFLUSH); -} + case HW_GENERIC: + generic_init_phys(fd); + break; =20 -/* Ericsson specific test commands sent through RAW interface */ -#ifdef ECS_TEST_FUNCTIONS + case HW_NO_INIT: + no_init_phys(fd); + break; =20 -#define ERICSSON_ENTER_TEST_MODE 0x11 -#define ERICSSON_TEST_CONTROL 0x12 -#define ERICSSON_TX_TEST 0x19 + case HW_UNKNOWN: + default: + unknown_init_phys(fd); + break; + } +} =20 void -ericsson_test_control(int bt_cfd, int* tmp) +init_hw(int bt_cfd, int phys_fd, int spd) { - unsigned char ecs_test_msg[16]; - unsigned char test_msg[64]; - unsigned short hdl =3D (unsigned short)tmp[0]; - int i; - - ecs_test_msg[0] =3D CMD_PKT; - ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TEST_CONTROL, MANUFACTURER_SPEC); - ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TEST_CONTROL, MANUFACTURER_SPEC); - ecs_test_msg[3] =3D 12; + switch (hw_vendor()) + { + case HW_ERICSSON: + ericsson_init_hw(bt_cfd, phys_fd, spd); + break; =20 - /* connection handle */ - ecs_test_msg[4] =3D (unsigned char)(hdl & 0xff);=20=20=20=20 - ecs_test_msg[5] =3D (unsigned char)((hdl >> 8) & 0xff); + case HW_CSR: + csr_init_hw(bt_cfd, phys_fd, spd); + break; =20 - /* cast ints to to uchars */ - for (i =3D 6; i < 13; i++) - { - ecs_test_msg[i] =3D (unsigned char)tmp[i-6]; - } + case HW_DIGIANSWER: + digianswer_init_hw(bt_cfd, phys_fd, spd); + break; =20 - /* length */ - ecs_test_msg[14] =3D (unsigned char)(tmp[8] & 0xff);=20=20=20=20 - ecs_test_msg[15] =3D (unsigned char)((tmp[8] >> 8) & 0xff); + case HW_USB: + usb_init_hw(bt_cfd, phys_fd, spd); + break; =20 - printf("*** Sending Ericsson_Test_Control with params : ***\n"); + case HW_GENERIC: + generic_init_hw(bt_cfd, phys_fd, spd); + break; =20 - printf("Connection handle : 0x%x\n", hdl); - printf("Test_Scenario : 0x%x\n", ecs_test_msg[6]); - printf("Hopping_Mode : 0x%x\n", ecs_test_msg[7]); - printf("TX_Frequency : 0x%x\n", ecs_test_msg[8]); - printf("RX_Frequency : 0x%x\n", ecs_test_msg[9]); - printf("Power_Control_Mode : 0x%x\n", ecs_test_msg[10]); - printf("Poll_Period : 0x%x\n", ecs_test_msg[11]); - printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[12]); - printf("Length_Of_Test_Data : 0x%x\n", tmp[8]); + case HW_NO_INIT: + no_init_hw(bt_cfd, phys_fd, spd); + break; =20 - bt_send_raw_hci(bt_cfd, test_msg, 16); + case HW_UNKNOWN: + default: + unknown_init_hw(bt_cfd, phys_fd, spd); + break; + } } =20 -void -ericsson_enter_test_mode(int bt_cfd, int* tmp) +int +hw_vendor(void) { - unsigned char ecs_test_msg[7]; + static int hw_vendor =3D HW_NOT_PROBED; =20 - ecs_test_msg[0] =3D CMD_PKT; - ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_ENTER_TEST_MODE, MANUFACTURER_SP= EC); - ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_ENTER_TEST_MODE, MANUFACTURER_SP= EC); - ecs_test_msg[3] =3D 2; - ecs_test_msg[5]=3D (unsigned char)(tmp[0] & 0xff);=20=20=20=20 - ecs_test_msg[6]=3D (unsigned char)((tmp[0] >> 8)&0xff); + if (hw_vendor =3D=3D HW_NOT_PROBED) + { + char *vendor =3D bt_hw_vendor(); =20 - printf("*** Sending enter test mode (handle : 0x%x)***\n", tmp[0]); + 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; + } =20 - bt_send_raw_hci(bt_cfd, ecs_test_msg, 7); + return hw_vendor; } =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 -test_connection_req(int bt_cfd, int* bd) +ericsson_init_phys(int fd) { - int hdl, i; - bt_connection btcon; + fd_setup(fd, 57600, USE_FLOW_CTRL); +} =20=20=20=20=20 - for (i =3D 0; i < 6; i++) +void +ericsson_init_hw(int bt_cfd, int phys_fd, int spd) { - btcon.bd[i] =3D (unsigned char)bd[i]; - } + bt_write_scan_enable(bt_cfd, 0 /* inpars not used */); =20=20=20 - printf("*** Connecting baseband ***\n"); + sleep(1); =20=20=20 -#ifndef BT_USERSTACK - if ((hdl =3D ioctl(bt_cfd, HCITESTCONNECTREQ, btcon.bd)) < 0) - { - perror("test con req"); + /* set_event_filter must be called for m/s switch on IrmaC! */ + bt_set_event_filter(bt_cfd, 0 /* inpars not used */); + + sleep(1); // wait for HW... + + printf("Setting baudrate in Ericsson module!\n");=20=20 + bt_set_baudrate(bt_cfd, spd); +=20=20 + /* Now set phys device speed to whatever HW was set to use */ + fd_setup(phys_fd, spd, USE_FLOW_CTRL); + tcflush(phys_fd, TCIOFLUSH); } -#else - hdl =3D hci_test_connect_req(btcon.bd); -#endif =20=20=20 - printf("Returned handle : %d\n", hdl); +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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*/ + +/* Set the phys device to CSR default, 115200 */=20 +void +csr_init_phys(int fd) +{ + syslog(LOG_INFO, "Setting default speed 115200"); + fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 +/* fixme -- remove hardcoded values */ void -ericsson_tx_test(int bt_cfd, int* tmp) +csr_init_hw(int bt_cfd, int phys_fd, int spd) { - unsigned char ecs_test_msg[17]; - unsigned char test_msg[17]; - int i; + unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); =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); - ecs_test_msg[3] =3D 13; + printf("Setting write_scan_enable in CSR module!\n"); =20=20=20=20=20 - /* cast ints to to uchars */ - for (i =3D 4; i < 14; i++) - { - ecs_test_msg[i] =3D (unsigned char)tmp[i-4]; - } + bt_write_scan_enable(bt_cfd, wrscan); =20=20=20 - /* length of test data */ - ecs_test_msg[15] =3D (unsigned char)(tmp[10] & 0xff);=20=20=20=20 - ecs_test_msg[16] =3D (unsigned char)((tmp[10] >> 8)&0xff); + /* improves reliability when doing a connect */ + printf("Setting write_pagescan_activity in CSR module!\n"); =20=20=20 - printf("*** Sending Ericsson_TX_Test ***\n"); + bt_write_pagescan_activity(bt_cfd, 0x50, 0x20); =20=20=20 - printf("RX_On_Start : 0x%x\n", ecs_test_msg[4]); - printf("Synt_On_Start : 0x%x\n", ecs_test_msg[5]); - printf("TX_On_Start : 0x%x\n", ecs_test_msg[6]); - printf("Phd_Off_Start : 0x%x\n", ecs_test_msg[7]); - printf("Test_Scenario : 0x%x\n", ecs_test_msg[8]); - printf("Hopping_Mode : 0x%x\n", ecs_test_msg[9]); - printf("TX_Frequency : 0x%x\n", ecs_test_msg[10]); - printf("RX_Frequency : 0x%x\n", ecs_test_msg[11]); - printf("TX_Test_Interval : 0x%x\n", ecs_test_msg[12] ); - printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[13]); - printf("Length_Of_Test_Data : 0x%x\n", tmp[10]); + sleep(1); =20=20=20 - bt_send_raw_hci(bt_cfd, test_msg, 17); + bt_set_event_filter(bt_cfd, 0 /* inpars not used */); =20 - printf("TX test starting.\n"); -} + syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20 =20 -#endif /* ECS_TEST_FUNCTIONS */ + bt_set_baudrate(bt_cfd, spd); =20 -#elif HW_USED(HW_DIGIANSWER) + syslog(LOG_INFO, "Baudrate set\n"); =20 + /* Now set phys device speed to whatever HW was set to use */ + fd_setup(phys_fd, spd, USE_FLOW_CTRL); + tcflush(phys_fd, TCIOFLUSH); +} + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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 Digianswer default, 9600 */=20 -void init_phys(int fd) +void +digianswer_init_phys(int fd) { fd_setup(fd, 9600, USE_FLOW_CTRL); } =20=20 -init_hw(int bt_cfd, int phys_fd, int spd) +void +digianswer_init_hw(int bt_cfd, int phys_fd, int spd) { printf("Setting baudrate in Digianswer PC card\n"); =20 - bt_set_baudrate(spd); + bt_set_baudrate(bt_cfd, spd); =20=20=20 if (spd > 115200) { @@ -247,101 +282,76 @@ tcflush(phys_fd, TCIOFLUSH); } =20 -#elif HW_USED(HW_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 */ +/* 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 -/* Set the phys device to CSR default, 115200 */=20 -void init_phys(int fd) +void +usb_init_phys(int fd) { - syslog(LOG_INFO, "Setting default speed 115200"); fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 -/* fixme -- remove hardcoded values */ void -init_hw(int bt_cfd, int phys_fd, int spd) +usb_init_hw(int bt_cfd, int phys_fd, int spd) { unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); =20 - printf("Setting write_scan_enable in CSR module!\n"); + printf("Setting write_scan_enable in USB module!\n"); =20 bt_write_scan_enable(bt_cfd, wrscan); -=20=20 - /* improves reliability when doing a connect */ - printf("Setting write_pagescan_activity in CSR module!\n"); - - bt_write_pagescan_activity(bt_cfd, 0x50, 0x20); - - sleep(1); - bt_set_event_filter(bt_cfd, 0 /* inpars not used */); - - syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20 - - bt_set_baudrate(bt_cfd, spd); - - syslog(LOG_INFO, "Baudrate set\n"); -=20=20 - /* Now set phys device speed to whatever HW was set to use */ - fd_setup(phys_fd, spd, USE_FLOW_CTRL); - tcflush(phys_fd, TCIOFLUSH); } =20 -#elif HW_USED(HW_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*/ -/* Generic specific commands */ +/* 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 -void init_phys(int fd) +void +generic_init_phys(int fd) { fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 void -init_hw(int bt_cfd, int phys_fd, int spd) +generic_init_hw(int bt_cfd, int phys_fd, int spd) { unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); =20 - printf("Setting write_scan_enable in USB module!\n"); + printf("Setting write_scan_enable in generic module!\n"); =20=20=20 bt_write_scan_enable(bt_cfd, wrscan); bt_set_event_filter(bt_cfd, 0 /* inpars not used */); - } =20 -#elif HW_USED(HW_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*/ -/* HW No init commands */ +/* 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*/ =20 -void init_phys(int fd) +void +no_init_phys(int fd) { - printf("init_phys: No hardware.\n"); } =20 void -init_hw(int bt_cfd, int phys_fd, int spd) +no_init_hw(int bt_cfd, int phys_fd, int spd) { - printf("No hw init done\n"); } =20 -#else /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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*/ =20 -void init_phys(int fd) +void +unknown_init_phys(int fd) { printf("ERROR: init_phys() not implemented!\n"); } =20 -init_hw(int bt_cfd, int phys_fd, int spd) +void +unknown_init_hw(int bt_cfd, int phys_fd, int spd) { printf("ERROR: init_hw() not implemented!\n"); } - -#endif /* HW_USED() */ =20 /*********************************************************************/ --- bt_vendor.h 2001/03/02 10:59:57 1.1 +++ bt_vendor.h 2001/04/20 16:11:35 1.2 @@ -57,11 +57,4 @@ void init_hw(int bt_cfd, int phys_fd, int spd); void init_phys(int fd); =20 -#if HW_USED(HW_ERICSSON) -void enable_dut(int bt_cfd); -void test_connection_req(int bt_cfd, int* bd); -void ericsson_test_control(int bt_cfd, int* tmp); -void ericsson_enter_test_mode(int bt_cfd, int* tmp); -void ericsson_tx_test(int bt_cfd, int* tmp); -#endif #endif /* __BT_VENDOR_H__*/ |
From: Peter K. <pk...@us...> - 2001-04-26 15:58:15
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.c 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_misc.h 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 btd.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Renamed get_local_addr() to get_local_ip_address(), and improved the way it works. The diff of the modified file(s): --- bt_misc.c 2001/04/25 18:04:23 1.7 +++ bt_misc.c 2001/04/26 15:58:15 1.8 @@ -231,28 +231,33 @@ =20 =20 /*=20 - * Set server_name to the numerical IP of eth0 instead of using DNS or - * relying on /etc/hosts being correct. for now. + * Retrieve the numerical IP address of eth0 for now. */ -void get_local_addr(char *str) +char * get_local_ip_address(void) { - char *local_address =3D NULL; - int fd =3D socket(AF_INET, SOCK_DGRAM, 0); + int fd; struct ifreq ifr; - strcpy(ifr.ifr_name, "eth0"); - ioctl(fd, SIOCGIFADDR, (int)&ifr); - close(fd); - local_address =3D strdup(inet_ntoa(((struct sockaddr_in *) - &ifr.ifr_addr)->sin_addr)); + static char ip[20]; =20=20=20 - if (!local_address) + if ((fd =3D socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - syslog(LOG_INFO, "could not determine local IP address!\n"); + syslog(LOG_INFO, "Could not determine local IP address!"); + return "0.0.0.0"; } =20 - strcpy(str, local_address); + strcpy(ifr.ifr_name, "eth0"); + if (ioctl(fd, SIOCGIFADDR, (int)&ifr) < 0) + { + syslog(LOG_INFO, "Could not determine local IP address!"); + close(fd); + return "0.0.0.0"; + } =20 - free(local_address); + close(fd); + + strcpy(ip, inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr)); + + return ip; } =20 int=20 --- bt_misc.h 2001/04/04 10:43:04 1.4 +++ bt_misc.h 2001/04/26 15:58:15 1.5 @@ -58,7 +58,7 @@ int open_tcpsocket(char *addrstr, int role); =20 int write_pidfile(char *pidname); -void get_local_addr(char *str); +char *get_local_ip_address(void); const char* bd2str(const unsigned char *bd); #ifndef BT_USERSTACK void print_data(const char *message, unsigned char *buf, int len); --- btd.c 2001/04/25 17:58:24 1.10 +++ btd.c 2001/04/26 15:58:15 1.11 @@ -480,7 +480,7 @@ opts[i++] =3D "ktune"; /* enables ip_forwarding */ }=20=20 =20=20=20=20=20 - get_local_addr(local_ip); + strcpy(local_ip, get_local_ip_address()); /* local/remote ip */ sprintf(ip_addresses, "%s:%s", local_ip, inet_ntoa(ipset->ip)); =20=20=20=20=20 @@ -527,7 +527,7 @@ } else {=20=20=20=20 - get_local_addr(local_ip); + strcpy(local_ip, get_local_ip_address()); =20=20=20=20=20 /* local IP */ sprintf(ip_addresses, "%s:", local_ip); |
From: Peter K. <pk...@us...> - 2001-06-15 12:36:26
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20 btd.c 1.21 1.22=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): --- bt_if.c 2001/06/13 12:26:05 1.19 +++ bt_if.c 2001/06/15 12:36:25 1.20 @@ -642,12 +642,12 @@ printf("done.\n"); } =20 -/* fixme<1> -- add "line" parameter to differentiate between the=20 - remote devices */ void -read_remote_bd(int bt_cfd, unsigned char *bd_addr) +read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr) { #ifndef BT_USERSTACK + *(int*)bd_addr =3D line; + if (ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) < 0) { perror(__FUNCTION__); @@ -656,7 +656,7 @@ BD_ADDR rev_bd; int i; =20 - get_remote_bd(rev_bd); + get_remote_bd(line, rev_bd); =20 /* return as big endian */ for (i =3D 0; i < 6; i++) { --- bt_if.h 2001/06/13 12:25:02 1.13 +++ bt_if.h 2001/06/15 12:36:25 1.14 @@ -144,7 +144,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]) @@ -319,7 +319,7 @@ int bt_set_baudrate(int bt_cfd, int spd); void bt_set_bd_addr(int bt_cfd, unsigned char *bd); void read_local_bd(int bt_cfd, unsigned char *bd_addr); -void read_remote_bd(int bt_cfd, unsigned char *bd_addr); +void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr); void role_switch(int bt_cfd, unsigned char *bd_addr, int role); =20 int bt_set_event_filter(int bt_cfd, unsigned char filter[3]); --- btd.c 2001/06/14 15:13:23 1.21 +++ btd.c 2001/06/15 12:36:25 1.22 @@ -415,7 +415,7 @@ syslog(LOG_INFO, "Found connection on line: %d", line); STATE(line) =3D CONNECTED; =20=20=20=20=20=20=20 - read_remote_bd(bt_cfd, PEER(line).remote_bd); + read_remote_bd(bt_cfd, line, PEER(line).remote_bd); printf("Remote bd: %s\n", bd2str(PEER(line).remote_bd)); =20=20=20=20=20=20=20 if (ipa_available) |
From: Peter K. <pk...@us...> - 2001-08-29 09:36:46
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.30 1.31=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.c 1.23 1.24=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Moved csr_bcspmode() to bt_if.c and renamed it to bt_bcsp_mode(). The diff of the modified file(s): --- bt_if.c 2001/08/29 08:39:09 1.30 +++ bt_if.c 2001/08/29 09:36:45 1.31 @@ -168,6 +168,29 @@ return buffer; #else return bt_hw_firmware(); +#endif +} + +int +bt_bcsp_mode(int bt_cfd, int enable) +{ +#ifndef BT_USERSTACK + int fd =3D (bt_cfd < 0 ? bt_openctrl() : bt_cfd); + + if (fd < 0 || ioctl(fd, BTSETBCSPMODE, &enable) < 0) + { + perror(__FUNCTION__); + exit(1); + } + + if (bt_cfd < 0) + { + close(fd); + } + + return enable; +#else + return 0; #endif } =20 --- bt_if.h 2001/08/29 08:39:09 1.20 +++ bt_if.h 2001/08/29 09:36:45 1.21 @@ -248,7 +248,7 @@ #define BTTESTCOMMAND _IOW(BT_IOC_MAGIC, 0xf2, unsigned char[261]) =20 #define BTSETMSSWITCH _IOW(BT_IOC_MAGIC, 0xf3, unsigned char) -#define BTSETBCSPMODE _IOW(BT_IOC_MAGIC, 0xf4, unsigned char) +#define BTSETBCSPMODE _IOWR(BT_IOC_MAGIC, 0xf4, int) =20 #define CSR_PSKEY_MSGHDR_SIZE 3 #define CSR_PSKEY_MAXPARAMS 10 @@ -299,6 +299,7 @@ char* bt_hw_vendor(void); #endif char* bt_firmware_info(void); +int bt_bcsp_mode(int bt_cfd, int enable); void reset_hw(void); int bt_openctrl(void); void set_bt_line_disc(int phys_fd, int bt_disc, char* physdev); --- bt_vendor.c 2001/08/29 08:51:47 1.23 +++ bt_vendor.c 2001/08/29 09:36:45 1.24 @@ -257,17 +257,7 @@ fd_setup(fd, 115200, USE_FLOW_CTRL, USE_BCSP); } =20 -void -csr_bcspmode(int bt_cfd, int enable) -{ - if (ioctl(bt_cfd, BTSETBCSPMODE, &enable) < 0) - { - perror(__FUNCTION__); - exit(1); - } -} =20 - /* * Read/Write any PS key in CSR module=20 * ps_vals holds return values / set params depending on=20 @@ -342,7 +332,7 @@ syslog(LOG_INFO, "Changing CSR host IF: H4 -> BCSP"); =20=20=20=20=20 /* Temporarily set stack to use BCSP framing */ - csr_bcspmode(bt_cfd, 1); + bt_bcsp_mode(bt_cfd, 1); =20=20=20=20=20 /* Setup serial port for BCSP (default baudrate) */ fd_setup(phys_fd, 115200, USE_FLOW_CTRL, USE_BCSP); @@ -395,14 +385,14 @@ }=20=20=20 =20=20=20=20=20 /* Set back stack to use H4 framing */ - csr_bcspmode(bt_cfd, 0); + bt_bcsp_mode(bt_cfd, 0); } else { syslog(LOG_INFO, "Changing CSR host IF: BCSP -> H4"); =20 /* Set stack to use H4 temporarily */=20=20=20=20=20=20=20=20 - csr_bcspmode(bt_cfd, 0); + bt_bcsp_mode(bt_cfd, 0); =20=20=20=20=20 /* Setup serial port for H4 (default baudrate) */ fd_setup(phys_fd, 115200, USE_FLOW_CTRL, DONT_USE_BCSP); @@ -440,7 +430,7 @@ /* Should not be needed if hw_vendor is changed in kernel ....*/ =20=20=20=20=20=20=20 /* Set back stack to use BCSP framing */ - csr_bcspmode(bt_cfd, 1); + bt_bcsp_mode(bt_cfd, 1); }=20 else { |
From: Peter K. <pk...@us...> - 2001-09-10 09:41:51
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btconfig.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 btd.c 1.26 1.27=20=20=20=20=20=20=20=20=20=20=20=20 btinit.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected long_options[] for options that do not take an argument. The diff of the modified file(s): --- btconfig.c 2001/07/10 13:01:35 1.5 +++ btconfig.c 2001/09/10 09:41:50 1.6 @@ -114,7 +114,7 @@ static struct option long_options[] =3D { { "file", 1, NULL, 'f' }, /* config file name */ - { "help", 1, NULL, 'h' }, /* show help */ + { "help", 0, NULL, 'h' }, /* show help */ { "force-msswitch", 1, NULL, 'm' }, /* force m/s switch as server */ { "name", 1, NULL, 'n' }, /* set BT friendly name */ { "wrscan-enable", 1, NULL, 'w' }, /* sets write scan enable */ --- btd.c 2001/09/06 16:16:26 1.26 +++ btd.c 2001/09/10 09:41:50 1.27 @@ -189,7 +189,7 @@ {"physdev", 1, NULL, 'u'}, /* phys device used from stack */ {"modem-emul", 1, NULL, 'm'}, {"local-name", 1, NULL, 'n'}, /* set local bluetooth name */ - {"reset", 1, NULL, 'R'}, /* reset BT HW */ + { "reset", 0, NULL, 'R' }, /* reset BT HW */ {"speed", 1, NULL, 's'}, /* uart speed towards hw */ {0, 0, 0, 0} }; --- btinit.c 2001/09/06 16:16:26 1.14 +++ btinit.c 2001/09/10 09:41:50 1.15 @@ -119,7 +119,7 @@ {"initial-speed", 1, NULL, 'i'}, /* initial uart speed */ {"physdev", 1, NULL, 'u'}, /* phys device used from stack */ {"local-name", 1, NULL, 'n'}, /* set local bluetooth name */ - {"reset", 1, NULL, 'R'}, /* reset BT HW */ + { "reset", 0, NULL, 'R' }, /* reset BT HW */ {"speed", 1, NULL, 's'}, /* uart speed towards hw */ {0, 0, 0, 0} }; |
From: Anders J. <and...@us...> - 2002-02-06 11:31:59
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.30 1.31=20=20=20=20=20=20=20=20=20=20=20=20 bttest.c 1.23 1.24=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Patch from Alain Paschoud: * Added IOCTL to get remotename of a device. * Added INCLUDE_PAN to the Makefile. * Added remote_name command to bttest. * Added bnep_test command to bttest. The diff of the modified file(s): --- Makefile 2001/10/18 15:56:25 1.11 +++ Makefile 2002/02/06 11:31:56 1.12 @@ -16,6 +16,7 @@ #HAVE_READLINE =3D 1 =20 INCLUDE_UNPLUG_TEST =3D 1 +INCLUDE_PAN =3D 1 =20 INSTDIR =3D $(prefix)/bin/ INSTMODE =3D 0755 @@ -44,6 +45,10 @@ =20 ifdef INCLUDE_UNPLUG_TEST CFLAGS +=3D -DCONFIG_BLUETOOTH_UNPLUG_TEST +endif + +ifdef INCLUDE_PAN +CFLAGS +=3D -DCONFIG_BLUETOOTH_PAN endif =20 CFLAGS +=3D -MMD --- bt_if.h 2002/01/18 13:44:39 1.30 +++ bt_if.h 2002/02/06 11:31:56 1.31 @@ -78,6 +78,8 @@ #define L2CAP_TEST2_LAYER 0x1233 #define L2CAP_TEST3_LAYER 0x4461 =20 +#define BT_NAME_LENGTH 248 + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ /* SDP server */ =20 @@ -147,6 +149,7 @@ #define HCIPINCODENEGATIVEREPLY _IOWR(BT_IOC_MAGIC, 0x24, unsigned char[6]) #define HCIAUTHENTICATION_REQUESTED _IOW(BT_IOC_MAGIC, 0x25, unsigned char= [6]) #define HCISETCONNECTION_ENCRYPTION _IOW(BT_IOC_MAGIC, 0x26, unsigned char= [7]) +#define HCIREMOTENAME_REQUEST _IOW(BT_IOC_MAGIC, 0x27, unsigned char[255]) =20 /* Link Policy Commands */ =20 --- bttest.c 2001/10/16 16:26:43 1.23 +++ bttest.c 2002/02/06 11:31:56 1.24 @@ -80,6 +80,7 @@ "\nMenu", "------------------------", " inq <max nbr resp> <inq time>", + " remote_name <xx:xx:xx:xx:xx:xx>", " rf_conn <xx:xx:xx:xx:xx:xx> <srv ch> <line>", " rf_send <nbr bytes> <nbr repeats> <line>",=20 " rf_disc <line>", @@ -102,6 +103,9 @@ #endif #ifdef CONFIG_BLUETOOTH_UNPLUG_TEST " upt <teststring>", /* e.g testcase 4.3 't 43' */ +#ifdef CONFIG_BLUETOOTH_PAN + " bnep_test <param> <testcase>", +#endif #endif " quit",=20 =20 @@ -522,7 +526,7 @@ retval =3D bt_testcmd(bt_cfd, buf); } else if(sscanf(buf, "hotlist_set %d %x:%x:%x:%x:%x:%x",=20 - &tmp[6], &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tm= p[5])) + &tmp[6], &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tm= p[5])=3D=3D 7) { FILE *hotlist_fd; int i, j; @@ -571,6 +575,30 @@ printf("Enabling sending of disconnect respons\n"); bt_testcmd(bt_cfd, buf); }=20=20=20 + else if(sscanf(buf, "bnep_test %d %d",=20 + &tmp[0], &tmp[1]) =3D=3D 2) + {=20 + if (ioctl(bt_cfd, BNEPTEST, &tmp[0]) < 0) + { + perror(__FUNCTION__); + return 0; + } + }=20 + else if(sscanf(buf, "remote_name %x:%x:%x:%x:%x:%x",=20=20 + &bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5]) =3D=3D 6) + { + unsigned char remote_name[BT_NAME_LENGTH + 1]; + memcpy(&remote_name[0], &bd[0], 6); +=20=20=20=20 + if (retval =3D ioctl(bt_cfd, HCIREMOTENAME_REQUEST, &remote_name[0])) + { + printf("Remote Name Request Failed (status %d)\n", retval); + return 0; + } + printf("Remote Name (%02X:%02X:%02X:%02X:%02X:%02X): %s\n",=20 + bd[0], bd[1], bd[2], bd[3], bd[4], bd[5], remote_name); + } + else { printf("> error: command not recognized or wrong syntax\n"); |
From: Anders J. <and...@us...> - 2002-02-28 20:08:34
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.43 1.44=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.31 1.32=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.c 1.31 1.32=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * bt_set_event_filter should now handle any type of filter. The diff of the modified file(s): --- bt_if.c 26 Feb 2002 18:08:59 -0000 1.43 +++ bt_if.c 28 Feb 2002 20:08:31 -0000 1.44 @@ -863,18 +863,22 @@ #endif } =20 -int bt_set_event_filter(int bt_cfd, unsigned char filter[3]) +int bt_set_event_filter(int bt_cfd, unsigned char *filter, int len) { int result; + unsigned char tmp[255]; =20 - syslog(LOG_INFO, "Setting event filter [0x%x 0x%x 0x%x]",=20 - filter[0], filter[1], filter[2]); + syslog(LOG_INFO, "Setting event filter"); =20 #ifdef BT_USERSTACK - result =3D hci_set_event_filter((u8*)filter); + result =3D hci_set_event_filter((u8*)filter, len); #else =20 - if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, filter)) < 0) + tmp[0] =3D (len >> 8) & 0xff; + tmp[1] =3D len & 0xff; + memcpy(&tmp[2], filter, len); + + if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, tmp)) < 0) {=20 perror(__FUNCTION__); exit(1); --- bt_if.h 6 Feb 2002 11:31:56 -0000 1.31 +++ bt_if.h 28 Feb 2002 20:08:31 -0000 1.32 @@ -178,7 +178,7 @@ #define HCIWRITE_AUTHENTICATION_ENABLE _IOWR(BT_IOC_MAGIC, 0x3c, int) #define HCIREAD_ENCRYPTION_MODE _IOR(BT_IOC_MAGIC, 0x3d, int) #define HCIWRITE_ENCRYPTION_MODE _IOWR(BT_IOC_MAGIC, 0x3e, int) -#define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[3]) +#define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[255]) =20 /* Informational Parameters */ =20 @@ -333,7 +333,7 @@ void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr); void role_switch(int bt_cfd, unsigned char *bd_addr, int role); =20 -int bt_set_event_filter(int bt_cfd, unsigned char filter[3]); +int bt_set_event_filter(int bt_cfd, unsigned char *filter, int len); int bt_write_scan_enable(int bt_cfd, unsigned int flags); void bt_write_pagescan_activity(int bt_cfd, unsigned int interval,=20 unsigned int wind); --- bt_vendor.c 16 Oct 2001 15:02:20 -0000 1.31 +++ bt_vendor.c 28 Feb 2002 20:08:31 -0000 1.32 @@ -474,6 +474,7 @@ csr_init_hw(int bt_cfd, int phys_fd, const char *speedstr) { /* Connection setup, all devices, no auto accept */ + unsigned char clear_filter[1] =3D { 0x00 }; unsigned char filter[3] =3D { 0x02, 0x00, 0x01 }; unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); int firmware =3D -1; @@ -491,7 +492,8 @@ =20 bt_write_pagescan_activity(bt_cfd, 0x0800, 0x12); =20 - bt_set_event_filter(bt_cfd, filter); + bt_set_event_filter(bt_cfd, clear_filter, 1); + bt_set_event_filter(bt_cfd, filter, 3); =20 sleep(1);=20=20 =20 @@ -565,7 +567,7 @@ =20 D(syslog(LOG_INFO, "Setting baudrate in Digianswer PC card")); =20 - bt_set_event_filter(bt_cfd, filter); + bt_set_event_filter(bt_cfd, filter, 3); =20 if (speedstr) { @@ -605,7 +607,7 @@ sleep(1); =20 /* set_event_filter must be called for m/s switch on IrmaC! */ - bt_set_event_filter(bt_cfd, filter); + bt_set_event_filter(bt_cfd, filter, 3); =20 sleep(1); // wait for HW... =20 @@ -681,7 +683,7 @@ =20 sleep(1); =20 - bt_set_event_filter(bt_cfd, filter); + bt_set_event_filter(bt_cfd, filter, 3); } =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*/ @@ -704,7 +706,7 @@ D(syslog(LOG_INFO, "Setting write_scan_enable in generic module")); =20=20=20 bt_write_scan_enable(bt_cfd, wrscan); - bt_set_event_filter(bt_cfd, filter); + bt_set_event_filter(bt_cfd, filter, 3); } =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*/ |
From: Alain P. <apa...@us...> - 2002-03-18 16:10:54
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- README_btsec.txt 1.1 Added btsec.c 1.1 Added btsec.h 1.1 Added The accompanying log: Add files that implement a simple security manager |
From: Anders J. <and...@us...> - 2002-08-06 17:56:16
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bt_if.c 1.49 1.50=20=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.35 1.36=20=20=20=20=20=20=20=20=20=20=20=20=20=20 btdisc.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added IOCTL to disconnect the BB based on the BD-address. * btdisc can now be called with the argument -a <BD>. The diff of the modified file(s): --- bt_if.c 17 Jun 2002 13:47:58 -0000 1.49 +++ bt_if.c 6 Aug 2002 17:56:15 -0000 1.50 @@ -65,7 +65,7 @@ #include "bt_user.h" #include "bt_errno.h" =20 -#define D(x) //x +#define D(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 */ /* Functions common for kernel and usermode stack */ @@ -327,6 +327,31 @@ } =20=20=20 ret_val =3D bt_disconnect(con_id); +#endif + return ret_val; +} + +/* Disconnect the BlueTooth - BlueTooth connection (Consafe) + * Parameter : Remote BT device BT Address=20 + */ +int +bt_disconnect_bb(int bt_fd, unsigned char *rem_bd) +{ + unsigned char buf[6]; + int i, ret_val =3D 0; + + /* Reverse before get handler */ + for (i =3D 0; i < 6; i++) + { + buf[5-i] =3D (unsigned char)*rem_bd++; + } +#ifndef BT_USERSTACK + if ((ret_val =3D ioctl(bt_fd, BTDISCONNECT_BB, buf)) < 0) + printf("Disconnect BB failed [%s (%d)] err=3D%s\n", error_msg(ret_val)= , MSG_GET_CODE(-ret_val), strerror(errno)); + else + printf("BB Disconnected\n"); +#else + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif return ret_val; } --- bt_if.h 3 Jun 2002 10:07:28 -0000 1.35 +++ bt_if.h 6 Aug 2002 17:56:15 -0000 1.36 @@ -137,6 +137,9 @@ //#define BT_SDP_REQUEST _IOW(BT_IOC_MAGIC, 0x0F, bt_sdp_request) #define BT_GETCACHEDLINKKEY _IOWR(BT_IOC_MAGIC, 0x10, unsigned char[22]) =20 +/* Disconnect the BB connection (Consafe) */ +#define BTDISCONNECT_BB _IOW(BT_IOC_MAGIC, 0x11, unsigned char[6]) + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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 executing HCI commands */ =20 @@ -327,6 +330,7 @@ =20 int bt_connect(int bt_fd, unsigned char *bd, unsigned int con_id); int bt_disconnect(int bt_fd, unsigned int con_id); +int bt_disconnect_bb(int bt_fd, unsigned char *rem_bd); /* (Consafe) */ =20 void bt_waitline(int bt_fd, int line); void bt_waitconnection(int bt_fd, int line); --- btdisc.c 14 May 2001 11:29:36 -0000 1.6 +++ btdisc.c 6 Aug 2002 17:56:15 -0000 1.7 @@ -63,9 +63,12 @@ #include "bt_misc.h" =20=20=20=20=20 #define DEFAULT_BTDEV "/dev/ttyBT0" +#define D(x) =20 /*=20 * Syntax: btdisc [-d <dev>] -D <rfcomm dlci>=20 + * also -a <bd_address_string> (disconnect BB Consafe) + * bd_address_string example : 00:40:8c:cd:00:00=20=20 */ =20 int @@ -73,7 +76,10 @@ { char *btdev =3D DEFAULT_BTDEV; int con_id, bt_cfd, dlci =3D -1, line, opt; - int result; + int result =3D 0; + unsigned char bd[6]; + int i, use_bd =3D 0, error =3D 0; + int tmp[6]; =20 /* Print header if called via http */ if (getenv("REQUEST_METHOD") !=3D NULL) @@ -82,7 +88,7 @@ } =20 /* now parse options */ - while ((opt =3D getopt(argc, argv, "d:D:")) !=3D -1) + while ((opt =3D getopt(argc, argv, "a:d:D:")) !=3D -1) { switch (opt) { @@ -97,15 +103,38 @@ printf("RFCOMM dlci: %d\n", dlci); break; =20=20=20=20=20=20=20 + case 'a': + if (sscanf(optarg, "%2x:%2x:%2x:%2x:%2x:%2x", + &tmp[0], &tmp[1], &tmp[2], + &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6) + {=20 + for (i =3D 0; i < 6; i++) + { + bd[i] =3D (unsigned char)tmp[i];=20 + }=20=20=20=20=20=20 +=20=20=20=20=20=20=20=20 + D(syslog(LOG_INFO,"Rem. Address:%2x:%2x:%2x:%2x:%2x:%2x\n", + bd[0], bd[1], bd[2], + bd[3], bd[4], bd[5])); + use_bd =3D 1; + }=20 + else=20 + { + error =3D 1; + }=20=20 + break; + +=20=20=20=20=20=20 default: break; } } =20 - if (optind < argc || dlci < 0) + if (optind < argc || (dlci < 0 && !use_bd) || error) { printf("Wrong syntax or missing parameters\n"); printf("Syntax: %s [-d <dev>] -D <rfcomm dlci>\n", argv[0]); + printf(" %s -a <BD address>\n", argv[0]); exit(0); } =20 @@ -123,15 +152,23 @@ exit(1); } =20 + if(!use_bd)=20 + { line =3D atoi((char*)(btdev+10)); =20=20=20 - /* Connect RFCOMM session on line */ + /* Disconnect RFCOMM session on line */ printf("Disconnecting line %d [%s]\n", line, btdev); + D(syslog(LOG_INFO,"Disconnecting line %d [%s]\n", line, btdev)); =20 con_id =3D CREATE_RFCOMM_ID(line, dlci); =20 result =3D bt_disconnect(bt_cfd, con_id); - + }=20 + else=20 + { + /* Disconnect any connection which match the remote bd, i.e. the baseb= andconnection */ + bt_disconnect_bb(bt_cfd, bd); + } close(bt_cfd); exit(result); } |
From: Anders J. <and...@us...> - 2003-01-13 19:49:08
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bt_if.c 1.55 1.56=20=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.38 1.39=20=20=20=20=20=20=20=20=20=20=20=20=20=20 btd.c 1.41 1.42=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added support to get class of device. The diff of the modified file(s): --- bt_if.c 19 Nov 2002 14:15:46 -0000 1.55 +++ bt_if.c 13 Jan 2003 19:48:07 -0000 1.56 @@ -1141,6 +1141,47 @@ #endif } =20 +void=20 +read_remote_class(int bt_cfd, unsigned char *bd_addr, unsigned char *remot= e_class) +{ + int err =3D 0; + int i; + + unsigned char result[6]; +=20=20 + for (i =3D 0; i < 6; i++) + { + result[i] =3D bd_addr[5-i]; + } +#ifndef BT_USERSTACK + + if (ioctl(bt_cfd, BTREADREMOTECLASSOFDEV, result) < 0) + { + perror(__FUNCTION__); + err =3D -1; + } +#else + if((con =3D get_con(result, ANY_STATE)))=20 + { + memcpy(result, con->remote_class_of_dev, 3); + }=20 + else=20 + { + err =3D -1; + } +#endif + if(err < 0) + { + memset(remote_class, 0, 3); + }=20 + else=20 + { + remote_class[2] =3D result[0]; + remote_class[1] =3D result[1]; + remote_class[0] =3D result[2]; + }=20=20=20=20=20=20=20 +} + void enable_dut(int bt_cfd) { --- bt_if.h 19 Nov 2002 14:21:18 -0000 1.38 +++ bt_if.h 13 Jan 2003 19:48:14 -0000 1.39 @@ -140,6 +140,7 @@ #define BTDISCONNECT_BB _IOW(BT_IOC_MAGIC, 0x11, unsigned char[6]) =20 #define BTREADREMOTENAME _IOWR(BT_IOC_MAGIC, 0x12, unsigned char[BT_NAME_L= ENGTH]) +#define BTREADREMOTECLASSOFDEV _IOWR(BT_IOC_MAGIC, 0x13, unsigned char[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 */ /* Ioctls for executing HCI commands */ @@ -358,6 +359,7 @@ void bt_set_bd_addr(int bt_cfd, unsigned char *bd); void read_local_bd(int bt_cfd, unsigned char *bd_addr); void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr); +void read_remote_class(int bt_cfd, unsigned char *bd_addr, unsigned char *= remote_class); int read_remote_name(int bt_cfd, int line, unsigned char *name, unsigned i= nt length); void role_switch(int bt_cfd, unsigned char *bd_addr, int role); =20 --- btd.c 22 Nov 2002 16:59:03 -0000 1.41 +++ btd.c 13 Jan 2003 19:48:16 -0000 1.42 @@ -499,6 +499,7 @@ static char remote_bd_addr[18]; static char remote_bd_str[36]; static char local_bd_str[32]; + static char remote_class_of_dev[27]; static char remote_name[20 + BT_NAME_LENGTH]; struct ip_set *ipset =3D PEER(line).ipset; int i =3D 0; @@ -533,6 +534,7 @@ if (ipset->useradius) { unsigned char local_bd[6]; + unsigned char class_of_device[3]; =20 opts[i++] =3D "plugin"; opts[i++] =3D "radius.so"; @@ -578,6 +580,15 @@ =20 opts[i++] =3D "avpair"; opts[i++] =3D remote_bd_str; + + read_remote_class(bt_cfd, PEER(line).remote_bd, class_of_device); + sprintf(remote_class_of_dev, "Axis-BT-Client-Type=3D%02x%02x%02x", + class_of_device[0],=20 + class_of_device[1],=20 + class_of_device[2]); + + opts[i++] =3D "avpair"; + opts[i++] =3D remote_class_of_dev; =20 if (*PEER(line).remote_name) { |
From: Anders J. <and...@us...> - 2003-04-14 08:47:57
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bt_if.c 1.57 1.58=20=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.39 1.40=20=20=20=20=20=20=20=20=20=20=20=20=20=20 btconfig.c 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added option p to btconfig, set to one to force piconet mode if we are acting as a server. This means that any client which fail to do the M/S switch will be disconnected. The diff of the modified file(s): --- bt_if.c 6 Feb 2003 15:31:08 -0000 1.57 +++ bt_if.c 14 Apr 2003 08:47:22 -0000 1.58 @@ -669,6 +669,20 @@ return 0; } =20 +int bt_dont_allow_slave(int bt_cfd, int flag) +{ + syslog(LOG_INFO, __FUNCTION__": %d", flag); +#ifndef BT_USERSTACK + if (ioctl(bt_cfd, BTDONTALLOWSLAVE, &flag) < 0) + { + perror(__FUNCTION__); + return -1; + } +#endif + return 0; +} + + int bt_set_max_conections(int bt_cfd, int connections) { syslog(LOG_INFO, __FUNCTION__ ": %d", connections); --- bt_if.h 13 Jan 2003 19:48:14 -0000 1.39 +++ bt_if.h 14 Apr 2003 08:47:23 -0000 1.40 @@ -257,6 +257,8 @@ #define BTSETMSSWITCH _IOW(BT_IOC_MAGIC, 0xf3, unsigned char) #define BTSETBCSPMODE _IOWR(BT_IOC_MAGIC, 0xf4, int) =20 +#define BTDONTALLOWSLAVE _IOW(BT_IOC_MAGIC, 0xfb, unsigned char) + #define CSR_PSKEY_MSGHDR_SIZE 3 #define CSR_PSKEY_MAXPARAMS 40 =20 @@ -340,6 +342,7 @@ int bt_send(int fd, int len, int repeat); void bt_showstatus(void); int bt_force_msswitch_as_server(int bt_cfd, int enable); +int bt_dont_allow_slave(int bt_cfd, int flag); int bt_set_max_conections(int bt_cfd, int connections); =20 /* --- btconfig.c 26 Feb 2002 17:43:32 -0000 1.11 +++ btconfig.c 14 Apr 2003 08:47:23 -0000 1.12 @@ -107,6 +107,7 @@ static int var_add_host_name =3D FALSE; static int var_write_scan_enable =3D -1; /* not yet set */ static int var_force_ms_switch =3D -1; /* not yet set */ +static int var_dont_allow_slave =3D -1; /* not yet set */ static int var_set_local_name =3D 0; static int var_max_connections =3D -1; /* not yet set */ static short var_max_power =3D SHRT_MAX; /* not yet set */ @@ -120,6 +121,8 @@ { "name", 1, NULL, 'n' }, /* set BT friendly name */ { "wrscan-enable", 1, NULL, 'w' }, /* sets write scan enable */ { "max-connections", 1, NULL, 'c' }, /* sets max simultatious connectio= ns */ + { "piconet-mode", 1, NULL, 'p' }, /* set if we disallow clients whic= h doesn't support + the M/S switch */ { 0, 0, 0, 0 } }; =20 @@ -138,13 +141,14 @@ int opt_write_scan_enable =3D -1; int opt_force_ms_switch =3D -1; int opt_max_connections =3D -1; + int opt_dont_allow_slave =3D -1; =20=20=20 char *opt_name =3D NULL; char *opt_config_file =3D CONF_FILE; =20 /* Parse command line options */ =20 - while ((opt =3D getopt_long(argc, argv, "f:hm:n:w:c:", + while ((opt =3D getopt_long(argc, argv, "f:hm:n:w:c:p:", long_options, &option_index)) !=3D -1) { switch (opt) @@ -177,6 +181,12 @@ opt_max_connections =3D atoi(optarg); break; =20=20=20=20=20=20=20 + case 'p': + /* Piconet mode, meaning that we disconnect any + clients which fail to do M/S switching */ + opt_dont_allow_slave =3D atoi(optarg); + break; +=20=20=20=20=20=20 default: break; } @@ -208,7 +218,8 @@ var_write_scan_enable >=3D 0 || var_force_ms_switch >=3D 0 || var_max_connections >=3D 0 || - var_max_power !=3D SHRT_MAX) + var_max_power !=3D SHRT_MAX || + var_dont_allow_slave >=3D 0) { /* Open BT ctrl device */=20=20 if ((bt_cfd =3D bt_openctrl()) < 0) @@ -240,6 +251,9 @@ if (var_max_power !=3D SHRT_MAX) bt_set_max_power(bt_cfd, var_max_power); =20=20=20=20=20 + if (var_dont_allow_slave >=3D 0) + bt_dont_allow_slave(bt_cfd, var_dont_allow_slave); +=20=20=20=20 close(bt_cfd); } =20 @@ -465,6 +479,13 @@ D(syslog(LOG_INFO, __FUNCTION__ ": Maximum transmit power: %s", value)= ); } =20=20=20 + else if (!strcasecmp(field, "DisconnectOnMSFailure")) + { + var_dont_allow_slave =3D !strcasecmp(value, "yes"); + D(syslog(LOG_INFO, __FUNCTION__ ": Disconnect on MS-switch failure: %s= ", + (var_dont_allow_slave ? "yes" : "no"))); + } + return TRUE; } /* configure_field */ =20 |