mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
added install-iphone target, removed Makefile.iphone
This commit is contained in:
parent
5137d207ec
commit
a8cd57edc5
@ -1,2 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
SUBDIRS = src
|
||||
|
||||
iphone_ip=@IPHONE_IP@
|
||||
install-iphone: src/BTdaemon
|
||||
cp $< $<-signed
|
||||
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $<-signed
|
||||
scp $<-signed mobile@$(iphone_ip):/var/mobile/BTdaemon
|
||||
|
||||
|
@ -1,64 +0,0 @@
|
||||
NAME = BTdaemon
|
||||
|
||||
# set IP address of your phone. this is using USB and Internet Tethering
|
||||
IPHONE = 192.168.20.1
|
||||
|
||||
SRCDIR = src
|
||||
VPATH = src
|
||||
|
||||
# These paths must be changed to match the compilation environment
|
||||
DEVELOPER_PATH = /Developer/Platforms/iPhoneOS.platform/Developer
|
||||
SDK_VERSION = 2.0
|
||||
SDK_PATH = $(DEVELOPER_PATH)/SDKs/iPhoneOS$(SDK_VERSION).sdk
|
||||
GCC_VERSION = 4.0.1
|
||||
|
||||
#
|
||||
CC = $(DEVELOPER_PATH)/usr/bin/arm-apple-darwin9-gcc-$(GCC_VERSION)
|
||||
CFLAGS = -g0 -O2 -Wall -Werror -I. -Iinclude \
|
||||
-I$(SDK_PATH)/usr/include \
|
||||
-I$(SDK_PATH)/usr/lib/gcc/arm-apple-darwin9/4.0.1/include \
|
||||
-F$(SDK_PATH)/System/Library/Frameworks \
|
||||
|
||||
LDFLAGS = \
|
||||
-multiply_defined suppress \
|
||||
-L$(SDK_PATH)/usr/lib \
|
||||
-framework CoreFoundation \
|
||||
-L$(SDK_PATH)/System/Library/Frameworks/IOKit.framework/Versions/A \
|
||||
-lIOKit
|
||||
|
||||
SRCS = \
|
||||
bt_control_iphone.c \
|
||||
daemon.c \
|
||||
hci.c \
|
||||
hci_dump.c \
|
||||
hci_transport_h4.c \
|
||||
l2cap.c \
|
||||
main.c \
|
||||
run_loop.c \
|
||||
socket_server.c \
|
||||
|
||||
HEADERS = \
|
||||
bt_control.h \
|
||||
bt_control_iphone.h \
|
||||
hci.h \
|
||||
hci_dump.h \
|
||||
hci_transport.h \
|
||||
hci_transport_h4.h \
|
||||
l2cap.h \
|
||||
run_loop.h \
|
||||
socket_server.h \
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
clean:
|
||||
rm -fr $(NAME) *.o
|
||||
|
||||
$(SRCS): $(HEADERS)
|
||||
|
||||
$(NAME): $(SRCS)
|
||||
$(CC) $(CFLAGS) -o $(NAME) $(filter %.mm,$^) $(filter %.m,$^) $(filter %.c,$^) $(LDFLAGS)
|
||||
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $(NAME)
|
||||
ssh mobile@$(IPHONE) rm -f /var/mobile/$(NAME)
|
||||
scp $(NAME) mobile@$(IPHONE):/var/mobile
|
||||
|
||||
.PHONY: all clean
|
35
configure.in
35
configure.in
@ -5,10 +5,11 @@ AC_PREREQ(2.60)
|
||||
AC_INIT(BTstack, 0.1)
|
||||
AM_INIT_AUTOMAKE(BTstack,0.1)
|
||||
|
||||
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(hci-transport, [AS_HELP_STRING([--with-hci-transport=transportType], [Specify BT type to use: h4, usb (not supported yet])], 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(bluetool, [AS_HELP_STRING([--disable-bluetool],[Disable init of Bluetooth module by BlueTool])], USE_BLUETOOL=$enableval, USE_BLUETOOL="DEFAULT")
|
||||
AC_ARG_WITH(iphone-ip, [AS_HELP_STRING([--with-iphone-ip=192.168.1.5], [Specify IP address used by iPhone for installation (not supported yet)])], IPHONE_IP=$withval, IPHONE_IP="")
|
||||
AC_ARG_WITH(vendor-id, [AS_HELP_STRING([--with-vendor-id=vendorID], [Specify USB BT Dongle vendorID])], USB_VENDOR_ID=$withval, USB_VENDOR_ID="")
|
||||
AC_ARG_WITH(product-id, [AS_HELP_STRING([--with-product-id=productID], [Specify USB BT Dongle productID])], USB_PRODUCT_ID=$withval, USB_PRODUCT_ID="")
|
||||
|
||||
@ -59,8 +60,29 @@ echo
|
||||
echo "BTstack configured for HCI $HCI_TRANSPORT Transport"
|
||||
|
||||
# iPhone/iPod touch cross-compilation for darwin
|
||||
DEVELOPER_PATH="/Developer/Platforms/iPhoneOS.platform/Developer"
|
||||
SDK_VERSION="2.0"
|
||||
SDK_PATH="$DEVELOPER_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
|
||||
GCC_VERSION="4.0.1"
|
||||
if test "x$target" = xiphone; then
|
||||
echo "Cross-compiling for iPhone/iPod touch"
|
||||
case "$host_os" in
|
||||
darwin*)
|
||||
echo "Cross-compiling for iPhone/iPod touch using Apple's iPhone SDK"
|
||||
echo "iPhone IP for install-iphone target: $IPHONE_IP"
|
||||
CC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin9-gcc-$GCC_VERSION"
|
||||
CFLAGS="$CFLAGS -g"
|
||||
CFLAGS="$CFLAGS -I$SDK_PATH/usr/include"
|
||||
CFLAGS="$CFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin9/$GCC_VERSION/include"
|
||||
CFLAGS="$CFLAGS -F$SDK_PATH/System/Library/Frameworks"
|
||||
LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework CoreFoundation"
|
||||
LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A"
|
||||
LDFLAGS="$LDFLAGS -lIOkit"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(Don't know how to compile without Apple's iPhone SDK, sorry.)
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "x$UART_DEVICE" = xDEFAULT ; then
|
||||
UART_DEVICE=/dev/tty.bluetooth
|
||||
fi
|
||||
@ -90,17 +112,18 @@ echo
|
||||
echo "// config.h created by configure for BTstack " `date`> config.h
|
||||
if test "x$HCI_TRANSPORT" = xUSB; then
|
||||
echo "#define HAVE_TRANSPORT_USB" >> config.h
|
||||
echo "#define USB_PRODUCT_ID=$USB_PRODUCT_ID" >> config.h
|
||||
echo "#define USB_VENDOR_ID=$USB_VENDOR_ID" >> config.h
|
||||
echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> config.h
|
||||
echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> config.h
|
||||
else
|
||||
echo "#define HAVE_TRANSPORT_H4" >> config.h
|
||||
echo "#define UART_DEVICE=$UART_DEVICE" >> config.h
|
||||
echo "#define UART_SPEED=$UART_SPEED" >> config.h
|
||||
echo "#define UART_DEVICE \"$UART_DEVICE\"" >> config.h
|
||||
echo "#define UART_SPEED $UART_SPEED" >> config.h
|
||||
if test "x$USE_BLUETOOL" = xyes; then
|
||||
echo "#define USE_BLUETOOL" >> config.h
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(IPHONE_IP)
|
||||
AC_SUBST(HAVE_LIBUSB)
|
||||
AC_OUTPUT(Makefile)
|
||||
AC_OUTPUT(src/Makefile)
|
||||
|
62
src/daemon.c
62
src/daemon.c
@ -21,11 +21,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "hci_transport_h4.h"
|
||||
#include "hci_transport_usb.h"
|
||||
#include "hci_dump.h"
|
||||
#include "bt_control_iphone.h"
|
||||
|
||||
#include "l2cap.h"
|
||||
|
||||
@ -33,7 +32,18 @@
|
||||
#include "socket_server.h"
|
||||
#include "daemon.h"
|
||||
|
||||
#ifdef USE_BLUETOOL
|
||||
#include "bt_control_iphone.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TRANSPORT_H4
|
||||
#include "hci_transport_h4.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TRANSPORT_USB
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include "hci_transport_usb.h"
|
||||
#endif
|
||||
|
||||
hci_con_handle_t con_handle_out = 0;
|
||||
hci_con_handle_t con_handle_in = 0;
|
||||
@ -220,49 +230,25 @@ static hci_uart_config_t config;
|
||||
|
||||
int daemon_main (int argc, const char * argv[]){
|
||||
|
||||
#if 0
|
||||
pid_t parent_pid = fork();
|
||||
|
||||
if (parent_pid > 0) {
|
||||
// parent returns
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bt_control_t * control = NULL;
|
||||
|
||||
#ifndef __IPHONE__
|
||||
//
|
||||
if (argc <= 1){
|
||||
printf("HCI Daemon tester. Specify device name for Ericsson ROK 101 007\n");
|
||||
return 1;
|
||||
}
|
||||
#ifdef HAVE_TRANSPORT_H4
|
||||
transport = hci_transport_h4_instance();
|
||||
config.device_name = UART_DEVICE;
|
||||
config.baudrate = UART_SPEED;
|
||||
config.flowcontrol = 1;
|
||||
#endif
|
||||
|
||||
// Ancient Ericsson ROK 101 007 (ca. 2001)
|
||||
config.device_name = argv[1];
|
||||
config.baudrate = 57600;
|
||||
config.flowcontrol = 1;
|
||||
#else
|
||||
// iPhone
|
||||
config.device_name = "/dev/tty.bluetooth";
|
||||
config.baudrate = 115200;
|
||||
// config.baudrate = 230400; // ok
|
||||
// config.baudrate = 460800; // ok
|
||||
// config.baudrate = 921600; // ok
|
||||
// config.baudrate = 2400000; // does not work (yet)
|
||||
config.flowcontrol = 1;
|
||||
#ifdef HAVE_TRANSPORT_USB
|
||||
transport = hci_transport_usb_instance();
|
||||
#endif
|
||||
|
||||
#ifdef USE_BLUETOOL
|
||||
control = &bt_control_iphone;
|
||||
#endif
|
||||
|
||||
// use logger: format HCI_DUMP_PACKETLOGGER or HCI_DUMP_BLUEZ
|
||||
hci_dump_open("/tmp/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);
|
||||
|
||||
#if 1
|
||||
// H4 UART
|
||||
transport = hci_transport_h4_instance();
|
||||
#else
|
||||
transport = hci_transport_usb_instance();
|
||||
#endif
|
||||
|
||||
// init HCI
|
||||
hci_init(transport, &config, control);
|
||||
|
Loading…
x
Reference in New Issue
Block a user