mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-01 00:28:18 +00:00
daemon: add --with-intel-usb
This commit is contained in:
parent
88362d5ee0
commit
8129e5420f
@ -94,6 +94,10 @@
|
||||
#include "rfcomm_service_db.h"
|
||||
#include "socket_connection.h"
|
||||
|
||||
#ifdef HAVE_INTEL_USB
|
||||
#include "btstack_chipset_intel_firmware.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_BLE
|
||||
#include "ble/gatt_client.h"
|
||||
#include "ble/att_server.h"
|
||||
@ -204,7 +208,7 @@ static void stop_power_off_timer(void);
|
||||
static client_state_t * client_for_connection(connection_t *connection);
|
||||
static void hci_emit_system_bluetooth_enabled(uint8_t enabled);
|
||||
static void stack_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * packet, uint16_t size);
|
||||
|
||||
static void btstack_server_configure_stack(void);
|
||||
|
||||
// MARK: globals
|
||||
|
||||
@ -212,7 +216,15 @@ static void stack_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
||||
static hci_transport_config_uart_t hci_transport_config_uart;
|
||||
#endif
|
||||
|
||||
// used for stack configuration
|
||||
static const hci_transport_t * transport;
|
||||
static void * config = NULL;
|
||||
static btstack_control_t * control;
|
||||
|
||||
#ifdef HAVE_INTEL_USB
|
||||
static int intel_firmware_loaded;
|
||||
#endif
|
||||
|
||||
static btstack_timer_source_t timeout;
|
||||
static uint8_t timeout_active = 0;
|
||||
static int power_management_sleep = 0;
|
||||
@ -862,6 +874,17 @@ void daemon_gatt_serialize_characteristic_descriptor(gatt_client_characteristic_
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTEL_USB
|
||||
static void btstack_server_intel_firmware_done(int result){
|
||||
intel_firmware_loaded = 1;
|
||||
transport->close();
|
||||
// setup stack
|
||||
btstack_server_configure_stack();
|
||||
// start power up
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int btstack_command_handler(connection_t *connection, uint8_t *packet, uint16_t size){
|
||||
|
||||
bd_addr_t addr;
|
||||
@ -912,7 +935,12 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
start_power_off_timer();
|
||||
} else if (!power_management_sleep) {
|
||||
stop_power_off_timer();
|
||||
#ifdef HAVE_INTEL_USB
|
||||
// before staring up the stack, load intel firmware
|
||||
btstack_chipset_intel_download_firmware(transport, &btstack_server_intel_firmware_done);
|
||||
#else
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case BTSTACK_GET_VERSION:
|
||||
@ -1929,7 +1957,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
|
||||
static char hostname[30];
|
||||
|
||||
static void btstack_server_configure_stack(btstack_control_t * control, void * config){
|
||||
static void btstack_server_configure_stack(void){
|
||||
// init HCI
|
||||
hci_init(transport, config);
|
||||
if (btstack_link_key_db){
|
||||
@ -2011,7 +2039,6 @@ int btstack_server_run(int tcp_flag){
|
||||
socket_connection_init();
|
||||
|
||||
btstack_control_t * control = NULL;
|
||||
void * config = NULL;
|
||||
const btstack_uart_block_t * uart_block_implementation = NULL;
|
||||
(void) uart_block_implementation;
|
||||
|
||||
@ -2081,7 +2108,9 @@ int btstack_server_run(int tcp_flag){
|
||||
log_info("BTStack Server started\n");
|
||||
log_info("version %s, build %s", BTSTACK_VERSION, BTSTACK_DATE);
|
||||
|
||||
btstack_server_configure_stack(control, config);
|
||||
#ifndef HAVE_INTEL_USB
|
||||
btstack_server_configure_stack();
|
||||
#endif
|
||||
|
||||
#ifdef USE_LAUNCHD
|
||||
socket_connection_create_launchd();
|
||||
|
@ -6,13 +6,14 @@ AC_INIT([BTstack], 0.1)
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
AC_ARG_WITH(hci-transport, [AS_HELP_STRING([--with-hci-transport=transportType], [Specify BT type to use: h4, usb])], HCI_TRANSPORT=$withval, HCI_TRANSPORT="h4")
|
||||
AC_ARG_WITH(uart-device, [AS_HELP_STRING([--with-uart-device=uartDevice], [Specify BT UART device to use])], UART_DEVICE=$withval, UART_DEVICE="DEFAULT")
|
||||
AC_ARG_WITH(uart-speed, [AS_HELP_STRING([--with-uart-speed=uartSpeed], [Specify BT UART speed to use])], UART_SPEED=$withval, UART_SPEED="115200")
|
||||
AC_ARG_ENABLE(launchd, [AS_HELP_STRING([--enable-launchd],[Compiles BTdaemon for use by launchd])], USE_LAUNCHD=$enableval, USE_LAUNCHD="no")
|
||||
AC_ARG_WITH(vendor-id, [AS_HELP_STRING([--with-vendor-id=vendorID], [Specify USB BT Dongle vendorID])], USB_VENDOR_ID=$withval, USB_VENDOR_ID="0")
|
||||
AC_ARG_WITH(product-id, [AS_HELP_STRING([--with-product-id=productID], [Specify USB BT Dongle productID])], USB_PRODUCT_ID=$withval, USB_PRODUCT_ID="0")
|
||||
|
||||
AC_ARG_WITH(hci-transport, [AS_HELP_STRING([--with-hci-transport=transportType], [Specify BT type to use: h4, usb])], HCI_TRANSPORT=$withval, HCI_TRANSPORT="h4")
|
||||
AC_ARG_WITH(uart-device, [AS_HELP_STRING([--with-uart-device=uartDevice], [Specify BT UART device to use])], UART_DEVICE=$withval, UART_DEVICE="DEFAULT")
|
||||
AC_ARG_WITH(uart-speed, [AS_HELP_STRING([--with-uart-speed=uartSpeed], [Specify BT UART speed to use])], UART_SPEED=$withval, UART_SPEED="115200")
|
||||
AC_ARG_WITH(vendor-id, [AS_HELP_STRING([--with-vendor-id=vendorID], [Specify USB BT Dongle vendorID])], USB_VENDOR_ID=$withval, USB_VENDOR_ID="0")
|
||||
AC_ARG_WITH(product-id, [AS_HELP_STRING([--with-product-id=productID], [Specify USB BT Dongle productID])], USB_PRODUCT_ID=$withval, USB_PRODUCT_ID="0")
|
||||
AC_ARG_ENABLE(launchd, [AS_HELP_STRING([--enable-launchd], [Compiles BTdaemon for use by launchd])], USE_LAUNCHD=$enableval, USE_LAUNCHD="no")
|
||||
AC_ARG_ENABLE(intel-usb, [AS_HELP_STRING([--enable-intel-usb], [Enable Intel firmware support ])], ENABLE_INTEL_USB=$enableval, ENABLE_INTEL_USB="no")
|
||||
|
||||
# BUILD/HOST/TARGET
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
@ -176,6 +177,12 @@ if test "x$HCI_TRANSPORT" = xUSB; then
|
||||
echo "#define HAVE_TRANSPORT_USB" >> btstack_config.h
|
||||
echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> btstack_config.h
|
||||
echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> btstack_config.h
|
||||
|
||||
if test "x$ENABLE_INTEL_USB" = xyes; then
|
||||
echo "#define HAVE_INTEL_USB" >> btstack_config.h
|
||||
FIRMWARE_FILES="\${INTEL_FILES}"
|
||||
USB_SOURCES+=" btstack_chipset_intel_firmware.c"
|
||||
fi
|
||||
else
|
||||
UART_SOURCES=btstack_uart_block_$UART_BLOCK.o
|
||||
echo "#define HAVE_TRANSPORT_H4" >> btstack_config.h
|
||||
@ -189,6 +196,7 @@ fi
|
||||
echo >> btstack_config.h
|
||||
echo "#endif" >> btstack_config.h
|
||||
|
||||
AC_SUBST(FIRMWARE_FILES)
|
||||
AC_SUBST(REMOTE_DEVICE_DB_SOURCES)
|
||||
AC_SUBST(USB_SOURCES)
|
||||
AC_SUBST(UART_SOURCES)
|
||||
|
2
port/daemon/src/.gitignore
vendored
Normal file
2
port/daemon/src/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.ddc
|
||||
*.sfi
|
@ -6,6 +6,7 @@ CC = @CC@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
CFLAGS = @CFLAGS@ \
|
||||
-I ${BTSTACK_ROOT}/3rd-party/micro-ecc \
|
||||
-I ${BTSTACK_ROOT}/chipset/intel \
|
||||
-I $(BTSTACK_ROOT)/platform/daemon/src \
|
||||
-I $(BTSTACK_ROOT)/platform/daemon/src \
|
||||
-I $(BTSTACK_ROOT)/platform/posix \
|
||||
@ -18,6 +19,7 @@ USB_CFLAGS = @USB_CFLAGS@
|
||||
USB_LDFLAGS = @USB_LDFLAGS@
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
|
||||
VPATH += ${BTSTACK_ROOT}/chipset/intel
|
||||
VPATH += ${BTSTACK_ROOT}/platform/daemon/src
|
||||
VPATH += ${BTSTACK_ROOT}/platform/corefoundation
|
||||
VPATH += ${BTSTACK_ROOT}/platform/libusb
|
||||
@ -80,9 +82,12 @@ BTdaemon_SOURCES = \
|
||||
.m.o:
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# libBTstack.a
|
||||
all: libBTstack.$(BTSTACK_LIB_EXTENSION) BTdaemon libBTstackServer.$(BTSTACK_LIB_EXTENSION)
|
||||
|
||||
# Intel Firmware files
|
||||
include ${BTSTACK_ROOT}/chipset/intel/Makefile.inc
|
||||
all: @FIRMWARE_FILES@
|
||||
|
||||
libBTstack.$(BTSTACK_LIB_EXTENSION): $(libBTstack_SOURCES)
|
||||
$(BTSTACK_ROOT)/tool/get_version.sh
|
||||
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(BTSTACK_LIB_LDFLAGS) -o $@
|
||||
|
Loading…
Reference in New Issue
Block a user