Browse Source

add bluetoothd server

Huan.Feng 3 years ago
parent
commit
c4caa58c4b

+ 12 - 0
package/bluez5_utils/bluez5_utils.mk

@@ -31,6 +31,10 @@ BLUEZ5_UTILS_CONF_OPTS += --disable-obex
 endif
 
 ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS_CLIENT),y)
+define BLUEZ5_UTILS_INSTALL_BTD
+	$(INSTALL) -D -m 0755 $(@D)/src/bluetoothd $(TARGET_DIR)/usr/bin/bluetoothd
+endef
+BLUEZ5_UTILS_POST_INSTALL_TARGET_HOOKS += BLUEZ5_UTILS_INSTALL_BTD
 BLUEZ5_UTILS_CONF_OPTS += --enable-client
 BLUEZ5_UTILS_DEPENDENCIES += readline
 else
@@ -133,4 +137,12 @@ else
 BLUEZ5_UTILS_CONF_OPTS += --disable-systemd
 endif
 
+define BLUEZ5_UTILS_INSTALL_INIT_SYSTEMD
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/bluetooth.target.wants
+	ln -fs ../../../../usr/lib/systemd/system/bluetooth.service \
+		$(TARGET_DIR)/etc/systemd/system/bluetooth.target.wants/bluetooth.service
+	ln -fs ../../../usr/lib/systemd/system/bluetooth.service \
+		$(TARGET_DIR)/etc/systemd/system/dbus-org.bluez.service
+endef
+
 $(eval $(autotools-package))

+ 35 - 0
package/brcm-patchram-plus/S90bluetooth

@@ -0,0 +1,35 @@
+#! /bin/sh
+
+set -e
+
+DESC="bluetooth"
+NAME=bluetoothd
+DAEMON=/usr/sbin/$NAME
+
+case "$1" in
+  start)
+	printf "Starting $DESC: "
+	start-stop-daemon -S -b -x $NAME
+	brcm_patchram_plus --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram /etc/firmware/bcm4343b0.hcd /dev/ttyS2 & >/dev/null
+	#hciconfig hci0 up
+	echo "OK"
+	;;
+  stop)
+	printf "Stopping $DESC: "
+	start-stop-daemon -K -x $NAME
+	echo "OK"
+	;;
+  restart|force-reload)
+	echo "Restarting $DESC: "
+	$0 stop
+	sleep 1
+	$0 start
+	echo ""
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0

+ 4 - 0
package/brcm-patchram-plus/brcm-patchram-plus.mk

@@ -10,4 +10,8 @@ BRCM_PATCHRAM_PLUS_LICENSE = Apache-2.0
 BRCM_PATCHRAM_PLUS_LICENSE_FILES = COPYING
 BRCM_PATCHRAM_PLUS_AUTORECONF = YES
 
+define BRCM_PATCHRAM_PLUS_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 package/brcm-patchram-plus/S90bluetooth $(TARGET_DIR)/etc/init.d/S90bluetooth
+endef
+
 $(eval $(autotools-package))